diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ee21afdd78a1812ed68ebe58e3192b041e6b46d..1926afa07676fc63d7817a6e18ce43f47d9ea90a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,47 @@ +2.0.0.0-dev71 +============= +* Fixed bugs: + * Fixed an issue with displaying product on the frontend when the product flat indexer is enabled + * Fixed an issue with applying catalog price rules on the category level + * Fixed an issue where the essential cookies like CUSTOMER, CART, and so on were not created in Google Chrome + * Fixed an issue with placing orders by customers assigned to a VAT group + * Fixed an issue with incorrect error message during registration, and inability for a shopper to ask for resending a confirmation email + * Fixed an issue where the Catalog module resource Setup Upgrade logic was broken +* Modularity improvements: + * Moved abstract Core models and related logic to the Magento/Model library + * Moved the abstract DB logic and Core resource helpers to the Magento/DB library + * Eliminated the Core\Model\App class + * Moved the Magento Flag functionality to the library + * Resolved dependency of the Catalog and related modules on the Review module + * Moved indexers related logic from the Core module to the Indexer module + * Moved the Inline translation and user intended translate functionality from the Core module to a separate Translation module +* Framework Improvements: + * Covered Magento library components with unit tests: + * Magento\Config + * Magento\Convert + * Magento\Controller + * Magento\Data\Collection\Db + * Magento\Mview + * Magento\Url and Magento/Url.php + * Covered Magento application components with unit tests: + * Magento\Checkout\Model\Config + * Magento\Checkout\Model\Observer + * Magento\Checkout\Model\Type + * Magento\Sales\Model\Config + * Renamed LauncherInterface to AppInterface +* Improvements in code coverage calculation: + * Updated the whitelist filter with library code for integration tests code coverage calculation +* GitHub requests: + * [#512] (https://github.com/magento/magento2/issues/512) -- Theme Thumbnails not showing + * [#520] (https://github.com/magento/magento2/pull/502) -- Corrected Search Engine Optimization i18n + * [#519] (https://github.com/magento/magento2/issues/519) -- New Theme Activation +* Customer Service usage: + * Refactored the Log module to use Customer Service + * Refactored the RSS module to use Customer Service + * Refactored the Review module to use Customer Service + * Refactored the Catalog module to use Customer service layer + * Refactored the Downloadable module to use Customer service layer + 2.0.0.0-dev70 ============= * Fixed bugs: diff --git a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php index c12578f51af8d86d8ec6a15d3c1ad30edf8b4175..86c78a3650a060cc4a02fe8baba7ee5d5fd94e3b 100644 --- a/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php +++ b/app/code/Magento/AdminNotification/Controller/Adminhtml/Notification.php @@ -60,7 +60,7 @@ class Notification extends \Magento\Backend\App\AbstractAction $notificationId ); $this->messageManager->addSuccess(__('The message has been marked as Read.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -121,7 +121,7 @@ class Notification extends \Magento\Backend\App\AbstractAction $this->messageManager->addSuccess( __('A total of %1 record(s) have been marked as Read.', count($ids)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -149,7 +149,7 @@ class Notification extends \Magento\Backend\App\AbstractAction try { $model->setIsRemove(1)->save(); $this->messageManager->addSuccess(__('The message has been removed.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); @@ -178,7 +178,7 @@ class Notification extends \Magento\Backend\App\AbstractAction } } $this->messageManager->addSuccess(__('Total of %1 record(s) have been removed.', count($ids))); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __("We couldn't remove the messages because of an error.")); diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 3b144e83175f6433307f99fc2193f7a215220af6..1715651a556fe5dce676649a9e7bbfba8a733ed4 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Feed extends \Magento\Core\Model\AbstractModel +class Feed extends \Magento\Model\AbstractModel { const XML_USE_HTTPS_PATH = 'system/adminnotification/use_https'; @@ -64,7 +64,7 @@ class Feed extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Backend\App\ConfigInterface $backendConfig * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -73,7 +73,7 @@ class Feed extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/AdminNotification/Model/Inbox.php b/app/code/Magento/AdminNotification/Model/Inbox.php index 34e31eb3525d5a966f8e6f6837b78acc17360051..cc5c4adb9e9548050a476ca017852f6791d422a2 100644 --- a/app/code/Magento/AdminNotification/Model/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Inbox.php @@ -49,7 +49,7 @@ namespace Magento\AdminNotification\Model; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Inbox extends \Magento\Core\Model\AbstractModel +class Inbox extends \Magento\Model\AbstractModel { const SEVERITY_CRITICAL = 1; @@ -133,13 +133,13 @@ class Inbox extends \Magento\Core\Model\AbstractModel * @param string|string[] $description * @param string $url * @param bool $isInternal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function add($severity, $title, $description, $url = '', $isInternal = true) { if (!$this->getSeverities($severity)) { - throw new \Magento\Core\Exception(__('Wrong message type')); + throw new \Magento\Model\Exception(__('Wrong message type')); } if (is_array($description)) { $description = '<ul><li>' . implode('</li><li>', $description) . '</li></ul>'; diff --git a/app/code/Magento/AdminNotification/Model/NotificationService.php b/app/code/Magento/AdminNotification/Model/NotificationService.php index 52682a63c2666bf70240ea749c282d7bcc8b466d..7efd5f064a2184e40b51ab9122ca4b00013df718 100644 --- a/app/code/Magento/AdminNotification/Model/NotificationService.php +++ b/app/code/Magento/AdminNotification/Model/NotificationService.php @@ -52,14 +52,14 @@ class NotificationService * * @param int $notificationId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function markAsRead($notificationId) { $notification = $this->_notificationFactory->create(); $notification->load($notificationId); if (!$notification->getId()) { - throw new \Magento\Core\Exception('Wrong notification ID specified.'); + throw new \Magento\Model\Exception('Wrong notification ID specified.'); } $notification->setIsRead(1); $notification->save(); diff --git a/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php index 13e63de1d03c41bfbbc66e0ee7cfd7010f0b798d..98b0cb708cca4e4c1d998617a50a83e15e65a3a4 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Grid/Collection.php @@ -38,7 +38,7 @@ class Collection extends \Magento\AdminNotification\Model\Resource\Inbox\Collect /** * Add remove filter * - * @return \Magento\AdminNotification\Model\Resource\Grid\Collection|\Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\AdminNotification\Model\Resource\Grid\Collection|\Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _initSelect() { diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox.php index c2a08fa4a2102be8e0151bf45d5f4df7449563c8..d11427c33e75e87740d5dd60c9b0dc94ff300ef3 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model\Resource; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Inbox extends \Magento\Core\Model\Resource\Db\AbstractDb +class Inbox extends \Magento\Model\Resource\Db\AbstractDb { /** * AdminNotification Resource initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php index 65d7f585990f7951a7905acc3a6cc75c780c28f1..93d421916904428ace5e2f7dca46065480b0d4fd 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection.php @@ -32,7 +32,7 @@ namespace Magento\AdminNotification\Model\Resource\Inbox; * @package Magento_AdminNotification * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php index 0c2d6abde7ac512b26010b7adb77fb69bf0ce811..2599f958784d9e7d9a56ba88646557bb9ece3500 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php +++ b/app/code/Magento/AdminNotification/Model/Resource/Inbox/Collection/Critical.php @@ -25,7 +25,7 @@ */ namespace Magento\AdminNotification\Model\Resource\Inbox\Collection; -class Critical extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Critical extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message.php index 24a35da93fb9f58c7156d34cc7b831bc371961f0..eb1305f857e6d3badc55598b26c9c4b8ba151198 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\Resource\System; -class Message extends \Magento\Core\Model\Resource\Db\AbstractDb +class Message extends \Magento\Model\Resource\Db\AbstractDb { /** * Flag that notifies whether Primary key of table is auto-incremeted diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php index 90d863c767d656a8b849716fa54c2820f598fcb7..1bf58e16f75379da1db00585cad3e52916a4369c 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\AdminNotification\Model\Resource\System\Message; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * System message list @@ -46,7 +46,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\AdminNotification\Model\System\MessageList $messageList * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -55,7 +55,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\AdminNotification\Model\System\MessageList $messageList, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_messageList = $messageList; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php index 6b5f82526e4fdee2ff2157f098f520c49554193c..1e909f509938216352b748b66178df3b03491ca2 100644 --- a/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php +++ b/app/code/Magento/AdminNotification/Model/Resource/System/Message/Collection/Synchronized.php @@ -35,7 +35,7 @@ class Synchronized extends \Magento\AdminNotification\Model\Resource\System\Mess /** * Store new messages in database and remove outdated messages * - * @return $this|\Magento\Core\Model\Resource\Db\AbstractDb + * @return $this|\Magento\Model\Resource\Db\AbstractDb */ public function _afterLoad() { diff --git a/app/code/Magento/AdminNotification/Model/Survey.php b/app/code/Magento/AdminNotification/Model/Survey.php index ea16a0cb2bb13260850608e294c564f1e3dac4ac..f2c12c5b43feccef75068db9e1f1404f381eaf26 100644 --- a/app/code/Magento/AdminNotification/Model/Survey.php +++ b/app/code/Magento/AdminNotification/Model/Survey.php @@ -44,12 +44,12 @@ class Survey protected $_flagCode = 'admin_notification_survey'; /** - * @var \Magento\Core\Model\Flag + * @var \Magento\Flag */ protected $_flagModel = null; /** - * @var \Magento\Core\Model\FlagFactory + * @var \Magento\FlagFactory */ protected $_flagFactory; @@ -59,10 +59,10 @@ class Survey protected $_request; /** - * @param \Magento\Core\Model\FlagFactory $flagFactory + * @param \Magento\FlagFactory $flagFactory * @param \Magento\App\RequestInterface $request */ - public function __construct(\Magento\Core\Model\FlagFactory $flagFactory, \Magento\App\RequestInterface $request) + public function __construct(\Magento\FlagFactory $flagFactory, \Magento\App\RequestInterface $request) { $this->_request = $request; $this->_flagFactory = $flagFactory; @@ -100,7 +100,7 @@ class Survey /** * Return core flag model * - * @return \Magento\Core\Model\Flag + * @return \Magento\Flag */ protected function _getFlagModel() { diff --git a/app/code/Magento/AdminNotification/Model/System/Message.php b/app/code/Magento/AdminNotification/Model/System/Message.php index 2fc941aebcd517615a0b538cb9ff38b689fa6dcd..d606ae60dfe20a9a11f4d91b7a12eaf5d492d5c7 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message.php +++ b/app/code/Magento/AdminNotification/Model/System/Message.php @@ -23,8 +23,7 @@ */ namespace Magento\AdminNotification\Model\System; -class Message extends \Magento\Core\Model\AbstractModel implements - \Magento\AdminNotification\Model\System\MessageInterface +class Message extends \Magento\Model\AbstractModel implements \Magento\AdminNotification\Model\System\MessageInterface { /** * @return void diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php index f55c5a596632bc1cdeec18157a5196dbaec95f04..f4488a33c6fd0863c7ff0a4e5e1f5de135a2b128 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment.php @@ -150,7 +150,7 @@ class Payment extends \Magento\Sales\Controller\Adminhtml\Order\Create $result['success'] = 1; $isError = false; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { $this->messageManager->addError($message); diff --git a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php index 6a8183053ff85a79923828dc3a274dd4a9d28f46..a20c0951ae06a8efc4212830156a3f85efd6d5c7 100644 --- a/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Payment.php @@ -77,7 +77,7 @@ class Payment extends \Magento\Backend\App\Action )->getPaymentMethodsHtml( $this->_view ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { diff --git a/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php index a9d5945137be424bb0d6837a8bae66004e6eadc7..c367ba997df92ba9221c34eaed576e733cf4ec8a 100644 --- a/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Authorizenet/Payment.php @@ -67,7 +67,7 @@ class Payment extends \Magento\App\Action\Action )->getPaymentMethodsHtml( $this->_view ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['error_message'] = $e->getMessage(); } catch (\Exception $e) { diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php index ca5c2c6212f99bc31b3f996761c1984548cc828e..485331289dc177d450b6111f1ac6debd608e085b 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment.php @@ -114,7 +114,7 @@ class Payment extends \Magento\App\Action\Action } $paymentMethod->process($data); $result['success'] = 1; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $result['success'] = 0; $result['error_msg'] = $e->getMessage(); diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index 8f26a9ebbc0fda2e7a13acf6c03ff078e1fc72f1..04ac998df3aaa3a3ff9bf2ebc00930c073b53235 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -497,12 +497,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authorize(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for authorization.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for authorization.')); } $this->_initCardsStorage($payment); @@ -524,12 +524,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for capture.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for capture.')); } $this->_initCardsStorage($payment); if ($this->_isPreauthorizeCapture($payment)) { @@ -594,7 +594,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $requestedAmount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $requestedAmount) { @@ -604,7 +604,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $cardsStorage->getCapturedAmount() - $cardsStorage->getRefundedAmount() ) < $requestedAmount ) { - throw new \Magento\Core\Exception(__('This is an invalid amount for refund.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for refund.')); } $messages = array(); @@ -650,12 +650,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Payment\Model\Info $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function cancelPartialAuthorization(\Magento\Payment\Model\Info $payment) { if (!$payment->getAdditionalInformation($this->_splitTenderIdKey)) { - throw new \Magento\Core\Exception(__('This is an invalid split tenderId ID.')); + throw new \Magento\Model\Exception(__('This is an invalid split tenderId ID.')); } $request = $this->_getRequest(); @@ -672,7 +672,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $this->setPartialAuthorizationLastActionState(self::PARTIAL_AUTH_ALL_CANCELED); return; default: - throw new \Magento\Core\Exception(__('Something went wrong while canceling the payment.')); + throw new \Magento\Model\Exception(__('Something went wrong while canceling the payment.')); } } @@ -683,7 +683,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param string $requestType * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _place($payment, $amount, $requestType) { @@ -762,12 +762,12 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc return $this; } } - throw new \Magento\Core\Exception($defaultExceptionMessage); + throw new \Magento\Model\Exception($defaultExceptionMessage); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception($defaultExceptionMessage); + throw new \Magento\Model\Exception($defaultExceptionMessage); } return $this; } @@ -780,7 +780,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param string $requestType * @return $this * @throws \Magento\Payment\Model\Info\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _partialAuthorization($payment, $amount, $requestType) { @@ -811,7 +811,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount = $amount - $this->getCardsStorage()->getProcessedAmount(); if ($amount <= 0) { - throw new \Magento\Core\Exception(__('This is an invalid amount for partial authorization.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for partial authorization.')); } $payment->setAmount($amount); $request = $this->_buildRequest($payment); @@ -879,7 +879,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param float $requestedAmount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _preauthorizeCapture($payment, $requestedAmount) { @@ -889,7 +889,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $cardsStorage->getProcessedAmount() - $cardsStorage->getCapturedAmount() ) < $requestedAmount ) { - throw new \Magento\Core\Exception(__('This is an invalid amount for capture.')); + throw new \Magento\Model\Exception(__('This is an invalid amount for capture.')); } $messages = array(); @@ -933,7 +933,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _preauthorizeCaptureCardTransaction($payment, $amount, $card) { @@ -988,7 +988,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -997,7 +997,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param \Magento\Payment\Model\Info $payment * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _voidCardTransaction($payment, $card) { @@ -1080,7 +1080,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc false, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -1102,7 +1102,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param float $amount * @param \Magento\Object $card * @return \Magento\Sales\Model\Order\Payment\Transaction - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _refundCardTransaction($payment, $amount, $card) { @@ -1173,7 +1173,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $amount, $exceptionMessage ); - throw new \Magento\Core\Exception($exceptionMessage); + throw new \Magento\Model\Exception($exceptionMessage); } /** @@ -1515,7 +1515,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Authorizenet\Model\Authorizenet\Request $request * @return \Magento\Authorizenet\Model\Authorizenet\Result - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _postRequest(\Magento\Object $request) { @@ -1549,7 +1549,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $debugData['result'] = $result->getData(); $this->_debug($debugData); - throw new \Magento\Core\Exception($this->_wrapGatewayError($e->getMessage())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($e->getMessage())); } $responseBody = $response->getBody(); @@ -1601,7 +1601,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $r[54] ); } else { - throw new \Magento\Core\Exception(__('Something went wrong in the payment gateway.')); + throw new \Magento\Model\Exception(__('Something went wrong in the payment gateway.')); } $debugData['result'] = $result->getData(); @@ -1768,7 +1768,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * @param string $messages * @param bool $isSuccessfulTransactions * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processFailureMultitransactionAction($payment, $messages, $isSuccessfulTransactions) { @@ -1792,7 +1792,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc } $copyOrder->save(); } - throw new \Magento\Core\Exception($this->_authorizenetData->convertMessagesToMessage($messages)); + throw new \Magento\Model\Exception($this->_authorizenetData->convertMessagesToMessage($messages)); } /** @@ -1817,7 +1817,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc * * @param string $transactionId * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @link http://www.authorize.net/support/ReportingGuide_XML.pdf * @link http://developer.authorize.net/api/transaction_details/ */ @@ -1852,7 +1852,7 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $responseXmlDocument = new \Magento\Simplexml\Element($responseBody); libxml_use_internal_errors(false); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Payment updating error.')); + throw new \Magento\Model\Exception(__('Payment updating error.')); } $response = new \Magento\Object(); diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php index 641942d492cf8651fc715d2943f982f89dc97a01..965176635c0438dfe8056005f0653a00cdc7773d 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet/Debug.php @@ -43,7 +43,7 @@ namespace Magento\Authorizenet\Model\Authorizenet; * * @author Magento Core Team <core@magentocommerce.com> */ -class Debug extends \Magento\Core\Model\AbstractModel +class Debug extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index b30ed1edd003311c055bad63a5f759490bcba9ba..fb2ced68a254f624ac951bf1e8f8420cadd5afff 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -188,12 +188,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('Invalid amount for capture.')); + throw new \Magento\Model\Exception(__('Invalid amount for capture.')); } $payment->setAmount($amount); @@ -224,12 +224,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment capturing error.')); + throw new \Magento\Model\Exception(__('Payment capturing error.')); } } @@ -259,12 +259,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param \Magento\Object $payment * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { if (!$payment->getParentTransactionId()) { - throw new \Magento\Core\Exception(__('Invalid transaction ID.')); + throw new \Magento\Model\Exception(__('Invalid transaction ID.')); } $payment->setAnetTransType(self::REQUEST_TYPE_VOID); @@ -289,12 +289,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment voiding error.')); + throw new \Magento\Model\Exception(__('Payment voiding error.')); } } @@ -349,16 +349,16 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _refund(\Magento\Object $payment, $amount) { if ($amount <= 0) { - throw new \Magento\Core\Exception(__('Invalid amount for refund.')); + throw new \Magento\Model\Exception(__('Invalid amount for refund.')); } if (!$payment->getParentTransactionId()) { - throw new \Magento\Core\Exception(__('Invalid transaction ID.')); + throw new \Magento\Model\Exception(__('Invalid transaction ID.')); } $payment->setAnetTransType(self::REQUEST_TYPE_CREDIT); @@ -385,12 +385,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet ); return $this; } - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception($this->_wrapGatewayError($result->getResponseReasonText())); + throw new \Magento\Model\Exception($this->_wrapGatewayError($result->getResponseReasonText())); default: - throw new \Magento\Core\Exception(__('Payment refunding error.')); + throw new \Magento\Model\Exception(__('Payment refunding error.')); } } @@ -495,7 +495,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Validate response data. Needed in controllers. * * @return bool true in case of validation success. - * @throws \Magento\Core\Exception In case of validation error + * @throws \Magento\Model\Exception In case of validation error */ public function validateResponse() { @@ -510,7 +510,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet $this->getConfigData('login') ) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction was declined because the response hash validation failed.') ); } @@ -522,7 +522,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param array $responseData data from Authorize.net from $_POST * @return void - * @throws \Magento\Core\Exception In case of validation error or order creation error + * @throws \Magento\Model\Exception In case of validation error or order creation error */ public function process(array $responseData) { @@ -546,7 +546,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet //check payment method $payment = $order->getPayment(); if (!$payment || $payment->getMethod() != $this->getCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This payment didn\'t work out because we can\'t find this order.') ); } @@ -561,7 +561,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet } if ($isError) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $responseText && !$response->isApproved() ? $responseText : __( 'This payment didn\'t work out because we can\'t find this order.' ) @@ -602,7 +602,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Check response code came from Authorize.net. * * @return true in case of Approved response - * @throws \Magento\Core\Exception In case of Declined or Error response from Authorize.net + * @throws \Magento\Model\Exception In case of Declined or Error response from Authorize.net */ public function checkResponseCode() { @@ -611,11 +611,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet return true; case self::RESPONSE_CODE_DECLINED: case self::RESPONSE_CODE_ERROR: - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $this->_wrapGatewayError($this->getResponse()->getXResponseReasonText()) ); default: - throw new \Magento\Core\Exception(__('There was a payment authorization error.')); + throw new \Magento\Model\Exception(__('There was a payment authorization error.')); } } @@ -623,12 +623,12 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * Check transaction id came from Authorize.net * * @return true in case of right transaction id - * @throws \Magento\Core\Exception In case of bad transaction id. + * @throws \Magento\Model\Exception In case of bad transaction id. */ public function checkTransId() { if (!$this->getResponse()->getXTransId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This payment was not authorized because the transaction ID field is empty.') ); } @@ -652,7 +652,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet * * @param \Magento\Sales\Model\Order $order * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ protected function _authOrder(\Magento\Sales\Model\Order $order) @@ -697,7 +697,7 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet 'Something went wrong: the paid amount doesn\'t match the order amount. Please correct this and try again.' ); $this->_declineOrder($order, $message, true); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } //capture order using AIM if needed diff --git a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php index 645462d2ec810eedc4027783104a4fcfc39e7b61..7dffdead4a0ae9a0997ba49233c9cdbc8c2afc61 100644 --- a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug.php @@ -30,7 +30,7 @@ namespace Magento\Authorizenet\Model\Resource\Authorizenet; * * @author Magento Core Team <core@magentocommerce.com> */ -class Debug extends \Magento\Core\Model\Resource\Db\AbstractDb +class Debug extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php index b3d2e42d38316b67f85b0f3db7ee3ef90b262479..4949b62de7251c7ad3b6bd437f3344ccf3bbb387 100644 --- a/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php +++ b/app/code/Magento/Authorizenet/Model/Resource/Authorizenet/Debug/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Authorizenet\Model\Resource\Authorizenet\Debug; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Backend/App/Router/NoRouteHandler.php b/app/code/Magento/Backend/App/Router/NoRouteHandler.php index 7766ee870bda2d2baa83622ee6499581dcbc7742..026c5095de1b9a94d87e74f479d91a4b8f42d004 100644 --- a/app/code/Magento/Backend/App/Router/NoRouteHandler.php +++ b/app/code/Magento/Backend/App/Router/NoRouteHandler.php @@ -32,12 +32,21 @@ class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface */ protected $_helper; + /** + * @var \Magento\App\Route\ConfigInterface + */ + protected $_routeConfig; + /** * @param \Magento\Backend\Helper\Data $helper + * @param \Magento\App\Route\ConfigInterface $routeConfig */ - public function __construct(\Magento\Backend\Helper\Data $helper) - { + public function __construct( + \Magento\Backend\Helper\Data $helper, + \Magento\App\Route\ConfigInterface $routeConfig + ) { $this->_helper = $helper; + $this->_routeConfig = $routeConfig; } /** @@ -53,7 +62,7 @@ class NoRouteHandler implements \Magento\App\Router\NoRouteHandlerInterface if ($areaFrontName == $this->_helper->getAreaFrontName()) { - $moduleName = 'admin'; + $moduleName = $this->_routeConfig->getRouteFrontName('adminhtml'); $controllerName = 'noroute'; $actionName = 'index'; diff --git a/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php b/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php index 407bf6d49b0956670e11d52a409497de5a537ad3..9d30968ee929caf12560078038057339a524fa87 100644 --- a/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php +++ b/app/code/Magento/Backend/Block/Cache/Grid/Column/Statuses.php @@ -60,7 +60,7 @@ class Statuses extends \Magento\Backend\Block\Widget\Grid\Column * Decorate status column values * * @param string $value - * @param \Magento\Core\Model\AbstractModel $row + * @param \Magento\Model\AbstractModel $row * @param \Magento\Backend\Block\Widget\Grid\Column $column * @param bool $isExport * @return string diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index 12b81953233f63658ce8a032227a78d0e4f23f32..235f2f10913c8b5e0a97624de7db995a73970192 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -56,7 +56,7 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\AuthorizationInterface $authorization - * @param array $data + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -78,8 +78,8 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\AuthorizationInterface $authorization, - array $data = array() + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\AuthorizationInterface $authorization ) { $this->_authorization = $authorization; parent::__construct( @@ -100,7 +100,7 @@ class Context extends \Magento\View\Element\Context $escaper, $filterManager, $localeDate, - $data + $inlineTranslation ); } diff --git a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php index 07e3bfb6b8827ff2c685061a92fe765cead8404d..6acb8b651f49e771d9aeddc18fb96a5a7c758338 100644 --- a/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Block/Dashboard/AbstractDashboard.php @@ -25,7 +25,7 @@ */ namespace Magento\Backend\Block\Dashboard; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Adminhtml dashboard tab abstract diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index 824c74526e6f29f5a18108d399b1ccd0fdded8f5..7939d9d275b3e5f924aaacb8d947292424e43d1e 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -72,6 +72,7 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool @@ -82,7 +83,6 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\Math\Random $mathRandom * @param \Magento\Data\Form\FormKey $formKey * @param \Magento\Code\NameBuilder $nameBuilder - * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -104,6 +104,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, @@ -113,8 +114,7 @@ class Context extends \Magento\View\Element\Template\Context \Magento\Backend\Model\Session $backendSession, \Magento\Math\Random $mathRandom, \Magento\Data\Form\FormKey $formKey, - \Magento\Code\NameBuilder $nameBuilder, - array $data = array() + \Magento\Code\NameBuilder $nameBuilder ) { $this->_authorization = $authorization; $this->_backendSession = $backendSession; @@ -139,12 +139,12 @@ class Context extends \Magento\View\Element\Template\Context $escaper, $filterManager, $localeDate, + $inlineTranslation, $filesystem, $viewFileSystem, $enginePool, $appState, - $storeManager, - $data + $storeManager ); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid.php b/app/code/Magento/Backend/Block/Widget/Grid.php index c2cf8bce35e33339c2793399b65abf87c86e8df5..d23b146915d4382e91877a8fe19a432acc634391 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid.php +++ b/app/code/Magento/Backend/Block/Widget/Grid.php @@ -245,13 +245,13 @@ class Grid extends \Magento\Backend\Block\Widget /** * Retrieve export block * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\View\Element\AbstractBlock|bool */ public function getExportBlock() { if (!$this->getChildBlock('grid.export')) { - throw new \Magento\Core\Exception('Export block for grid ' . $this->getNameInLayout() . ' is not defined'); + throw new \Magento\Model\Exception('Export block for grid ' . $this->getNameInLayout() . ' is not defined'); } return $this->getChildBlock('grid.export'); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php index b2fa1353ce779fe8ac0bd8cd3f518d02876a41bb..b2d8658a06f10411488a2b33d6a2353850fed69c 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/AbstractFilter.php @@ -40,18 +40,18 @@ class AbstractFilter extends \Magento\Backend\Block\AbstractBlock implements protected $_column; /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, array $data = array() ) { $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php index a93ac0132f5f21839b0f5ac31460af95d159b34e..2739e7a7ba6dbdbecec0e54b28f22c021aff6ee2 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Country.php @@ -37,13 +37,13 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $directoriesFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Directory\Model\Resource\Country\CollectionFactory $directoriesFactory, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php index 3acc79c32e087e697f8f5c49e3a06b9948281523..b11bf3d249647ad83bf76c0eed8e8f47e9988d7e 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Date.php @@ -42,14 +42,14 @@ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilt /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Math\Random $mathRandom * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Math\Random $mathRandom, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php index d4ec0f7e044f525ca4b652d5b3be4ba0438c6697..0c7f01f53400ca550980e70c4f8205de630a2d5e 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Price.php @@ -53,14 +53,14 @@ class Price extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Directory\Model\Currency $currencyModel * @param \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Directory\Model\Currency $currencyModel, \Magento\Directory\Model\Currency\DefaultLocator $currencyLocator, array $data = array() diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php index ba211f859922da8a0c435bd6e572a167fa94108e..522d1ae89bf20945ced6e2386506df702c551aa4 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Store.php @@ -39,13 +39,13 @@ class Store extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Core\Model\System\Store $systemStore * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Core\Model\System\Store $systemStore, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php index da8e274101860f12778e573a551a4dfc7eecd151..63c14b3c391997b26c9c7dbcaa23ede07a70a489 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Theme.php @@ -38,13 +38,13 @@ class Theme extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFil /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\View\Design\Theme\LabelFactory $labelFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\View\Design\Theme\LabelFactory $labelFactory, array $data = array() ) { diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Export.php b/app/code/Magento/Backend/Block/Widget/Grid/Export.php index b2dd9e60ff5e55548040cee01b6ddc79003bc1f2..ce384d8e0a1b7db0699df265ccb7b727e45dbe9b 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Export.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Export.php @@ -84,7 +84,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B /** * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _construct() { @@ -92,7 +92,7 @@ class Export extends \Magento\Backend\Block\Widget implements \Magento\Backend\B if ($this->hasData('exportTypes')) { foreach ($this->getData('exportTypes') as $type) { if (!isset($type['urlPath']) || !isset($type['label'])) { - throw new \Magento\Core\Exception('Invalid export type supplied for grid export block'); + throw new \Magento\Model\Exception('Invalid export type supplied for grid export block'); } $this->addExportType($type['urlPath'], $type['label']); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php index 94ff274c9ee25b9f4494a8b44719d680f45d300b..9797907e323ee8dfac89db545a379c05fb0b9f10 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Item.php @@ -66,7 +66,7 @@ class Item extends \Magento\Backend\Block\Widget * * @param string|\Magento\View\Element\AbstractBlock $block * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalActionBlock($block) { @@ -75,7 +75,7 @@ class Item extends \Magento\Backend\Block\Widget } elseif (is_array($block)) { $block = $this->_createFromConfig($block); } elseif (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception('Unknown block type'); + throw new \Magento\Model\Exception('Unknown block type'); } $this->setChild('additional_action', $block); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php index f2fce8f1bcab3bfe0b7be1427475954538ab392c..f11ef4f885f50d49ed4565b88c1027ce3bcf674d 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Ajax.php @@ -27,6 +27,24 @@ use Magento\Backend\App\Action; class Ajax extends Action { + /** + * @var \Magento\Translate\Inline\ParserInterface + */ + protected $inlineParser; + + /** + * @param Action\Context $context + * @param \Magento\Translate\Inline\ParserInterface $inlineParser + */ + public function __construct( + Action\Context $context, + \Magento\Translate\Inline\ParserInterface $inlineParser + ) { + parent::__construct($context); + + $this->inlineParser = $inlineParser; + } + /** * Ajax action for inline translation * @@ -34,12 +52,16 @@ class Ajax extends Action */ public function translateAction() { - $translationParams = (array)$this->getRequest()->getPost('translate'); - $area = $this->getRequest()->getPost('area'); - /** @var \Magento\Core\Helper\Translate $translationHelper */ - $translationHelper = $this->_objectManager->get('Magento\Core\Helper\Translate'); - $response = $translationHelper->apply($translationParams, $area); + $translate = (array)$this->getRequest()->getPost('translate'); + + try { + $this->inlineParser->processAjaxPost($translate); + $response = "{success:true}"; + } catch (\Exception $e) { + $response = "{error:true,message:'" . $e->getMessage() . "'}"; + } $this->getResponse()->setBody($response); + $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } } diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php index beab3d046dc0266a95de10b534f3c4a150de9a71..9711e112625b5e0ba420541bc630f495ac7de97f 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Cache.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Cache.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Controller\Adminhtml; use Magento\Backend\App\Action; -use Magento\Core\Exception; +use Magento\Model\Exception; class Cache extends Action { diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php index 7f58c26335f0ce32812ef0568bb1ca872415506d..b243b504d747d61acc71a2e70c31a40853ef785c 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Account.php @@ -95,7 +95,7 @@ class Account extends Action $user->save(); $user->sendPasswordResetNotificationEmail(); $this->messageManager->addSuccess(__('The account has been saved.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addMessages($e->getMessages()); } catch (\Exception $e) { $this->messageManager->addError(__('An error occurred while saving account.')); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php index e7f01cc54d48961498506b78d72c6a95e515fc5b..01747e05a59c99bbf98e628a6afd2511bacb91fe 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/Save.php @@ -103,7 +103,7 @@ class Save extends AbstractConfig $configModel->save(); $this->messageManager->addSuccess(__('You saved the configuration.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $messages = explode("\n", $e->getMessage()); foreach ($messages as $message) { $this->messageManager->addError($message); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php index a63deb55c5d16e8346260da083fa5e27977913d9..ae50f92d7144dad859f4dbd56dbf11a89194b58a 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Store.php @@ -291,7 +291,7 @@ class Store extends Action } $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setPostData($postData); } catch (\Exception $e) { @@ -454,7 +454,7 @@ class Store extends Action $this->messageManager->addSuccess(__('The website has been deleted.')); $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete website. Please, try again later.')); @@ -486,8 +486,8 @@ class Store extends Action $model->delete(); $this->messageManager->addSuccess(__('The store has been deleted.')); $this->_redirect('adminhtml/*/'); - return; - } catch (\Magento\Core\Exception $e) { + return ; + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete store. Please, try again later.')); @@ -525,7 +525,7 @@ class Store extends Action $this->messageManager->addSuccess(__('The store view has been deleted.')); $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Unable to delete store view. Please, try again later.')); @@ -571,7 +571,7 @@ class Store extends Action $backupDb->createBackup($backup); $this->messageManager->addSuccess(__('The database was backed up.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect($failPath, $arguments); return; diff --git a/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php index 6299fa82477239a6efd1e40eebc66777f34d6f30..3b9cf64c05bd4059fa671abeb485512afa44d776 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/Urlrewrite.php @@ -28,7 +28,7 @@ namespace Magento\Backend\Controller\Adminhtml; use Magento\Backend\App\Action; use Magento\Catalog\Model\Category; use Magento\Catalog\Model\Product; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Core\Model\Url\Rewrite; /** diff --git a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php index df6c4d3abf47f1944ed0e07a4eaf1f0a3bead11d..09d40d40bed7ea3abb65cf972e1a21e9798b0166 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php +++ b/app/code/Magento/Backend/Helper/Dashboard/AbstractDashboard.php @@ -26,7 +26,7 @@ namespace Magento\Backend\Helper\Dashboard; use Magento\Core\Helper\Data as HelperData; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Adminhtml abstract dashboard helper. diff --git a/app/code/Magento/Backend/Model/Auth.php b/app/code/Magento/Backend/Model/Auth.php index a4bc8ce2be441f8938f61b86f8eafbf525b9b482..7816b3f9a9457a2821ef1ff13006e84b0c52dd11 100644 --- a/app/code/Magento/Backend/Model/Auth.php +++ b/app/code/Magento/Backend/Model/Auth.php @@ -185,7 +185,7 @@ class Auth array('user_name' => $username, 'exception' => $e) ); throw $e; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_eventManager->dispatch( 'backend_auth_user_login_failed', array('user_name' => $username, 'exception' => $e) diff --git a/app/code/Magento/Backend/Model/Auth/Exception.php b/app/code/Magento/Backend/Model/Auth/Exception.php index 82c208d0daaff6d733186f34534f0879c2a73a33..3d854fb1ca620ab1bcc30d4cf1ceec8172f6f427 100644 --- a/app/code/Magento/Backend/Model/Auth/Exception.php +++ b/app/code/Magento/Backend/Model/Auth/Exception.php @@ -32,6 +32,6 @@ namespace Magento\Backend\Model\Auth; * @package Magento_Backend * @author Magento Core Team <core@magentocommerce.com> */ -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Backend/Model/Config.php b/app/code/Magento/Backend/Model/Config.php index 2b73bb3a4ce6ba95615fc9d1e3f3c09a71ad93f4..c9f44d9dccbec293f5b6849997b66aa53e9e70b6 100644 --- a/app/code/Magento/Backend/Model/Config.php +++ b/app/code/Magento/Backend/Model/Config.php @@ -73,7 +73,7 @@ class Config extends \Magento\Object /** * TransactionFactory * - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; @@ -100,7 +100,7 @@ class Config extends \Magento\Object * @param \Magento\App\ConfigInterface $config * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Backend\Model\Config\Structure $configStructure - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param \Magento\Backend\Model\Config\Loader $configLoader * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -110,7 +110,7 @@ class Config extends \Magento\Object \Magento\App\ConfigInterface $config, \Magento\Event\ManagerInterface $eventManager, \Magento\Backend\Model\Config\Structure $configStructure, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, \Magento\Backend\Model\Config\Loader $configLoader, \Magento\Core\Model\Config\ValueFactory $configValueFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -147,9 +147,9 @@ class Config extends \Magento\Object $oldConfig = $this->_getConfig(true); $deleteTransaction = $this->_transactionFactory->create(); - /* @var $deleteTransaction \Magento\Core\Model\Resource\Transaction */ + /* @var $deleteTransaction \Magento\DB\Transaction */ $saveTransaction = $this->_transactionFactory->create(); - /* @var $saveTransaction \Magento\Core\Model\Resource\Transaction */ + /* @var $saveTransaction \Magento\DB\Transaction */ // Extends for old config data $extraOldGroups = array(); @@ -199,8 +199,8 @@ class Config extends \Magento\Object * @param string $sectionPath * @param array &$extraOldGroups * @param array &$oldConfig - * @param \Magento\Core\Model\Resource\Transaction $saveTransaction - * @param \Magento\Core\Model\Resource\Transaction $deleteTransaction + * @param \Magento\DB\Transaction $saveTransaction + * @param \Magento\DB\Transaction $deleteTransaction * @return void */ protected function _processGroup( @@ -210,8 +210,8 @@ class Config extends \Magento\Object $sectionPath, array &$extraOldGroups, array &$oldConfig, - \Magento\Core\Model\Resource\Transaction $saveTransaction, - \Magento\Core\Model\Resource\Transaction $deleteTransaction + \Magento\DB\Transaction $saveTransaction, + \Magento\DB\Transaction $deleteTransaction ) { $groupPath = $sectionPath . '/' . $groupId; $website = $this->getWebsite(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php index 2111d0acdf7a1dda1fa6f4227417c00a510ab58e..6f227aed02e0f2be67fcfded7971b77b16272b95 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php @@ -61,7 +61,7 @@ class Custom extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -71,7 +71,7 @@ class Custom extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php index 987ec37faa718a4b49a601b0d38d20216bc754c3..6e3a3e2e44601cff6761b28679a76900d75e7685 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php @@ -43,7 +43,7 @@ class Custompath extends \Magento\Core\Model\Config\Value protected function _beforeSave() { if ($this->getOldValue() != $this->getValue()) { - $this->_coreRegistry->register('custom_admin_path_redirect', true, true); + $this->_registry->register('custom_admin_path_redirect', true, true); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php index 51210e433cbb153c16a92318b80ce3be588d73c1..39bdd3248e53b95652b8293deb6ca65623bf18d8 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Observer.php @@ -47,9 +47,9 @@ class Observer protected $_authSession; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ResponseInterface */ - protected $_app; + protected $_response; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -60,20 +60,20 @@ class Observer * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Registry $coreRegistry * @param \Magento\Backend\Model\Auth\Session $authSession - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ResponseInterface $response * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\Backend\Helper\Data $backendData, \Magento\Registry $coreRegistry, \Magento\Backend\Model\Auth\Session $authSession, - \Magento\Core\Model\App $app, + \Magento\App\ResponseInterface $response, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_backendData = $backendData; $this->_coreRegistry = $coreRegistry; $this->_authSession = $authSession; - $this->_app = $app; + $this->_response = $response; $this->_storeManager = $storeManager; } @@ -93,9 +93,9 @@ class Observer $route = $this->_backendData->getAreaFrontName(); - $this->_app->getResponse()->setRedirect( - $this->_storeManager->getStore()->getBaseUrl() . $route - )->sendResponse(); + $this->_response + ->setRedirect($this->_storeManager->getStore()->getBaseUrl() . $route) + ->sendResponse(); exit(0); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php index 7d2e550dc3e03e51e8a66413c8cb0b1f43f25277..04bf0c0e0cae7c1f51fadd7b8592d00d21aab9ce 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -47,7 +47,7 @@ class Robots extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Robots extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php index d9649fd4ebb442217f41bdbfb385681a5ca2b251..15dca031687bb0fc95d66484d7cd26bc5f6cbb20 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php @@ -45,7 +45,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Config\Storage\WriterInterface $configWriter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Config\Storage\WriterInterface $configWriter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -67,7 +67,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value * Validate custom url * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -75,7 +75,7 @@ class Usecustom extends \Magento\Core\Model\Config\Value if ($value == 1) { $customUrl = $this->getData('groups/url/fields/custom/value'); if (empty($customUrl)) { - throw new \Magento\Core\Exception(__('Please specify the admin custom URL.')); + throw new \Magento\Model\Exception(__('Please specify the admin custom URL.')); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php index a067e696abd2ffbc47cfa1d7f019116263f7fe2a..5c4274c14d68e8d8c38bf8ba9d7d4e71585789dc 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php @@ -42,7 +42,7 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Backend\Model\UrlInterface $backendUrl - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Usesecretkey extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Backend\Model\UrlInterface $backendUrl, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php index 8ef93b7089693f254534a1285dfe999a0c9db897..972557ece8025a4d6bc0835eb7507cc6f5bcf28e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php @@ -36,7 +36,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -46,7 +46,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -58,7 +58,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * Validate a base URL field value * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -67,11 +67,11 @@ class Baseurl extends \Magento\Core\Model\Config\Value if (!$this->_validateUnsecure($value) && !$this->_validateSecure($value)) { $this->_validateFullyQualifiedUrl($value); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $field = $this->getFieldConfig(); $label = $field && is_array($field) ? $field['label'] : 'value'; $msg = __('Invalid %1. %2', $label, $e->getMessage()); - $error = new \Magento\Core\Exception($msg, 0, $e); + $error = new \Magento\Model\Exception($msg, 0, $e); throw $error; } } @@ -138,12 +138,12 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertValuesOrUrl(array $values, $value) { if (!in_array($value, $values) && !$this->_isFullyQualifiedUrl($value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Value must be a URL or one of placeholders: %1', implode(',', $values)) ); } @@ -155,14 +155,14 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertStartsWithValuesOrUrl(array $values, $value) { $quoted = array_map('preg_quote', $values, array_fill(0, count($values), '/')); if (!preg_match('/^(' . implode('|', $quoted) . ')(.+\/)?$/', $value) && !$this->_isFullyQualifiedUrl($value) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Specify a URL or path that starts with placeholder(s): %1, and ends with "/".', implode(', ', $values) @@ -177,7 +177,7 @@ class Baseurl extends \Magento\Core\Model\Config\Value * @param array $values * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _assertStartsWithValuesOrUrlOrEmpty(array $values, $value) { @@ -186,9 +186,9 @@ class Baseurl extends \Magento\Core\Model\Config\Value } try { $this->_assertStartsWithValuesOrUrl($values, $value); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $msg = __('%1 An empty value is allowed as well.', $e->getMessage()); - $error = new \Magento\Core\Exception($msg, 0, $e); + $error = new \Magento\Model\Exception($msg, 0, $e); throw $error; } } @@ -198,12 +198,12 @@ class Baseurl extends \Magento\Core\Model\Config\Value * * @param string $value * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _validateFullyQualifiedUrl($value) { if (!$this->_isFullyQualifiedUrl($value)) { - throw new \Magento\Core\Exception(__('Specify a fully qualified URL.')); + throw new \Magento\Model\Exception(__('Specify a fully qualified URL.')); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php index 4031c6c4ac8c4a4204988ff75d285508662ed447..059904ef3c3c8f4572ce9a0f720f2ef624047aa9 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/AbstractCurrency.php @@ -53,7 +53,7 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -63,7 +63,7 @@ abstract class AbstractCurrency extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php index ee85bbe14467aa831018f4e9e0da81eb3d96db1c..2154477dad9b53032a26ede917633cde420e485a 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php @@ -44,7 +44,7 @@ class Allow extends AbstractCurrency * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Allow extends AbstractCurrency \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -77,7 +77,7 @@ class Allow extends AbstractCurrency * Check allowed currencies is available in installed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -99,7 +99,7 @@ class Allow extends AbstractCurrency } if ($exceptions) { - throw new \Magento\Core\Exception(join("\n", $exceptions)); + throw new \Magento\Model\Exception(join("\n", $exceptions)); } return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php index 06d08f84dd6f168f67e57642e217f79340083d7d..8776f5eeb83c0487f80c16c2da2ca721cf6040e2 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php @@ -36,12 +36,12 @@ class Base extends AbstractCurrency * Check base currency is available in installed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Core\Exception(__('Sorry, we haven\'t installed the base currency you selected.')); + throw new \Magento\Model\Exception(__('Sorry, we haven\'t installed the base currency you selected.')); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php index aebb63e6e4c31bc10c1475c3b0be0d3e71aac1f9..d564eef8ae76afa6cde183f47e8c28852333b7d1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php @@ -44,7 +44,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -54,7 +54,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php index 1822c25933f9ceb7f24276c4f29a9ca8819483ff..95dd5c3304b81877d942078627c9a835ee4bd86e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php @@ -37,18 +37,18 @@ class DefaultCurrency extends AbstractCurrency * Check default currency is available in allowed currencies * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, we haven\'t installed the default display currency you selected.') ); } if (!in_array($this->getValue(), $this->_getAllowedCurrencies())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, the default display currency you selected in not available in allowed currencies.') ); } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php index 40de02605ace15795cdbaebc76404b1e0461332f..eb67af0d76aefb39916f7be7a289177e9ecc7ccc 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Email; -use Magento\Core\Exception; +use Magento\Model\Exception; class Address extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php index a9643614b9c312c659f56fa58c5db3f05968b4b4..4fa9d9e57aaf1308ee571f9b94d8a246e3cebad1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php @@ -35,19 +35,19 @@ class Sender extends \Magento\Core\Model\Config\Value * Check sender name validity * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { $value = $this->getValue(); if (!preg_match("/^[\S ]+$/", $value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The sender name "%1" is not valid. Please use only visible characters and spaces.', $value) ); } if (strlen($value) > 255) { - throw new \Magento\Core\Exception(__('Maximum sender name length is 255. Please correct your settings.')); + throw new \Magento\Model\Exception(__('Maximum sender name length is 255. Please correct your settings.')); } return $this; } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index f1a927c37d5e40007b07c9b54219b292186369c5..d418f55fb6512942640225a555064d2845a40f36 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -40,7 +40,7 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Encrypted extends \Magento\Core\Model\Config\Value implements \Magento\App \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index 343960f2386256e0875a60a4e108cde7050e9143..b89281cc29bba62d0e2f3a646d489a36f04c44dd 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -67,7 +67,7 @@ class File extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\File\UploaderFactory $uploaderFactory * @param \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -79,7 +79,7 @@ class File extends \Magento\Core\Model\Config\Value \Magento\Core\Model\File\UploaderFactory $uploaderFactory, \Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface $requestData, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -94,7 +94,7 @@ class File extends \Magento\Core\Model\Config\Value * Save uploaded file before saving config value * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -117,7 +117,7 @@ class File extends \Magento\Core\Model\Config\Value $uploader->addValidateCallback('size', $this, 'validateMaxSize'); $result = $uploader->save($uploadDir); } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } $filename = $result['file']; @@ -143,7 +143,7 @@ class File extends \Magento\Core\Model\Config\Value * * @param string $filePath Path to temporary uploaded file * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateMaxSize($filePath) { @@ -152,7 +152,7 @@ class File extends \Magento\Core\Model\Config\Value $directory->getRelativePath($filePath) )['size'] > $this->_maxFileSize * 1024 ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The file you\'re uploading exceeds the server size limit of %1 kilobytes.', $this->_maxFileSize) ); } @@ -174,7 +174,7 @@ class File extends \Magento\Core\Model\Config\Value * Return path to directory for upload file * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getUploadDir() { @@ -182,7 +182,7 @@ class File extends \Magento\Core\Model\Config\Value /* @var $fieldConfig \Magento\Simplexml\Element */ if (!array_key_exists('upload_dir', $fieldConfig)) { - throw new \Magento\Core\Exception(__('The base directory to upload file is not specified.')); + throw new \Magento\Model\Exception(__('The base directory to upload file is not specified.')); } if (is_array($fieldConfig['upload_dir'])) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php index a9fc8488f21b06480418c5991f4866165db0d33c..fbbbf9c28dafeea86bb05c81274ea0496cc778de 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php @@ -47,7 +47,7 @@ class Adapter extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Image\AdapterFactory $imageFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Adapter extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Image\AdapterFactory $imageFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -68,7 +68,7 @@ class Adapter extends \Magento\Core\Model\Config\Value /** * Checks if chosen image adapter available * - * @throws \Magento\Core\Exception If some of adapter dependencies was not loaded + * @throws \Magento\Model\Exception If some of adapter dependencies was not loaded * @return \Magento\Backend\Model\Config\Backend\File */ protected function _beforeSave() @@ -77,7 +77,7 @@ class Adapter extends \Magento\Core\Model\Config\Value $this->_imageFactory->create($this->getValue()); } catch (\Exception $e) { $message = __('The specified image adapter cannot be used because of: ' . $e->getMessage()); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php index 7ba10cef12b183a7e4390c807497091594d71b9f..647a96dda7d3e4006a625a95c663a56e1219b970 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Favicon.php @@ -41,7 +41,7 @@ class Favicon extends \Magento\Backend\Model\Config\Backend\Image * Return path to directory for upload file * * @return string - * @throw \Magento\Core\Exception + * @throw \Magento\Model\Exception */ protected function _getUploadDir() { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php index 537981da703b163e02b91e40f92de6065c3d644d..7622de5e097d1d78af148680afd5537b27bb86ff 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Logo.php @@ -41,7 +41,7 @@ class Logo extends \Magento\Backend\Model\Config\Backend\Image * Return path to directory for upload file * * @return string - * @throw \Magento\Core\Exception + * @throw \Magento\Model\Exception */ protected function _getUploadDir() { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale.php b/app/code/Magento/Backend/Model/Config/Backend/Locale.php index 9b51050c250e90835bcb603fb68cd3dfb8a09ea3..14d3714fa52e1df2207544b2b6521eaae59a210c 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale.php @@ -60,7 +60,7 @@ class Locale extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\Website\Factory $websiteFactory * @param \Magento\Core\Model\StoreFactory $storeFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -75,7 +75,7 @@ class Locale extends \Magento\Core\Model\Config\Value \Magento\Core\Model\Website\Factory $websiteFactory, \Magento\Core\Model\StoreFactory $storeFactory, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -88,7 +88,7 @@ class Locale extends \Magento\Core\Model\Config\Value /** * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -137,7 +137,7 @@ class Locale extends \Magento\Core\Model\Config\Value } } if ($exceptions) { - throw new \Magento\Core\Exception(join("\n", $exceptions)); + throw new \Magento\Model\Exception(join("\n", $exceptions)); } return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php index d597f97925dd3afd570bd944f3b7cbcfb73ca3c9..144a11eee4185399f7e5952b055d4cbe7cea448c 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php @@ -29,7 +29,7 @@ */ namespace Magento\Backend\Model\Config\Backend\Locale; -use Magento\Core\Exception; +use Magento\Model\Exception; class Timezone extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php index d2852cb7eacca7192a6d19f032101274a29d66d6..a4a0a725b3b185b9ae94e0c5ac646e59dceaee5b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php @@ -51,7 +51,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -62,7 +62,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() @@ -76,7 +76,7 @@ class Cron extends \Magento\Core\Model\Config\Value * Cron settings after save * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -111,7 +111,7 @@ class Cron extends \Magento\Core\Model\Config\Value $configValue->load(self::CRON_MODEL_PATH, 'path'); $configValue->setValue($this->_runModelPath)->setPath(self::CRON_MODEL_PATH)->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t save the Cron expression.')); + throw new \Magento\Model\Exception(__('We can\'t save the Cron expression.')); } } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Secure.php b/app/code/Magento/Backend/Model/Config/Backend/Secure.php index 381035a2b3b64ab92263f4c522ccda7344c13515..91742ff6a4b76fd97ddb1d63de313cbae5eefea8 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Secure.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Secure.php @@ -36,7 +36,7 @@ class Secure extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\Asset\MergeService $mergeService - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -46,7 +46,7 @@ class Secure extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\Asset\MergeService $mergeService, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php index ff7fdadb17b4f69eeb01e2b284597255d2f63be5..b4dbe01c9b22e13157d7c3faeb5e844bd5512c48 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php @@ -40,7 +40,7 @@ class Database extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\File\Storage $coreFileStorage - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Database extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\File\Storage $coreFileStorage, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Translate.php b/app/code/Magento/Backend/Model/Config/Backend/Translate.php index 9eb8cb2a180a426eb4c63c88887537a906987c24..46fa8c0a74ef74c582164364d3178bd65fd16f2f 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Translate.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Translate.php @@ -59,7 +59,7 @@ class Translate extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Translate extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php index 98b1a95cc07a33e0e2769a83d78d9cc9c7aa3493..f6832e85d8759306aa29e4bc1cc5558bfe03e990 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Group.php @@ -70,13 +70,13 @@ class Group extends AbstractComposite /** * Retrieve clone model * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ public function getCloneModel() { if (!isset($this->_data['clone_model']) || !$this->_data['clone_model']) { - throw new \Magento\Core\Exception('Config form fieldset clone model required to be able to clone fields'); + throw new \Magento\Model\Exception('Config form fieldset clone model required to be able to clone fields'); } return $this->_cloneModelFactory->create($this->_data['clone_model']); } diff --git a/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php b/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php index 80d75266460be90a9027dad8f671c765c6a61a51..51d5d9af5ea1f8e56d30a0797b09d80e3af8943a 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Element/Group/Proxy.php @@ -187,7 +187,7 @@ class Proxy extends \Magento\Backend\Model\Config\Structure\Element\Group /** * Retrieve clone model * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getCloneModel() { diff --git a/app/code/Magento/Backend/Model/Locale/Manager.php b/app/code/Magento/Backend/Model/Locale/Manager.php index fe9d0ecc995972288af19449c8a7de311ee34323..7483b085a0e5ed1f63d5fa216bf6b87960022b40 100644 --- a/app/code/Magento/Backend/Model/Locale/Manager.php +++ b/app/code/Magento/Backend/Model/Locale/Manager.php @@ -78,7 +78,7 @@ class Manager $this->_authSession->getUser()->setInterfaceLocale($localeCode); - $this->_translator->setLocale($localeCode)->init(null, true); + $this->_translator->setLocale($localeCode)->loadData(null, true); return $this; } diff --git a/app/code/Magento/Backend/Model/Locale/Resolver.php b/app/code/Magento/Backend/Model/Locale/Resolver.php index 958b7d16a3fd005c5c966fb7f2b545c9179886bc..31f6a1a19de5dd3fa13548f2acd7b8653020b0a5 100644 --- a/app/code/Magento/Backend/Model/Locale/Resolver.php +++ b/app/code/Magento/Backend/Model/Locale/Resolver.php @@ -52,7 +52,7 @@ class Resolver extends \Magento\Locale\Resolver /** * @param \Magento\Locale\ScopeConfigInterface $scopeConfig - * @param \Magento\AppInterface $app + * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath * @param \Magento\ObjectManager $objectManager @@ -60,11 +60,11 @@ class Resolver extends \Magento\Locale\Resolver * @param Manager $localeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Locale\Validator $localeValidator - * @param string|null $locale + * @param null $locale */ public function __construct( \Magento\Locale\ScopeConfigInterface $scopeConfig, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, \Magento\ObjectManager $objectManager, @@ -78,7 +78,7 @@ class Resolver extends \Magento\Locale\Resolver $this->_localeManager = $localeManager; $this->_request = $request; $this->_localeValidator = $localeValidator; - parent::__construct($scopeConfig, $app, $localeFactory, $defaultLocalePath, $locale); + parent::__construct($scopeConfig, $cache, $localeFactory, $defaultLocalePath, $locale); } /** diff --git a/app/code/Magento/Backend/Model/Observer.php b/app/code/Magento/Backend/Model/Observer.php index 65c34dcf3551c932b3bf13ac316c38aaaf7ab3d6..652bdf5e2b84d97ae0b79e948050867cecb4a715 100644 --- a/app/code/Magento/Backend/Model/Observer.php +++ b/app/code/Magento/Backend/Model/Observer.php @@ -36,9 +36,9 @@ class Observer protected $_backendSession; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $cache; /** * @var \Magento\App\RequestInterface @@ -46,17 +46,17 @@ class Observer protected $_request; /** - * @param \Magento\Backend\Model\Session $backendSession - * @param \Magento\Core\Model\App $app + * @param Session $backendSession + * @param \Magento\App\CacheInterface $cache * @param \Magento\App\RequestInterface $request */ public function __construct( \Magento\Backend\Model\Session $backendSession, - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\App\RequestInterface $request ) { $this->_backendSession = $backendSession; - $this->_app = $app; + $this->cache = $cache; $this->_request = $request; } @@ -88,16 +88,6 @@ class Observer return $this; } - /** - * Backend will always use base class for translation. - * - * @return $this - */ - public function initializeTranslation() - { - return $this; - } - /** * Set url class name for store 'admin' * @@ -115,7 +105,7 @@ class Observer break; } } - $this->_app->removeCache( + $this->cache->remove( \Magento\AdminNotification\Model\System\Message\Security::VERIFICATION_RESULT_CACHE_KEY ); return $this; diff --git a/app/code/Magento/Backend/Model/Translate.php b/app/code/Magento/Backend/Model/Translate.php deleted file mode 100644 index 54ab6a1e87ced27966cb934dd3ad239fa46a6c06..0000000000000000000000000000000000000000 --- a/app/code/Magento/Backend/Model/Translate.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Backend - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model; - -class Translate extends \Magento\Translate implements \Magento\TranslateInterface -{ - /** - * {@inheritdoc} - */ - public function init($area = null, $initParams = null, $forceReload = false) - { - parent::init($area, $initParams, $forceReload); - $scope = null; - if ($this->getConfig(self::CONFIG_KEY_AREA) == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { - $scope = 'admin'; - } - $this->_translateInline = $this->getInlineObject($initParams)->isAllowed($scope); - return $this; - } -} diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index a1709086643c906a2baa92ea1f2e5cf5f5e13878..26fa44a8f6fd9bce9c8311957496fa16ba42e6f9 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -219,8 +219,8 @@ class Url extends \Magento\Url implements \Magento\Backend\Model\UrlInterface return $result; } $routeName = $this->_getRouteName('*'); - $controllerName = $this->_getControllerName($this->_getDefaultControllerName()); - $actionName = $this->_getActionName($this->_getDefaultActionName()); + $controllerName = $this->_getControllerName(self::DEFAULT_CONTROLLER_NAME); + $actionName = $this->_getActionName(self::DEFAULT_ACTION_NAME); if ($cacheSecretKey) { $secret = array(self::SECRET_KEY_PARAM_NAME => "\${$routeName}/{$controllerName}/{$actionName}\$"); } else { diff --git a/app/code/Magento/Backend/etc/adminhtml/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 5020afe02eab1d3c9cae87a40fa8d925ba5ad0bb..97a4d138a58d94fb5b77725ce5ae566c5897af5d 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -33,18 +33,9 @@ <preference for="Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface" type="Magento\Backend\Model\Config\Backend\File\RequestData" /> <preference for="Magento\App\DefaultPathInterface" type="Magento\Backend\App\DefaultPath" /> <preference for="Magento\Backend\App\ConfigInterface" type="Magento\Backend\App\Config" /> - <preference for="Magento\Translate\Inline\ConfigFactory" type="Magento\Backend\Model\Translate\Inline\ConfigFactory" /> - <preference for="Magento\Translate\InlineInterface" type="Magento\Backend\Model\Translate\Inline" /> - <preference for="Magento\Core\Model\Resource\Translate\String" type="Magento\Backend\Model\Resource\Translate\String" /> - <preference for="Magento\Core\Model\Resource\Translate" type="Magento\Backend\Model\Resource\Translate" /> <preference for="Magento\App\Response\Http\FileFactory" type="Magento\Backend\App\Response\Http\FileFactory" /> <preference for="Magento\App\View" type="Magento\Backend\Model\View" /> - <type name="Magento\Backend\Model\Translate\Inline"> - <arguments> - <argument name="url" xsi:type="object">Magento\Backend\Model\UrlInterface</argument> - <argument name="templateFileName" xsi:type="string">Magento_Core::translate_inline.phtml</argument> - </arguments> - </type> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Backend\App\Action\Context"> <arguments> <argument name="helper" xsi:type="object">Magento\Backend\Helper\Data</argument> diff --git a/app/code/Magento/Backend/etc/adminhtml/events.xml b/app/code/Magento/Backend/etc/adminhtml/events.xml index a1cd9739d70692cbbec4f9139359eb2ab304a425..40b0a29b74ba7a34e8ae03d68033f5d626512f15 100644 --- a/app/code/Magento/Backend/etc/adminhtml/events.xml +++ b/app/code/Magento/Backend/etc/adminhtml/events.xml @@ -24,9 +24,6 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="translate_initialization_before"> - <observer name="initialize_translation" instance="Magento\Backend\Model\Observer" method="initializeTranslation" /> - </event> <event name="admin_system_config_changed_section_admin"> <observer name="bind_locale" instance="Magento\Backend\Model\Config\Backend\Admin\Observer" method="afterCustomUrlChanged" /> </event> diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index ff850688e90ff7ce94d7c372d73e559e01c2e486..504cd16521331f0804b32c775289f3e53eafcd14 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -509,7 +509,7 @@ </field> </group> <group id="seo" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1"> - <label>Search Engines Optimization</label> + <label>Search Engine Optimization</label> <field id="use_rewrites" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Use Web Server Rewrites</label> <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model> diff --git a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml index d5348c5e73ce6cd8fd8d5686be6767fe2677b97b..463dfe4454896e17b13098dbf4d5716561cfbcfc 100644 --- a/app/code/Magento/Backend/view/adminhtml/page/footer.phtml +++ b/app/code/Magento/Backend/view/adminhtml/page/footer.phtml @@ -25,4 +25,4 @@ */ ?> <?php echo $this->getChildHtml('copyright');?> / -<?php echo __('Magento ver. %1', \Magento\Core\Model\App::VERSION) ?> +<?php echo __('Magento ver. %1', \Magento\AppInterface::VERSION) ?> diff --git a/app/code/Magento/Backup/Model/Backup.php b/app/code/Magento/Backup/Model/Backup.php index a0361266539666f562781e04cda221ce980f06ef..73fe25448847a04c7dd4421a6939c57ba9d04dca 100644 --- a/app/code/Magento/Backup/Model/Backup.php +++ b/app/code/Magento/Backup/Model/Backup.php @@ -241,12 +241,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * * @param string &$content * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setFile(&$content) { if (!$this->hasData('time') || !$this->hasData('type') || !$this->hasData('path')) { - throw new \Magento\Core\Exception(__('Please correct the order of creation for a new backup.')); + throw new \Magento\Model\Exception(__('Please correct the order of creation for a new backup.')); } $this->varDirectory->writeFile($this->_getFilePath(), $content); @@ -257,12 +257,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * Return content of backup file * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function &getFile() { if (!$this->exists()) { - throw new \Magento\Core\Exception(__("The backup file does not exist.")); + throw new \Magento\Model\Exception(__("The backup file does not exist.")); } return $this->varDirectory->read($this->_getFilePath()); @@ -272,12 +272,12 @@ class Backup extends \Magento\Object implements \Magento\Backup\Db\BackupInterfa * Delete backup file * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteFile() { if (!$this->exists()) { - throw new \Magento\Core\Exception(__("The backup file does not exist.")); + throw new \Magento\Model\Exception(__("The backup file does not exist.")); } $this->varDirectory->delete($this->_getFilePath()); diff --git a/app/code/Magento/Backup/Model/Config/Backend/Cron.php b/app/code/Magento/Backup/Model/Config/Backend/Cron.php index 5d5470c055b973a7b9fcd2994e9343ccb70a40f8..091966d59b3f0411a5fba455628718de991a71ce 100644 --- a/app/code/Magento/Backup/Model/Config/Backend/Cron.php +++ b/app/code/Magento/Backup/Model/Config/Backend/Cron.php @@ -56,7 +56,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -67,7 +67,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() @@ -81,7 +81,7 @@ class Cron extends \Magento\Core\Model\Config\Value * Cron settings after save * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _afterSave() { @@ -124,7 +124,7 @@ class Cron extends \Magento\Core\Model\Config\Value self::CRON_MODEL_PATH )->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t save the Cron expression.')); + throw new \Magento\Model\Exception(__('We can\'t save the Cron expression.')); } } } diff --git a/app/code/Magento/Backup/Model/Resource/Helper.php b/app/code/Magento/Backup/Model/Resource/Helper.php index 1d1f6eaec5217a8fabbcea938c474b485186fb2b..515962267f00d2be02735ce5c7086845a8b560b4 100644 --- a/app/code/Magento/Backup/Model/Resource/Helper.php +++ b/app/code/Magento/Backup/Model/Resource/Helper.php @@ -25,7 +25,7 @@ */ namespace Magento\Backup\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Tables foreign key data array @@ -44,13 +44,13 @@ class Helper extends \Magento\Core\Model\Resource\Helper /** * @param \Magento\App\Resource $resource - * @param \Magento\Stdlib\DateTime\DateTime $coreDate * @param string $modulePrefix + * @param \Magento\Stdlib\DateTime\DateTime $coreDate */ public function __construct( \Magento\App\Resource $resource, - \Magento\Stdlib\DateTime\DateTime $coreDate, - $modulePrefix + $modulePrefix, + \Magento\Stdlib\DateTime\DateTime $coreDate ) { parent::__construct($resource, $modulePrefix); $this->_coreDate = $coreDate; diff --git a/app/code/Magento/Backup/etc/di.xml b/app/code/Magento/Backup/etc/di.xml index e89935b6b1c494b88c037908bbd9a47f355bd29b..39b3fae54cc0b283b26870299c70ba0047077fab 100644 --- a/app/code/Magento/Backup/etc/di.xml +++ b/app/code/Magento/Backup/etc/di.xml @@ -30,4 +30,9 @@ <argument name="backupDbInstanceName" xsi:type="string">Magento\Backup\Model\Db</argument> </arguments> </type> + <type name="Magento\Backup\Model\Resource\Helper"> + <arguments> + <argument name="modulePrefix" xsi:type="string">backup</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php index 681e12acccecee726aba12cd43968eb3d6da541a..38700b9497ba2f09f5260faed4e86934d2a22f10 100644 --- a/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php +++ b/app/code/Magento/Bundle/Block/Catalog/Product/View/Type/Bundle.php @@ -74,17 +74,7 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView protected $_localeFormat; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Bundle\Model\Product\PriceFactory $productPrice @@ -93,21 +83,9 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Locale\FormatInterface $localeFormat * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Bundle\Model\Product\PriceFactory $productPrice, @@ -124,16 +102,6 @@ class Bundle extends \Magento\Catalog\Block\Product\View\AbstractView $this->_localeFormat = $localeFormat; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes diff --git a/app/code/Magento/Bundle/Model/Option.php b/app/code/Magento/Bundle/Model/Option.php index 026c53e7d36bc395efa96e0f5710dedb99360420..5464b305366454c43f0fa95949c3803962d0247d 100644 --- a/app/code/Magento/Bundle/Model/Option.php +++ b/app/code/Magento/Bundle/Model/Option.php @@ -43,7 +43,7 @@ namespace Magento\Bundle\Model; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * Default selection object diff --git a/app/code/Magento/Bundle/Model/Price/Index.php b/app/code/Magento/Bundle/Model/Price/Index.php index 2ecd422d0bd00972c88b164b66302119efff87c6..7020138f4727bbd3c90749eba616554e1ff3ed47 100644 --- a/app/code/Magento/Bundle/Model/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Price/Index.php @@ -43,7 +43,7 @@ namespace Magento\Bundle\Model\Price; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Index extends \Magento\Core\Model\AbstractModel +class Index extends \Magento\Model\AbstractModel { /** * @var \Magento\Customer\Model\Session @@ -60,7 +60,7 @@ class Index extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Index extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Product/Type.php b/app/code/Magento/Bundle/Model/Product/Type.php index 074b756499398c12f5f9402055963ddb22c7460a..fe2da7542303ea4702c2afadf4ffe77efbb6222a 100644 --- a/app/code/Magento/Bundle/Model/Product/Type.php +++ b/app/code/Magento/Bundle/Model/Product/Type.php @@ -1062,7 +1062,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -1076,7 +1076,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType $bundleOption = $buyRequest->getBundleOption(); if (empty($bundleOption)) { - throw new \Magento\Core\Exception($this->getSpecifyOptionMessage()); + throw new \Magento\Model\Exception($this->getSpecifyOptionMessage()); } $skipSaleableCheck = $this->_catalogProduct->getSkipSaleableCheck(); @@ -1084,7 +1084,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType /* @var $selection \Magento\Bundle\Model\Selection */ $selection = $productSelections->getItemById($selectionId); if (!$selection || !$selection->isSalable() && !$skipSaleableCheck) { - throw new \Magento\Core\Exception(__('The required options you selected are not available.')); + throw new \Magento\Model\Exception(__('The required options you selected are not available.')); } } @@ -1092,7 +1092,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\AbstractType $optionsCollection = $this->getOptionsCollection($product); foreach ($optionsCollection->getItems() as $option) { if ($option->getRequired() && empty($bundleOption[$option->getId()])) { - throw new \Magento\Core\Exception(__('Please select all required options.')); + throw new \Magento\Model\Exception(__('Please select all required options.')); } } diff --git a/app/code/Magento/Bundle/Model/Resource/Bundle.php b/app/code/Magento/Bundle/Model/Resource/Bundle.php index 7c2b4576fd599a7b4e69a4c95a822de53b0b6c65..63ee5c199784bb00b2a68b109082f7d1045e49ec 100644 --- a/app/code/Magento/Bundle/Model/Resource/Bundle.php +++ b/app/code/Magento/Bundle/Model/Resource/Bundle.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Bundle extends \Magento\Core\Model\Resource\Db\AbstractDb +class Bundle extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Catalog\Model\Resource\Product\Relation diff --git a/app/code/Magento/Bundle/Model/Resource/Option.php b/app/code/Magento/Bundle/Model/Resource/Option.php index f6f8bb574eed9a2fd65b28a43e63e73562f164dc..3792f0201bf6aa9269088862afca68ce3fca434f 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option.php +++ b/app/code/Magento/Bundle/Model/Resource/Option.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define resource @@ -47,10 +47,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After save process * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); @@ -83,10 +83,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After delete process * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { parent::_afterDelete($object); diff --git a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php index d20c94aed58dc42f121e6f276dfcf3bccce300d0..899f4041136ddbb15f7b16a16d2e43af944c80f3 100644 --- a/app/code/Magento/Bundle/Model/Resource/Option/Collection.php +++ b/app/code/Magento/Bundle/Model/Resource/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource\Option; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * All item ids cache diff --git a/app/code/Magento/Bundle/Model/Resource/Price/Index.php b/app/code/Magento/Bundle/Model/Resource/Price/Index.php index 04029a978caf3487bbb0a27145405ef17b287af8..52f0c99b3174b5da071f4a28fac14cfb4922c5ff 100644 --- a/app/code/Magento/Bundle/Model/Resource/Price/Index.php +++ b/app/code/Magento/Bundle/Model/Resource/Price/Index.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Website; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Index extends \Magento\Core\Model\Resource\Db\AbstractDb +class Index extends \Magento\Model\Resource\Db\AbstractDb { /** * EAV attributes cache diff --git a/app/code/Magento/Bundle/Model/Resource/Selection.php b/app/code/Magento/Bundle/Model/Resource/Selection.php index 66059fdfaf5ab177ef543acbfb9fac974a93c573..255fd649a15c95e718be34b24efe3631f00b204d 100644 --- a/app/code/Magento/Bundle/Model/Resource/Selection.php +++ b/app/code/Magento/Bundle/Model/Resource/Selection.php @@ -32,7 +32,7 @@ namespace Magento\Bundle\Model\Resource; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Selection extends \Magento\Core\Model\Resource\Db\AbstractDb +class Selection extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table and id field diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php index a42c33d027fc45de11d7b26384223339f7600be8..63c0394f724d0940713036609f338df472c89e96 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -44,7 +44,7 @@ class Creditmemo extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Creditmemo extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php index 61ddb577cd65eee0e7aa9ec014a5ba84ea498f64..b90de45336f9e3bb19517057e91a5b30af01805a 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Invoice.php @@ -42,7 +42,7 @@ class Invoice extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $coreString - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Invoice extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $coreString, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php index 0c149eb00fafc6bd2ac23f33bef5c28ad7e56b28..cf251864bd01ae0515b509be6b9ac5aad8707fec 100644 --- a/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php +++ b/app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php @@ -42,7 +42,7 @@ class Shipment extends AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Shipment extends AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Bundle/Model/Selection.php b/app/code/Magento/Bundle/Model/Selection.php index 7239def712fe7a66122f541a64afcedf965c2a81..8bd37643bbe1e73478cf4f262ec72c97161f44ba 100644 --- a/app/code/Magento/Bundle/Model/Selection.php +++ b/app/code/Magento/Bundle/Model/Selection.php @@ -53,7 +53,7 @@ namespace Magento\Bundle\Model; * @package Magento_Bundle * @author Magento Core Team <core@magentocommerce.com> */ -class Selection extends \Magento\Core\Model\AbstractModel +class Selection extends \Magento\Model\AbstractModel { /** * Catalog data diff --git a/app/code/Magento/Bundle/etc/module.xml b/app/code/Magento/Bundle/etc/module.xml index fe55593090bd66990e648b1670aa30ffcc0cb991..6970d55280498ad71b01890a4402afffbae037d4 100644 --- a/app/code/Magento/Bundle/etc/module.xml +++ b/app/code/Magento/Bundle/etc/module.xml @@ -42,7 +42,6 @@ <module name="Magento_Weee"/> <module name="Magento_GiftMessage"/> <module name="Magento_Theme"/> - <module name="Magento_Wishlist"/> </depends> </module> </config> diff --git a/app/code/Magento/Captcha/Model/Resource/Log.php b/app/code/Magento/Captcha/Model/Resource/Log.php index e43ca63d1361561eded483ccfe1e90bd52647347..b291cf70ec44013552d60324229b6ec910513ac3 100644 --- a/app/code/Magento/Captcha/Model/Resource/Log.php +++ b/app/code/Magento/Captcha/Model/Resource/Log.php @@ -30,7 +30,7 @@ namespace Magento\Captcha\Model\Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\Resource\Db\AbstractDb +class Log extends \Magento\Model\Resource\Db\AbstractDb { /** * Type Remote Address diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php index f3fdc8cafb69876ce5cd3e58fb4211f2d77a11e2..23604b12a1c3ea4263d440e99210ec7c41b89e97 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Tree.php @@ -60,9 +60,9 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory protected $_backendSession; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @var \Magento\DB\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** * @var \Magento\Json\EncoderInterface @@ -71,10 +71,10 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\Json\EncoderInterface $jsonEncoder + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Backend\Model\Auth\Session $backendSession * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param array $data @@ -84,13 +84,13 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory \Magento\Catalog\Model\Resource\Category\Tree $categoryTree, \Magento\Registry $registry, \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Core\Model\Resource\HelperPool $helperPool, + \Magento\DB\Helper $resourceHelper, \Magento\Backend\Model\Auth\Session $backendSession, \Magento\Catalog\Model\CategoryFactory $categoryFactory, array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; - $this->_helperPool = $helperPool; + $this->_resourceHelper = $resourceHelper; $this->_backendSession = $backendSession; $this->_categoryFactory = $categoryFactory; parent::__construct($context, $categoryTree, $registry, $data); @@ -201,9 +201,7 @@ class Tree extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory $collection = $this->_categoryFactory->create()->getCollection(); $matchingNamesCollection = clone $collection; - $escapedNamePart = $this->_helperPool->get( - 'Magento_Core' - )->addLikeEscape( + $escapedNamePart = $this->_resourceHelper->addLikeEscape( $namePart, array('position' => 'any') ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php index 808f8d838b623ecf5c1ef7e069f53ccef6da56b9..8da558b3c95d8d5bb5f56f9ee844640146aebdf4 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes/Search.php @@ -48,25 +48,25 @@ class Search extends \Magento\Backend\Block\Widget protected $_collectionFactory; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @var \Magento\DB\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Resource\HelperPool $helperPool, + \Magento\DB\Helper $resourceHelper, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, \Magento\Registry $registry, array $data = array() ) { - $this->_helperPool = $helperPool; + $this->_resourceHelper = $resourceHelper; $this->_collectionFactory = $collectionFactory; $this->_coreRegistry = $registry; parent::__construct($context, $data); @@ -107,9 +107,7 @@ class Search extends \Magento\Backend\Block\Widget */ public function getSuggestedAttributes($labelPart, $templateId = null) { - $escapedLabelPart = $this->_helperPool->get( - 'Magento_Core' - )->addLikeEscape( + $escapedLabelPart = $this->_resourceHelper->addLikeEscape( $labelPart, array('position' => 'any') ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php index c006116ed81ceee8c5d99ea5f259f6ddce75539f..649be1e53949e15d906b8d126b292099fceea7b4 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group.php @@ -18,23 +18,17 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Adminhtml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; +use Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup; /** * Adminhtml group price item renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; - -class Group extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup +class Group extends AbstractGroup { /** * @var string diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index c14dce706c39cb3e3bc71d43791e7ee0f7fa3c1b..905da4d583e0d57597fa464fca90e359b6e6cefa 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -18,23 +18,19 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Adminhtml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; + +use Magento\Backend\Block\Widget; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Data\Form\Element\Renderer\RendererInterface; /** * Adminhtml group price item abstract renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; - -abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements - \Magento\Data\Form\Element\Renderer\RendererInterface +abstract class AbstractGroup extends Widget implements RendererInterface { /** * Form element instance @@ -77,13 +73,13 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements protected $_directoryHelper; /** - * @var \Magento\Customer\Model\GroupFactory + * @var CustomerGroupServiceInterface */ - protected $_groupFactory; + protected $_groupService; /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Customer\Model\GroupFactory $groupFactory + * @param CustomerGroupServiceInterface $groupService * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Registry $registry @@ -91,13 +87,13 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Customer\Model\GroupFactory $groupFactory, + CustomerGroupServiceInterface $groupService, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Catalog\Helper\Data $catalogData, \Magento\Registry $registry, array $data = array() ) { - $this->_groupFactory = $groupFactory; + $this->_groupService = $groupService; $this->_directoryHelper = $directoryHelper; $this->_catalogData = $catalogData; $this->_coreRegistry = $registry; @@ -194,12 +190,11 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements if (!$this->_catalogData->isModuleEnabled('Magento_Customer')) { return array(); } - $collection = $this->_groupFactory->create()->getCollection(); + $groups = $this->_groupService->getGroups(); $this->_customerGroups = $this->_getInitialCustomerGroups(); - foreach ($collection as $item) { - /** @var $item \Magento\Customer\Model\Group */ - $this->_customerGroups[$item->getId()] = $item->getCustomerGroupCode(); + foreach ($groups as $group) { + $this->_customerGroups[$group->getId()] = $group->getCode(); } } @@ -288,7 +283,7 @@ abstract class AbstractGroup extends \Magento\Backend\Block\Widget implements */ public function getDefaultCustomerGroup() { - return \Magento\Customer\Model\Group::CUST_GROUP_ALL; + return CustomerGroupServiceInterface::CUST_GROUP_ALL; } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php index 9187dfbb806361819785dfd6bd59b0ecc870f7b2..e5d093d295fef1ffef172a78d28ea8c260b0b28a 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php @@ -18,22 +18,17 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Adminhtml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; + +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Adminhtml tier price item renderer - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; - -class Tier extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group\AbstractGroup +class Tier extends Group\AbstractGroup { /** * @var string @@ -47,7 +42,7 @@ class Tier extends \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group */ protected function _getInitialCustomerGroups() { - return array(\Magento\Customer\Model\Group::CUST_GROUP_ALL => __('ALL GROUPS')); + return array(CustomerGroupServiceInterface::CUST_GROUP_ALL => __('ALL GROUPS')); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php index 2e4b6b05592964796e5a2d396a5af72f9530a42a..d8f0791bdc5c56b1b8fc2f52c5e1e1672dac1c54 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tabs.php @@ -82,15 +82,15 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs protected $_translateInline; /** - * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Backend\Model\Auth\Session $authSession + * @param \Magento\Module\Manager $moduleManager * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $collectionFactory * @param \Magento\Catalog\Helper\Catalog $helperCatalog * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Registry $registry - * @param \Magento\Translate\InlineInterface $translateInline, + * @param \Magento\Translate\InlineInterface $translateInline * @param array $data */ public function __construct( @@ -264,22 +264,6 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs $this->getChildBlock('product-alerts')->setGroupCode(self::ADVANCED_TAB_GROUP_CODE); } - if ($this->getRequest()->getParam('id')) { - if ($this->_catalogData->isModuleEnabled('Magento_Review')) { - if ($this->_authorization->isAllowed('Magento_Review::reviews_all')) { - $this->addTab( - 'product-reviews', - array( - 'label' => __('Product Reviews'), - 'url' => $this->getUrl('catalog/*/reviews', array('_current' => true)), - 'class' => 'ajax', - 'group_code' => self::ADVANCED_TAB_GROUP_CODE - ) - ); - } - } - } - if (isset($advancedGroups['autosettings'])) { $this->addTab('autosettings', $advancedGroups['autosettings']); unset($advancedGroups['autosettings']); diff --git a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php index 5c21cc6812029aaf72fef3f39ca7747270e2579e..f264d24d8261ae2de1462fcb86b6094014c8efde 100644 --- a/app/code/Magento/Catalog/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Catalog/Block/Product/AbstractProduct.php @@ -35,7 +35,6 @@ namespace Magento\Catalog\Block\Product; use Magento\View\Element\BlockInterface; -use Magento\View\Element\Template\Helper; abstract class AbstractProduct extends \Magento\View\Element\Template { @@ -73,11 +72,6 @@ abstract class AbstractProduct extends \Magento\View\Element\Template */ protected $_useLinkForAsLowAs = true; - /** - * @var Helper - */ - protected $_reviewsHelperBlock; - /** * Default product amount per row * @@ -158,48 +152,32 @@ abstract class AbstractProduct extends \Magento\View\Element\Template protected $_imageHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @var ReviewRendererInterface + */ + protected $reviewRenderer; + + /** + * @param Context $context * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, array $data = array(), array $priceBlockTypes = array() ) { - $this->_imageHelper = $imageHelper; - $this->_layoutHelper = $layoutHelper; - $this->_compareProduct = $compareProduct; - $this->_wishlistHelper = $wishlistHelper; - $this->_cartHelper = $cartHelper; - $this->_catalogConfig = $catalogConfig; - $this->_coreRegistry = $registry; - $this->_taxData = $taxData; - $this->_catalogData = $catalogData; - $this->_mathRandom = $mathRandom; + $this->_imageHelper = $context->getImageHelper(); + $this->_layoutHelper = $context->getLayoutHelper(); + $this->_compareProduct = $context->getCompareProduct(); + $this->_wishlistHelper = $context->getWishlistHelper(); + $this->_cartHelper = $context->getCartHelper(); + $this->_catalogConfig = $context->getCatalogConfig(); + $this->_coreRegistry = $context->getRegistry(); + $this->_taxData = $context->getTaxData(); + $this->_catalogData = $context->getCatalogHelper(); + $this->_mathRandom = $context->getMathRandom(); $this->_priceBlockTypes = $priceBlockTypes; + $this->reviewRenderer = $context->getReviewRenderer(); parent::__construct($context, $data); } @@ -400,29 +378,7 @@ abstract class AbstractProduct extends \Magento\View\Element\Template $templateType = false, $displayIfNoReviews = false ) { - if ($this->_initReviewsHelperBlock()) { - return $this->_reviewsHelperBlock->getSummaryHtml($product, $templateType, $displayIfNoReviews); - } - - return ''; - } - - /** - * Create reviews summary helper block once - * - * @return boolean - */ - protected function _initReviewsHelperBlock() - { - if (!$this->_reviewsHelperBlock) { - if (!$this->_catalogData->isModuleEnabled('Magento_Review')) { - return false; - } else { - $this->_reviewsHelperBlock = $this->getLayout()->createBlock('Magento\Review\Block\Helper'); - } - } - - return true; + return $this->reviewRenderer->getReviewsSummaryHtml($product, $templateType, $displayIfNoReviews); } /** diff --git a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php index 35d7d736e705ac381d4cc5ef6e5f6f127eff5bd9..2889268e017200abe34684fe2ca812091544933f 100644 --- a/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Block/Product/Compare/ListCompare.php @@ -105,51 +105,24 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare */ protected $_coreData; - /** - * @var \Magento\Wishlist\Helper\Data - */ - protected $_wishlistHelper; - /** * @var \Magento\Customer\Service\V1\CustomerCurrentService */ protected $currentCustomer; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory - * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility + * @param Product\Visibility $catalogProductVisibility * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\App\Http\Context $httpContext * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, @@ -159,7 +132,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare array $data = array(), array $priceBlockTypes = array() ) { - $this->_wishlistHelper = $wishlistHelper; $this->_coreData = $coreData; $this->_itemCollectionFactory = $itemCollectionFactory; $this->_catalogProductVisibility = $catalogProductVisibility; @@ -168,16 +140,6 @@ class ListCompare extends \Magento\Catalog\Block\Product\Compare\AbstractCompare $this->currentCustomer = $currentCustomer; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/Context.php b/app/code/Magento/Catalog/Block/Product/Context.php new file mode 100644 index 0000000000000000000000000000000000000000..48a9aab045427c8168743d0b5d4de32c3deab6a8 --- /dev/null +++ b/app/code/Magento/Catalog/Block/Product/Context.php @@ -0,0 +1,282 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Block\Product; + +class Context extends \Magento\View\Element\Template\Context +{ + /** + * @var \Magento\Catalog\Helper\Image + */ + protected $imageHelper; + + /** + * @var \Magento\Theme\Helper\Layout + */ + protected $layoutHelper; + + /** + * @var \Magento\Catalog\Helper\Product\Compare + */ + protected $compareProduct; + + /** + * @var \Magento\Wishlist\Helper\Data + */ + protected $wishlistHelper; + + /** + * @var \Magento\Checkout\Helper\Cart + */ + protected $cartHelper; + + /** + * @var \Magento\Catalog\Model\Config + */ + protected $catalogConfig; + + /** + * @var \Magento\Registry + */ + protected $registry; + + /** + * @var \Magento\Tax\Helper\Data + */ + protected $taxData; + + /** + * @var \Magento\Catalog\Helper\Data + */ + protected $catalogHelper; + + /** + * @var \Magento\Math\Random + */ + protected $mathRandom; + + /** + * @var ReviewRendererInterface + */ + protected $reviewRenderer; + + /** + * @param \Magento\App\RequestInterface $request + * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\UrlInterface $urlBuilder + * @param \Magento\TranslateInterface $translator + * @param \Magento\App\CacheInterface $cache + * @param \Magento\View\DesignInterface $design + * @param \Magento\Session\SessionManagerInterface $session + * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\View\Url $viewUrl + * @param \Magento\View\ConfigInterface $viewConfig + * @param \Magento\App\Cache\StateInterface $cacheState + * @param \Magento\Logger $logger + * @param \Magento\Escaper $escaper + * @param \Magento\Filter\FilterManager $filterManager + * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\App\Filesystem $filesystem + * @param \Magento\View\FileSystem $viewFileSystem + * @param \Magento\View\TemplateEnginePool $enginePool + * @param \Magento\App\State $appState + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Model\Config $catalogConfig + * @param \Magento\Registry $registry + * @param \Magento\Tax\Helper\Data $taxHelper + * @param \Magento\Catalog\Helper\Data $catalogHelper + * @param \Magento\Math\Random $mathRandom + * @param \Magento\Checkout\Helper\Cart $cartHelper + * @param \Magento\Wishlist\Helper\Data $wishlistHelper + * @param \Magento\Catalog\Helper\Product\Compare $compareProduct + * @param \Magento\Theme\Helper\Layout $layoutHelper + * @param \Magento\Catalog\Helper\Image $imageHelper + * @param ReviewRendererInterface $reviewRenderer + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) + */ + public function __construct( + \Magento\App\RequestInterface $request, + \Magento\View\LayoutInterface $layout, + \Magento\Event\ManagerInterface $eventManager, + \Magento\UrlInterface $urlBuilder, + \Magento\TranslateInterface $translator, + \Magento\App\CacheInterface $cache, + \Magento\View\DesignInterface $design, + \Magento\Session\SessionManagerInterface $session, + \Magento\Session\SidResolverInterface $sidResolver, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\View\Url $viewUrl, + \Magento\View\ConfigInterface $viewConfig, + \Magento\App\Cache\StateInterface $cacheState, + \Magento\Logger $logger, + \Magento\Escaper $escaper, + \Magento\Filter\FilterManager $filterManager, + \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\App\Filesystem $filesystem, + \Magento\View\FileSystem $viewFileSystem, + \Magento\View\TemplateEnginePool $enginePool, + \Magento\App\State $appState, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Config $catalogConfig, + \Magento\Registry $registry, + \Magento\Tax\Helper\Data $taxHelper, + \Magento\Catalog\Helper\Data $catalogHelper, + \Magento\Math\Random $mathRandom, + \Magento\Checkout\Helper\Cart $cartHelper, + \Magento\Wishlist\Helper\Data $wishlistHelper, + \Magento\Catalog\Helper\Product\Compare $compareProduct, + \Magento\Theme\Helper\Layout $layoutHelper, + \Magento\Catalog\Helper\Image $imageHelper, + ReviewRendererInterface $reviewRenderer + ) { + $this->imageHelper = $imageHelper; + $this->layoutHelper = $layoutHelper; + $this->compareProduct = $compareProduct; + $this->wishlistHelper = $wishlistHelper; + $this->cartHelper = $cartHelper; + $this->catalogConfig = $catalogConfig; + $this->registry = $registry; + $this->taxData = $taxHelper; + $this->catalogHelper = $catalogHelper; + $this->mathRandom = $mathRandom; + $this->reviewRenderer = $reviewRenderer; + parent::__construct( + $request, + $layout, + $eventManager, + $urlBuilder, + $translator, + $cache, + $design, + $session, + $sidResolver, + $storeConfig, + $viewUrl, + $viewConfig, + $cacheState, + $logger, + $escaper, + $filterManager, + $localeDate, + $inlineTranslation, + $filesystem, + $viewFileSystem, + $enginePool, + $appState, + $storeManager + ); + } + + /** + * @return \Magento\Checkout\Helper\Cart + */ + public function getCartHelper() + { + return $this->cartHelper; + } + + /** + * @return \Magento\Catalog\Model\Config + */ + public function getCatalogConfig() + { + return $this->catalogConfig; + } + + /** + * @return \Magento\Catalog\Helper\Data + */ + public function getCatalogHelper() + { + return $this->catalogHelper; + } + + /** + * @return \Magento\Catalog\Helper\Product\Compare + */ + public function getCompareProduct() + { + return $this->compareProduct; + } + + /** + * @return \Magento\Catalog\Helper\Image + */ + public function getImageHelper() + { + return $this->imageHelper; + } + + /** + * @return \Magento\Theme\Helper\Layout + */ + public function getLayoutHelper() + { + return $this->layoutHelper; + } + + /** + * @return \Magento\Math\Random + */ + public function getMathRandom() + { + return $this->mathRandom; + } + + /** + * @return \Magento\Registry + */ + public function getRegistry() + { + return $this->registry; + } + + /** + * @return \Magento\Tax\Helper\Data + */ + public function getTaxData() + { + return $this->taxData; + } + + /** + * @return \Magento\Wishlist\Helper\Data + */ + public function getWishlistHelper() + { + return $this->wishlistHelper; + } + + /** + * @return \Magento\Catalog\Block\Product\ReviewRendererInterface + */ + public function getReviewRenderer() + { + return $this->reviewRenderer; + } +} diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index e37687c57d622d61f61aa224392872b7a290d64c..4788cf3208c5b775ede2d9bfc5a6201df250bfdb 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -69,36 +69,14 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct impleme protected $_categoryFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer $catalogLayer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer $catalogLayer, array $data = array(), @@ -108,16 +86,6 @@ class ListProduct extends \Magento\Catalog\Block\Product\AbstractProduct impleme $this->_catalogLayer = $catalogLayer; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/NewProduct.php b/app/code/Magento/Catalog/Block/Product/NewProduct.php index c7d7b20b3528252c2b13e3ac24f201acfeb9e3b6..af43ca2166faa951570e5987e505884b1ba3e189 100644 --- a/app/code/Magento/Catalog/Block/Product/NewProduct.php +++ b/app/code/Magento/Catalog/Block/Product/NewProduct.php @@ -65,37 +65,15 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen protected $_productCollectionFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param Context $context * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\App\Http\Context $httpContext * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\App\Http\Context $httpContext, @@ -107,16 +85,6 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen $this->httpContext = $httpContext; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index 4ace7da1f430b3f969ed8b3c8589445707886fc9..7a1691fae5e9fe78f1cb9ba15d08ec64e422fef2 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -45,38 +45,16 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct protected $_layerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer\Category $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param CollectionFactory $productCollectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -88,16 +66,6 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $categoryFactory, $catalogLayer, $data, diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php index da2706510d106865ac58f0c39a15fa1296fd5af6..bd6263e11fabaca8e8ff61511d9b2253353fc8c8 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -47,38 +47,16 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct protected $_layerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Layer\Category $catalogLayer * @param \Magento\Catalog\Model\LayerFactory $layerFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Layer\Category $catalogLayer, \Magento\Catalog\Model\LayerFactory $layerFactory, @@ -90,16 +68,6 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $categoryFactory, $catalogLayer, $data, diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php index fdefb815815abc23b9712a59200b8bf8872a891b..76554dbd6e16b3aa77f40182b6e0e600a21e33a5 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Related.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Related.php @@ -69,37 +69,15 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements protected $_checkoutCart; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -111,16 +89,6 @@ class Related extends \Magento\Catalog\Block\Product\AbstractProduct implements $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php index 29215103a88c8865c5c0ab7294d54a6aa969e665..c0f8ba2117f6441b269129fea95e7a9a85befaa0 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Toolbar.php @@ -40,7 +40,7 @@ class Toolbar extends \Magento\View\Element\Template /** * Products collection * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_collection = null; @@ -231,7 +231,7 @@ class Toolbar extends \Magento\View\Element\Template /** * Return products collection instance * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getCollection() { diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 44fe821c32e765343193f5766b49b6ef15976fe3..03551722b766bb6860f9b791b096271cdc9d5878 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -84,37 +84,15 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ protected $_checkoutCart; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, @@ -126,16 +104,6 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct implements \ $this->_checkoutSession = $checkoutSession; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/lib/Magento/Outbound/MessageInterface.php b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php similarity index 61% rename from lib/Magento/Outbound/MessageInterface.php rename to app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php index 0e31fdf138569ad7d1a22118e3cd4d45176e2981..e115ec10aa4b64fdd38ec72140037cafda704e78 100644 --- a/lib/Magento/Outbound/MessageInterface.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRenderer/DefaultProvider.php @@ -1,6 +1,6 @@ <?php /** - * Interface for Messages that can be sent in PubSub + * Default implementation of product review service provider * * Magento * @@ -20,41 +20,28 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Outbound * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Outbound; +namespace Magento\Catalog\Block\Product\ReviewRenderer; -interface MessageInterface +use Magento\Catalog\Block\Product\ReviewRendererInterface; + +class DefaultProvider implements ReviewRendererInterface { /** - * return endpoint url + * Get product review summary html * + * @param \Magento\Catalog\Model\Product $product + * @param string $templateType + * @param bool $displayIfNoReviews * @return string */ - public function getEndpointUrl(); - - /** - * return formatted headers - * - * @return array - */ - public function getHeaders(); - - /** - * Get the message body - * - * @return string|null - */ - public function getBody(); - - /** - * Get timeout in seconds - * - * return timeout - * @return int - */ - public function getTimeout(); + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ) { + return ''; + } } diff --git a/lib/Magento/PubSub/Event/QueueWriter.php b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php similarity index 64% rename from lib/Magento/PubSub/Event/QueueWriter.php rename to app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php index fa02abf17735976a7e169e0e77f08278b27dfe02..723a60f1c985cb9bf1eb52c6a52d74a6fdbbb7e3 100644 --- a/lib/Magento/PubSub/Event/QueueWriter.php +++ b/app/code/Magento/Catalog/Block/Product/ReviewRendererInterface.php @@ -1,7 +1,5 @@ <?php /** - * Stub queue writer to avoid DI issues. - * * Magento * * NOTICE OF LICENSE @@ -20,23 +18,28 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_PubSub * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; -class QueueWriter implements \Magento\PubSub\Event\QueueWriterInterface +namespace Magento\Catalog\Block\Product; + +interface ReviewRendererInterface { + const SHORT_REVIEW = 'short'; + const DEFAULT_REVIEW = 'default'; + /** - * Stub that doesn't do anything + * Get product review summary html * - * @param \Magento\PubSub\EventInterface $event - * @return null + * @param \Magento\Catalog\Model\Product $product + * @param string $templateType + * @param bool $displayIfNoReviews + * @return string */ - public function offer(\Magento\PubSub\EventInterface $event) - { - return null; - } + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ); } diff --git a/app/code/Magento/Catalog/Block/Product/Send.php b/app/code/Magento/Catalog/Block/Product/Send.php index dbbe05a2570ab4bdbce326c18a53662574e01c30..6c7858e98aadfe8ca97aeba406c135221219d0cf 100644 --- a/app/code/Magento/Catalog/Block/Product/Send.php +++ b/app/code/Magento/Catalog/Block/Product/Send.php @@ -18,22 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - +namespace Magento\Catalog\Block\Product; /** * Product send to friend block - * - * @category Magento - * @package Magento_Catalog - * @module Catalog */ -namespace Magento\Catalog\Block\Product; - class Send extends \Magento\Catalog\Block\Product\AbstractProduct { /** @@ -44,52 +36,30 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct protected $_customerSession; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * Customer view helper + * + * @var \Magento\Customer\Helper\View + */ + protected $_customerView; + + /** + * @param Context $context * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Customer\Helper\View $customerView * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Customer\Model\Session $customerSession, + \Magento\Customer\Helper\View $customerView, array $data = array(), array $priceBlockTypes = array() ) { $this->_customerSession = $customerSession; + $this->_customerView = $customerView; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -103,7 +73,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getUserName() { - return $this->_customerSession->getCustomer()->getName(); + return $this->_customerView->getCustomerName($this->_customerSession->getCustomerDataObject()); } /** @@ -111,7 +81,7 @@ class Send extends \Magento\Catalog\Block\Product\AbstractProduct */ public function getEmail() { - return (string)$this->_customerSession->getCustomer()->getEmail(); + return (string)$this->_customerSession->getCustomerDataObject()->getEmail(); } /** diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index de7367847e8f2b14a66a5e70bc774c1cd73b2939..32c3b020d4ffbf1b25baa5c390e1179cfabbeec6 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -84,17 +84,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma protected $_localeFormat; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -105,21 +95,9 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma * @param \Magento\Locale\FormatInterface $localeFormat * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -141,16 +119,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct implements \Ma $this->_localeFormat = $localeFormat; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php index b3995daf0ce625a7404d8ec2a521e05d6ccd432b..255fb744a3bad4a38670298993c5e4cf15db5a75 100644 --- a/app/code/Magento/Catalog/Block/Product/View/AbstractView.php +++ b/app/code/Magento/Catalog/Block/Product/View/AbstractView.php @@ -41,35 +41,13 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu protected $arrayUtils; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, array $data = array(), array $priceBlockTypes = array() @@ -77,16 +55,6 @@ abstract class AbstractView extends \Magento\Catalog\Block\Product\AbstractProdu $this->arrayUtils = $arrayUtils; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php b/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php index 05ca3bfade6188fcee0a7a9809c6fe8716986da5..b906be5da902fda001a6f404656a4ecbe4ea2d06 100644 --- a/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php +++ b/app/code/Magento/Catalog/Block/Product/Widget/Html/Pager.php @@ -120,7 +120,7 @@ class Pager extends \Magento\Theme\Block\Html\Pager /** * Connect collection to paging * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection * @return \Magento\Catalog\Block\Product\Widget\Html\Pager */ public function setCollection($collection) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php index 596e48694c6e004debf9e1db80afe2c13f07076b..ca30e9cfa4ff7fba43ba9e5433db0d405bdaa039 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category.php @@ -377,16 +377,16 @@ class Category extends \Magento\Backend\App\Action foreach ($validate as $code => $error) { if ($error === true) { $attribute = $category->getResource()->getAttribute($code)->getFrontend()->getLabel(); - throw new \Magento\Core\Exception(__('Attribute "%1" is required.', $attribute)); + throw new \Magento\Model\Exception(__('Attribute "%1" is required.', $attribute)); } else { - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } } } $category->unsetData('use_post_data_config'); if (isset($data['general']['entity_id'])) { - throw new \Magento\Core\Exception(__('Unable to save the category')); + throw new \Magento\Model\Exception(__('Unable to save the category')); } $category->save(); @@ -468,7 +468,7 @@ class Category extends \Magento\Backend\App\Action try { $category->move($parentNodeId, $prevNodeId); $this->getResponse()->setBody('SUCCESS'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->getResponse()->setBody($e->getMessage()); } catch (\Exception $e) { $this->getResponse()->setBody(__('There was a category move error %1', $e)); @@ -493,7 +493,7 @@ class Category extends \Magento\Backend\App\Action $category->delete(); $this->messageManager->addSuccess(__('You deleted the category.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->getResponse()->setRedirect($this->getUrl('catalog/*/edit', array('_current' => true))); return; diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php index 6b378f5f52abf32610063490d0764a12d4fbb8bc..438fd69ae97f50b69a406436e4cbb03653b4ea1d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product.php @@ -477,24 +477,7 @@ class Product extends \Magento\Backend\App\Action $this->_view->renderLayout(); } - /** - * Get product reviews grid - * - * @return void - */ - public function reviewsAction() - { - $product = $this->productBuilder->build($this->getRequest()); - $this->_view->loadLayout(); - $this->_view->getLayout()->getBlock( - 'admin.product.reviews' - )->setProductId( - $product->getId() - )->setUseAjax( - true - ); - $this->_view->renderLayout(); - } + /** * Validate product @@ -556,7 +539,7 @@ class Product extends \Magento\Backend\App\Action $response->setError(true); $response->setAttribute($e->getAttributeCode()); $response->setMessage($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -588,7 +571,7 @@ class Product extends \Magento\Backend\App\Action try { if (isset($data['product'][$product->getIdFieldName()])) { - throw new \Magento\Core\Exception(__('Unable to save product')); + throw new \Magento\Model\Exception(__('Unable to save product')); } $originalSku = $product->getSku(); @@ -634,7 +617,7 @@ class Product extends \Magento\Backend\App\Action $newProduct = $this->productCopier->copy($product); $this->messageManager->addSuccess(__('You duplicated the product.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_session->setProductData($data); $redirectBack = true; @@ -755,7 +738,7 @@ class Product extends \Magento\Backend\App\Action $this->_productPriceIndexerProcessor->reindexList($productIds); } catch (\Magento\Core\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_getSession()->addException($e, __('Something went wrong while updating the product(s) status.')); @@ -770,13 +753,13 @@ class Product extends \Magento\Backend\App\Action * @param array $productIds * @param int $status * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _validateMassStatus(array $productIds, $status) { if ($status == \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) { if (!$this->_objectManager->create('Magento\Catalog\Model\Product')->isProductsHasSku($productIds)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please make sure to define SKU values for all processed products.') ); } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php index 146561748d8aba003a283418d3c4f7db9b6eb361..60f61e5bb5af095927ae04fc9b272f125ce9652d 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute.php @@ -232,7 +232,7 @@ class Attribute extends Action ) { $this->_productPriceIndexerProcessor->reindexList($this->_helper->getProductIds()); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -308,7 +308,7 @@ class Attribute extends Action $response->setError(true); $response->setAttribute($e->getAttributeCode()); $response->setMessage($e->getMessage()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php index 6d40308cccd26b05533b6e507f66e61da77874e4..8b02b69107e724dcc313f28fa2b622e25b1edaf2 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute.php @@ -292,7 +292,7 @@ class Attribute extends \Magento\Backend\App\Action $attributeSet->save(); $attributeSet->initFromSkeleton($this->getRequest()->getParam('set'))->save(); $isNewAttributeSet = true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong saving the attribute.')); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php index 3c2cfc4f7823a2b84dfde328f34761216e7f540f..53e8c0cd8a655a01f03d555b3af37ea6185210a0 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set.php @@ -147,7 +147,7 @@ class Set extends \Magento\Backend\App\Action $model->load($attributeSetId); } if (!$model->getId()) { - throw new \Magento\Core\Exception(__('This attribute set no longer exists.')); + throw new \Magento\Model\Exception(__('This attribute set no longer exists.')); } $data = $this->_objectManager->get( 'Magento\Core\Helper\Data' @@ -168,7 +168,7 @@ class Set extends \Magento\Backend\App\Action } $model->save(); $this->messageManager->addSuccess(__('You saved the attribute set.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php index 4b7c85657e27957f9c4bb51498828cc38bd132da..56e1e3eddcd2f0904f8e81d5d7cddb7c6c71b59f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Search.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Search.php @@ -143,7 +143,7 @@ class Search extends \Magento\Backend\App\Action $model->setStoreId($storeId); $model->loadByQueryText($queryText); if ($model->getId() && $model->getId() != $queryId) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You already have an identical search term query.') ); } elseif (!$model->getId() && $queryId) { @@ -156,7 +156,7 @@ class Search extends \Magento\Backend\App\Action $model->addData($data); $model->setIsProcessed(0); $model->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $hasError = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Catalog/Controller/Category.php b/app/code/Magento/Catalog/Controller/Category.php index cbaf5da3a74f3863ec8a7592e0ea8f37e32d29cb..0a2b3b6aac7739f43b455847c8e2bcd065106ea5 100644 --- a/app/code/Magento/Catalog/Controller/Category.php +++ b/app/code/Magento/Catalog/Controller/Category.php @@ -120,7 +120,7 @@ class Category extends \Magento\App\Action\Action 'catalog_controller_category_init_after', array('category' => $category, 'controller_action' => $this) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); return false; } diff --git a/app/code/Magento/Catalog/Controller/Product/Compare.php b/app/code/Magento/Catalog/Controller/Product/Compare.php index 47d53b2ec511b41f61627dece687a91a5bef2a9e..f05238fcac2cecea96d5d93e4f859b645fd63c5b 100644 --- a/app/code/Magento/Catalog/Controller/Product/Compare.php +++ b/app/code/Magento/Catalog/Controller/Product/Compare.php @@ -90,13 +90,6 @@ class Compare extends \Magento\App\Action\Action */ protected $_compareItemFactory; - /** - * Customer factory - * - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -109,7 +102,6 @@ class Compare extends \Magento\App\Action\Action /** * @param \Magento\App\Action\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory @@ -122,7 +114,6 @@ class Compare extends \Magento\App\Action\Action */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Catalog\Model\Product\Compare\ItemFactory $compareItemFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Resource\Product\Compare\Item\CollectionFactory $itemCollectionFactory, @@ -134,7 +125,6 @@ class Compare extends \Magento\App\Action\Action FormKeyValidator $formKeyValidator ) { $this->_storeManager = $storeManager; - $this->_customerFactory = $customerFactory; $this->_compareItemFactory = $compareItemFactory; $this->_productFactory = $productFactory; $this->_itemCollectionFactory = $itemCollectionFactory; @@ -222,9 +212,9 @@ class Compare extends \Magento\App\Action\Action /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ $item = $this->_compareItemFactory->create(); if ($this->_customerSession->isLoggedIn()) { - $item->addCustomerData($this->_customerSession->getCustomer()); + $item->setCustomerId($this->_customerSession->getCustomerId()); } elseif ($this->_customerId) { - $item->addCustomerData($this->_customerFactory->create()->load($this->_customerId)); + $item->setCustomerId($this->_customerId); } else { $item->addVisitorId($this->_logVisitor->getId()); } @@ -274,7 +264,7 @@ class Compare extends \Magento\App\Action\Action $items->clear(); $this->messageManager->addSuccess(__('You cleared the comparison list.')); $this->_objectManager->get('Magento\Catalog\Helper\Product\Compare')->calculate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong clearing the comparison list.')); diff --git a/app/code/Magento/Catalog/Helper/Product.php b/app/code/Magento/Catalog/Helper/Product.php index e019261b36949109187edf430fac7dadb575105f..af5b79588de2e1ac695c66240c3a6036c36cc19c 100644 --- a/app/code/Magento/Catalog/Helper/Product.php +++ b/app/code/Magento/Catalog/Helper/Product.php @@ -494,7 +494,7 @@ class Product extends \Magento\Core\Helper\Url 'catalog_controller_product_init_after', array('product' => $product, 'controller_action' => $controller) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); return false; } diff --git a/app/code/Magento/Catalog/Helper/Product/Composite.php b/app/code/Magento/Catalog/Helper/Product/Composite.php old mode 100644 new mode 100755 index 42ba79f3401d05def96dbbb3963734ff3e724e14..72558aa362fa477a810ad51368dcd03409eb9b05 --- a/app/code/Magento/Catalog/Helper/Product/Composite.php +++ b/app/code/Magento/Catalog/Helper/Product/Composite.php @@ -25,7 +25,14 @@ */ namespace Magento\Catalog\Helper\Product; +use Magento\App\Helper\Context; +use Magento\App\ViewInterface; +use Magento\Catalog\Helper\Product; +use Magento\Catalog\Model\ProductFactory; +use Magento\Core\Model\StoreManagerInterface; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Model\Converter; +use Magento\Registry; /** * Adminhtml catalog product composite helper @@ -39,61 +46,61 @@ class Composite extends \Magento\App\Helper\AbstractHelper /** * Core registry * - * @var \Magento\Registry + * @var Registry */ protected $_coreRegistry = null; /** * Catalog product * - * @var \Magento\Catalog\Helper\Product + * @var Product */ protected $_catalogProduct = null; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** - * @var \Magento\Catalog\Model\ProductFactory + * @var ProductFactory */ protected $_productFactory; /** - * @var \Magento\Customer\Model\CustomerFactory + * @var ViewInterface */ - protected $_customerFactory; + protected $_view; /** - * @var \Magento\App\ViewInterface + * @var Converter */ - protected $_view; + protected $_converter; /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory - * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Helper\Product $catalogProduct - * @param \Magento\Registry $coreRegistry - * @param \Magento\App\ViewInterface $view + * @param Context $context + * @param ProductFactory $productFactory + * @param StoreManagerInterface $storeManager + * @param Product $catalogProduct + * @param Registry $coreRegistry + * @param ViewInterface $view + * @param Converter $converter */ public function __construct( - \Magento\App\Helper\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, - \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Helper\Product $catalogProduct, - \Magento\Registry $coreRegistry, - \Magento\App\ViewInterface $view + Context $context, + ProductFactory $productFactory, + StoreManagerInterface $storeManager, + Product $catalogProduct, + Registry $coreRegistry, + ViewInterface $view, + Converter $converter ) { - $this->_customerFactory = $customerFactory; $this->_productFactory = $productFactory; $this->_storeManager = $storeManager; $this->_coreRegistry = $coreRegistry; $this->_catalogProduct = $catalogProduct; $this->_view = $view; + $this->_converter = $converter; parent::__construct($context); } @@ -157,8 +164,8 @@ class Composite extends \Magento\App\Helper\AbstractHelper /** * Prepares and render result of composite product configuration request * - * $configureResult holds either: - * - 'ok' = true, and 'product_id', 'buy_request', 'current_store_id', 'current_customer' or 'current_customer_id' + * The $configureResult variable holds either: + * - 'ok' = true, and 'product_id', 'buy_request', 'current_store_id', 'current_customer_id' * - 'error' = true, and 'message' to show * * @param \Magento\Object $configureResult @@ -168,7 +175,7 @@ class Composite extends \Magento\App\Helper\AbstractHelper { try { if (!$configureResult->getOk()) { - throw new \Magento\Core\Exception($configureResult->getMessage()); + throw new \Magento\Model\Exception($configureResult->getMessage()); } $currentStoreId = (int)$configureResult->getCurrentStoreId(); @@ -182,22 +189,17 @@ class Composite extends \Magento\App\Helper\AbstractHelper $configureResult->getProductId() ); if (!$product->getId()) { - throw new \Magento\Core\Exception(__('The product is not loaded.')); + throw new \Magento\Model\Exception(__('The product is not loaded.')); } $this->_coreRegistry->register('current_product', $product); $this->_coreRegistry->register('product', $product); // Register customer we're working with - $currentCustomer = $configureResult->getCurrentCustomer(); - if (!$currentCustomer) { - $currentCustomerId = (int)$configureResult->getCurrentCustomerId(); - if ($currentCustomerId) { - $currentCustomer = $this->_customerFactory->create()->load($currentCustomerId); - } - } - if ($currentCustomer) { - $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $currentCustomer); - } + $customerId = (int)$configureResult->getCurrentCustomerId(); + // TODO: Remove the customer model from the registry once all readers are refactored + $customerModel = $this->_converter->loadCustomerModel($customerId); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customerModel); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); // Prepare buy request values $buyRequest = $configureResult->getBuyRequest(); diff --git a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php index bf515a58c3c7ac14982bdfc7fb5b6b6344477cdb..a159314fb13c052535096251692778889abb2dc4 100644 --- a/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php +++ b/app/code/Magento/Catalog/Helper/Product/Flat/Indexer.php @@ -485,7 +485,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper * Retrieve loaded attribute by code * * @param string $attributeCode - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Eav\Model\Entity\Attribute */ public function getAttribute($attributeCode) @@ -495,7 +495,7 @@ class Indexer extends \Magento\App\Helper\AbstractHelper $attribute = $this->_attributeFactory->create(); $attribute->loadByCode($this->getEntityTypeId(), $attributeCode); if (!$attribute->getId()) { - throw new \Magento\Core\Exception(__('Invalid attribute %1', $attributeCode)); + throw new \Magento\Model\Exception(__('Invalid attribute %1', $attributeCode)); } $entity = $this->_eavConfig->getEntityType($this->getEntityType())->getEntity(); $attribute->setEntity($entity); diff --git a/app/code/Magento/Catalog/Helper/Product/Price.php b/app/code/Magento/Catalog/Helper/Product/Price.php index bddc90fcde2b6e5b60b54c084399ca5bc668d72d..b47880ae5cc7e67b6719389db75e5448c73425e4 100644 --- a/app/code/Magento/Catalog/Helper/Product/Price.php +++ b/app/code/Magento/Catalog/Helper/Product/Price.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Helper\Product; use Magento\Catalog\Model\Product; -use Magento\Customer\Model\Customer; +use Magento\Customer\Service\V1\Data\Customer; /** * Collection of tax module calls @@ -99,13 +99,13 @@ class Price extends \Magento\App\Helper\AbstractHelper } /** - * Get customer object + * Get customer data object * - * @return bool|Customer + * @return Customer CustomerDataObject */ public function getCustomer() { - return $this->taxCalculation->getCustomer(); + return $this->taxCalculation->getCustomerData(); } /** @@ -116,7 +116,7 @@ class Price extends \Magento\App\Helper\AbstractHelper */ public function setCustomer(Customer $customer) { - $this->taxCalculation->setCustomer($customer); + $this->taxCalculation->setCustomerData($customer); return $this; } diff --git a/app/code/Magento/Catalog/Helper/Product/View.php b/app/code/Magento/Catalog/Helper/Product/View.php index 3b0b916c7ff33ad75f7de0136dc9abd88d9e9344..bf67df6afe088fa686f4e9da5d004d2e54f2c17a 100644 --- a/app/code/Magento/Catalog/Helper/Product/View.php +++ b/app/code/Magento/Catalog/Helper/Product/View.php @@ -220,7 +220,7 @@ class View extends \Magento\App\Helper\AbstractHelper * @param null|\Magento\Object $params * * @return \Magento\Catalog\Helper\Product\View - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareAndRender($productId, $controller, $params = null) { @@ -233,7 +233,7 @@ class View extends \Magento\App\Helper\AbstractHelper // Standard algorithm to prepare and render product view page $product = $productHelper->initProduct($productId, $controller, $params); if (!$product) { - throw new \Magento\Core\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED); + throw new \Magento\Model\Exception(__('Product is not loaded'), $this->ERR_NO_PRODUCT_LOADED); } $buyRequest = $params->getBuyRequest(); @@ -259,7 +259,7 @@ class View extends \Magento\App\Helper\AbstractHelper if ($controller instanceof \Magento\Catalog\Controller\Product\View\ViewInterface) { $this->_view->getLayout()->initMessages($this->messageGroups); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Bad controller interface for showing product'), $this->ERR_BAD_CONTROLLER_INTERFACE ); diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 1e1859dcef4b80ecda728e6e84d719f039e48329..86ed8240b33720258e3aff8ca1e74316027c9d8b 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * Attribute default values @@ -83,7 +83,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -91,7 +91,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php b/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php index 12bf7ad0898477530b4b8850129b52f82a931d4c..9f86bc6c911461cb5ec349acd00e64c8b68801dc 100644 --- a/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php +++ b/app/code/Magento/Catalog/Model/Attribute/LockValidatorComposite.php @@ -50,13 +50,13 @@ class LockValidatorComposite implements LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null) + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null) { foreach ($this->validators as $validator) { $validator->validate($object, $attributeSet); diff --git a/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php b/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php index 8ad8ed9511eb9fb4e9df26aebb332d72e01580d6..9982894594a5e6444f7151c3ad962fa6bb8be1f6 100644 --- a/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php +++ b/app/code/Magento/Catalog/Model/Attribute/LockValidatorInterface.php @@ -30,11 +30,11 @@ interface LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null); + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null); } diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index f1eac57c2e3cdfad7a03ac27d1c485244d7506a1..098d00de30042b200c5bac79ff6800aafcfb185f 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -205,7 +205,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ * @param Indexer\Category\Flat\State $flatState * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\IndexerInterface $productIndexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -226,7 +226,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ Indexer\Category\Flat\State $flatState, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\IndexerInterface $productIndexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -337,7 +337,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ * @param int $parentId new parent category id * @param null|int $afterCategoryId category id after which we have put current category * @return $this - * @throws \Magento\Core\Exception|\Exception + * @throws \Magento\Model\Exception|\Exception */ public function move($parentId, $afterCategoryId) { @@ -348,7 +348,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ $parent = $this->_categoryFactory->create()->setStoreId($this->getStoreId())->load($parentId); if (!$parent->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but we can\'t move the category because we can\'t find the new parent category you selected.' ) @@ -356,11 +356,11 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ } if (!$this->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Sorry, but we can\'t move the category because we can\'t find the new category you selected.') ); } elseif ($parent->getId() == $this->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'We can\'t perform this category move operation because the parent category matches the child category.' ) @@ -862,14 +862,13 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * Before delete process * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); if ($this->getResource()->isForbiddenToDelete($this->getId())) { - throw new \Magento\Core\Exception("Can't delete root category."); + throw new \Magento\Model\Exception("Can't delete root category."); } return parent::_beforeDelete(); } @@ -891,12 +890,12 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ if ($this->_useFlatResource) { $anchors = $this->_getResource()->getAnchorsAbove($path, $this->getStoreId()); } else { - if (!$this->_coreRegistry->registry('_category_is_anchor_attribute')) { + if (!$this->_registry->registry('_category_is_anchor_attribute')) { $model = $this->_getAttribute('is_anchor'); - $this->_coreRegistry->register('_category_is_anchor_attribute', $model); + $this->_registry->register('_category_is_anchor_attribute', $model); } - $isAnchorAttribute = $this->_coreRegistry->registry('_category_is_anchor_attribute'); + $isAnchorAttribute = $this->_registry->registry('_category_is_anchor_attribute'); if ($isAnchorAttribute) { $anchors = $this->getResource()->findWhereAttributeIs($path, $isAnchorAttribute, 1); } @@ -1079,7 +1078,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * Init indexing process after category delete * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDeleteCommit() { diff --git a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php index 02b111fe5de103489f1340dd134fa6339be8cc92..741fd0705f6c16ed5f105a4104bfad7ca9e7f0cc 100644 --- a/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/Backend/Sortby.php @@ -58,7 +58,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * * @param \Magento\Object $object * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate($object) { @@ -86,7 +86,7 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend if ($this->getAttribute()->getIsUnique()) { if (!$this->getAttribute()->getEntity()->checkAttributeUniqueValue($this->getAttribute(), $object)) { $label = $this->getAttribute()->getFrontend()->getLabel(); - throw new \Magento\Core\Exception(__('The value of attribute "%1" must be unique.', $label)); + throw new \Magento\Model\Exception(__('The value of attribute "%1" must be unique.', $label)); } } @@ -104,13 +104,13 @@ class Sortby extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend "catalog/frontend/default_sort_by" ); if (!in_array($data, $available)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Default Product Listing Sort by does not exist in Available Product Listing Sort By.') ); } } else { if (!in_array('available_sort_by', $postDataConfig)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Default Product Listing Sort by does not exist in Available Product Listing Sort By.') ); } diff --git a/app/code/Magento/Catalog/Model/Config.php b/app/code/Magento/Catalog/Model/Config.php index 9616618b4fbad394e859eb3bfe8c5aeba81cf623..98aabb68c517e345c182a113e8933b2043012395 100644 --- a/app/code/Magento/Catalog/Model/Config.php +++ b/app/code/Magento/Catalog/Model/Config.php @@ -133,7 +133,7 @@ class Config extends \Magento\Eav\Model\Config /** * Constructor * - * @param \Magento\Core\Model\App $app + * @param \Magento\App\CacheInterface $cache * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Validator\UniversalFactory $universalFactory @@ -148,7 +148,7 @@ class Config extends \Magento\Eav\Model\Config * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\App\Cache\StateInterface $cacheState, \Magento\Validator\UniversalFactory $universalFactory, @@ -168,7 +168,7 @@ class Config extends \Magento\Eav\Model\Config $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; - parent::__construct($app, $entityTypeFactory, $cacheState, $universalFactory); + parent::__construct($cache, $entityTypeFactory, $cacheState, $universalFactory); } /** diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Category.php b/app/code/Magento/Catalog/Model/Config/Backend/Category.php index aa28ab77c4cdc8cdd6bb60ad9ec54da6ae2ba121..05b69eb3469990f56e9c00a0a7b6adf82bdd530f 100644 --- a/app/code/Magento/Catalog/Model/Config/Backend/Category.php +++ b/app/code/Magento/Catalog/Model/Config/Backend/Category.php @@ -49,7 +49,7 @@ class Category extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Category $catalogCategory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Category extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Category $catalogCategory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php index da7b4f442f2cdf381f36bf78290891c2900a53dc..9e15babe76e8d3d7350bacd1e58b373bce08bb12 100644 --- a/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php +++ b/app/code/Magento/Catalog/Model/Config/CatalogClone/Media/Image.php @@ -53,7 +53,7 @@ class Image extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Image extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Design.php b/app/code/Magento/Catalog/Model/Design.php index db6c7949d16b765683cd7c658da038e3f331d0b7..2300884ce92dc338f115f4ed5587ab79113c6eeb 100644 --- a/app/code/Magento/Catalog/Model/Design.php +++ b/app/code/Magento/Catalog/Model/Design.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Design extends \Magento\Core\Model\AbstractModel +class Design extends \Magento\Model\AbstractModel { const APPLY_FOR_PRODUCT = 1; @@ -55,7 +55,7 @@ class Design extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Design extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php index 1e9d1554dc8352f65f681d92594d9ca563948909..8f02f52739636abdf6ec8a078912fe1eb9c0b0b3 100644 --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -103,7 +103,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory * @param \Magento\Locale\ResolverInterface $localeResolver * @param LockValidatorInterface $lockValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -120,7 +120,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Catalog\Model\ProductFactory $catalogProductFactory, \Magento\Locale\ResolverInterface $localeResolver, LockValidatorInterface $lockValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -146,14 +146,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object before save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel * @throws \Magento\Eav\Exception */ protected function _beforeSave() { try { $this->attrLockValidator->validate($this); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw new \Magento\Eav\Exception($exception->getMessage()); } @@ -164,7 +164,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object after save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { diff --git a/app/code/Magento/Catalog/Model/Factory.php b/app/code/Magento/Catalog/Model/Factory.php index 38c2b5947226e11cbc60ba3ece536af69a040d81..8e5b3c349b9737b32117245df81a4ea7025120ac 100644 --- a/app/code/Magento/Catalog/Model/Factory.php +++ b/app/code/Magento/Catalog/Model/Factory.php @@ -51,15 +51,15 @@ class Factory * * @param string $className * @param array $data - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $model = $this->_objectManager->create($className, $data); - if (!$model instanceof \Magento\Core\Model\AbstractModel) { - throw new \Magento\Core\Exception($className . ' doesn\'t extends \Magento\Core\Model\AbstractModel'); + if (!$model instanceof \Magento\Model\AbstractModel) { + throw new \Magento\Model\Exception($className . ' doesn\'t extends \Magento\Model\AbstractModel'); } return $model; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php index d181b17427e43a502afe951e42e8072d9d97403a..5617130859112e5e73cb7bb6b460e91343c4657f 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreGroup.php @@ -63,26 +63,26 @@ class StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $group) + protected function validate(\Magento\Model\AbstractModel $group) { return $group->dataHasChangedFor('root_category_id') && !$group->isObjectNew(); } /** - * @param \Magento\Core\Model\Resource\Db\AbstractDb $subject + * @param \Magento\Model\Resource\Db\AbstractDb $subject * @param callable $proceed - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function aroundSave( - \Magento\Core\Model\Resource\Db\AbstractDb $subject, + \Magento\Model\Resource\Db\AbstractDb $subject, \Closure $proceed, - \Magento\Core\Model\AbstractModel $group + \Magento\Model\AbstractModel $group ) { $needInvalidating = $this->validate($group); $objectResource = $proceed($group); diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php index 991cb873b4f5a51e32df4884efdecfb10ac276c9..0e204c22fa3a3c7bacc90657ddc27ed7c746fc94 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/Plugin/StoreView.php @@ -28,10 +28,10 @@ class StoreView extends StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $store + * @param \Magento\Model\AbstractModel $store * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $store) + protected function validate(\Magento\Model\AbstractModel $store) { return $store->isObjectNew() || $store->dataHasChangedFor('group_id'); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php index f8276ace12107f09bc1997b4f0cb4490aa3c77fc..ff94adbd78d8aff3d8cdd8c70d5c66b22a94f375 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php @@ -45,7 +45,7 @@ class Mode extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $flatIndexer * @param \Magento\Indexer\Model\Indexer\State $indexerState - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Mode extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $flatIndexer, \Magento\Indexer\Model\Indexer\State $indexerState, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php index a5011fafa7ca7c54196ae5c6e1e11c5162bbaaf5..d87e26c2ec1156f097283914f453f75514d24bbb 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreGroup.php @@ -52,15 +52,15 @@ class StoreGroup } /** - * @param \Magento\Core\Model\Resource\Db\AbstractDb $subject + * @param \Magento\Model\Resource\Db\AbstractDb $subject * @param callable $proceed - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return mixed */ public function aroundSave( - \Magento\Core\Model\Resource\Db\AbstractDb $subject, + \Magento\Model\Resource\Db\AbstractDb $subject, \Closure $proceed, - \Magento\Core\Model\AbstractModel $group + \Magento\Model\AbstractModel $group ) { $needInvalidating = $this->validate($group); $objectResource = $proceed($group); @@ -74,10 +74,10 @@ class StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $group) + protected function validate(\Magento\Model\AbstractModel $group) { return ($group->dataHasChangedFor( 'website_id' diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php index 2e681093fc6a405e4125d82818dd1f4580e1c5e2..e92ef304ea70c5c8cb639a71399d105e9e2d04d0 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Product/Plugin/StoreView.php @@ -28,10 +28,10 @@ class StoreView extends StoreGroup /** * Validate changes for invalidating indexer * - * @param \Magento\Core\Model\AbstractModel $store + * @param \Magento\Model\AbstractModel $store * @return bool */ - protected function validate(\Magento\Core\Model\AbstractModel $store) + protected function validate(\Magento\Model\AbstractModel $store) { return $store->isObjectNew() || $store->dataHasChangedFor('group_id'); } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php index 2ebe0aa2acd56c6a14c9327152f18735ac143566..41fbaf755d9b1dbd5372754607b36d21d73c5536 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Full.php @@ -48,7 +48,7 @@ class Full extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction $this->_reindex($store->getId()); } } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage(), $e->getCode(), $e); + throw new \Magento\Model\Exception($e->getMessage(), $e->getCode(), $e); } return $this; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php index 48cd61eba63c5bd63ac8e13f788c9f5b3516e962..8fa36ac3dbf04945697cc22b2f170d6daa0c25d7 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Row.php @@ -36,12 +36,12 @@ class Row extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction * * @param int|null $id * @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Row - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function execute($id = null) { if (!isset($id) || empty($id)) { - throw new \Magento\Core\Exception(__('Could not rebuild index for undefined product')); + throw new \Magento\Model\Exception(__('Could not rebuild index for undefined product')); } $ids = array($id); foreach ($this->_storeManager->getStores() as $store) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php index e93dfcb5620e9da03b748dd4bb54bad4e34524bb..04b903bb404138308ee64466606f5b5bfc4a6545 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Action/Rows.php @@ -38,12 +38,12 @@ class Rows extends \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction * @param array $ids * * @return \Magento\Catalog\Model\Indexer\Product\Flat\Action\Rows - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function execute($ids) { if (empty($ids)) { - throw new \Magento\Core\Exception(__('Bad value was supplied.')); + throw new \Magento\Model\Exception(__('Bad value was supplied.')); } foreach ($this->_storeManager->getStores() as $store) { $idsBatches = array_chunk($ids, \Magento\Catalog\Helper\Product\Flat\Indexer::BATCH_SIZE); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index a85036ee81acd26eac435daab22f1a03d63f4d36..6e13023565146f7dce3a78c955b33f0243d031b9 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -114,7 +114,7 @@ class FlatTableBuilder * * @param int|string $storeId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _createTemporaryFlatTable($storeId) { @@ -126,7 +126,7 @@ class FlatTableBuilder \Magento\Catalog\Model\Indexer\Product\Flat\AbstractAction::XML_NODE_MAX_INDEX_COUNT ); if ($maxIndex && count($indexesNeed) > $maxIndex) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( "The Flat Catalog module has a limit of %2\$d filterable and/or sortable attributes." . "Currently there are %1\$d of them." . diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php index cd238faf195c807a4752ad0be373b6fedb55b7b9..44f440b88e8b3d09c19c7a7455f2412f3afc1d8b 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/Store.php @@ -46,12 +46,12 @@ class Store * Before save handler * * @param \Magento\Core\Model\Resource\Store $subject - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeSave(\Magento\Core\Model\Resource\Store $subject, \Magento\Core\Model\AbstractModel $object) + public function beforeSave(\Magento\Core\Model\Resource\Store $subject, \Magento\Model\AbstractModel $object) { if (!$object->getId() || $object->dataHasChangedFor('group_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php index 35dd2d4f2d30c84701451da1f3dc9f80cb89e6f6..af276b43d15b1bd84bbac0ae94847d2925099803 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Plugin/StoreGroup.php @@ -46,14 +46,14 @@ class StoreGroup * Before save handler * * @param \Magento\Core\Model\Resource\Store\Group $subject - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeSave( \Magento\Core\Model\Resource\Store\Group $subject, - \Magento\Core\Model\AbstractModel $object + \Magento\Model\AbstractModel $object ) { if (!$object->getId() || $object->dataHasChangedFor('root_category_id')) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php index a7d2967e3ac5069f0cd64574df1fff0eb761261d..6cf3b61470880d95f875fa7674785e6026431be3 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/Processor.php @@ -33,7 +33,7 @@ class Processor const INDEXER_ID = 'catalog_product_flat'; /** - * @var \Magento\Indexer\Model\Indexer + * @var \Magento\Indexer\Model\IndexerInterface */ protected $_indexer; @@ -43,14 +43,14 @@ class Processor protected $_state; /** - * @param \Magento\Indexer\Model\Indexer $indexer + * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory * @param \Magento\Catalog\Model\Indexer\Product\Flat\State $state */ public function __construct( - \Magento\Indexer\Model\Indexer $indexer, + \Magento\Indexer\Model\IndexerFactory $indexerFactory, \Magento\Catalog\Model\Indexer\Product\Flat\State $state ) { - $this->_indexer = $indexer; + $this->_indexer = $indexerFactory->create(); $this->_state = $state; } diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php index d2dfcd325a381d63a5cbf7282b18330512bb2bf7..1b14af3e689ad4e3f373b7c6bbd4e56838f10670 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php @@ -45,7 +45,7 @@ class Mode extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor * @param \Magento\Indexer\Model\Indexer\State $indexerState - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Mode extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Indexer\Model\Indexer\State $indexerState, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php new file mode 100644 index 0000000000000000000000000000000000000000..24ca0a08bcc97f4cc95006c23180cc0cced89039 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRule.php @@ -0,0 +1,110 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; + +class CatalogRule +{ + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor + */ + protected $_processor; + + /** + * @param \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + */ + public function __construct( + \Magento\Catalog\Model\Indexer\Product\Price\Processor $processor + ) { + $this->_processor = $processor; + } + + /** + * Invalidate price indexer + * + * @param \Magento\CatalogRule\Model\Rule $subject + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterApplyAll(\Magento\CatalogRule\Model\Rule $subject) + { + $this->_processor->markIndexerAsInvalid(); + } + + /** + * Reindex price for affected product + * + * @param \Magento\CatalogRule\Model\Rule $subject + * @param callable $proceed + * @param int|\Magento\Catalog\Model\Product $product + * @param null|array $websiteIds + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundApplyToProduct( + \Magento\CatalogRule\Model\Rule $subject, + \Closure $proceed, + $product, + $websiteIds = null + ) { + $proceed($product, $websiteIds); + $this->_reindexProduct($product); + } + + /** + * Reindex price for affected product + * + * @param \Magento\CatalogRule\Model\Rule $subject + * @param callable $proceed + * @param int|\Magento\Catalog\Model\Product $product + * + * @return void + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundApplyAllRulesToProduct( + \Magento\CatalogRule\Model\Rule $subject, + \Closure $proceed, + $product + ) { + $proceed($product); + $this->_reindexProduct($product); + } + + /** + * Reindex product price + * + * @param int|\Magento\Catalog\Model\Product $product + * + * @return void + */ + protected function _reindexProduct($product) + { + $productId = is_numeric($product) ? $product : $product->getId(); + $this->_processor->reindexRow($productId); + } +} diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php index 311b4d3e8bf42deede05f6a8d2d7d0b660603a98..cac8406b519355ae91750a7200f5875353de6092 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php @@ -23,29 +23,31 @@ */ namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + class CustomerGroup extends AbstractPlugin { /** - * @param \Magento\Customer\Model\Resource\Group $subject - * @param \Magento\Customer\Model\Resource\Group $result - * @return \Magento\Customer\Model\Resource\Group + * @param CustomerGroupServiceInterface $subject + * @param string $result + * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDelete(\Magento\Customer\Model\Resource\Group $subject, $result) + public function afterSaveGroup(CustomerGroupServiceInterface $subject, $result) { $this->invalidateIndexer(); return $result; } /** - * @param \Magento\Customer\Model\Resource\Group $subject - * @param \Magento\Customer\Model\Resource\Group $result - * @return \Magento\Customer\Model\Resource\Group + * @param CustomerGroupServiceInterface $subject + * @param string $result + * @return string * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterSave(\Magento\Customer\Model\Resource\Group $subject, $result) + public function afterDeleteGroup(CustomerGroupServiceInterface $subject, $result) { $this->invalidateIndexer(); return $result; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php index cd9dcddfe9c01552123d54303373c26673f37f6c..5b62c15e00111be5df4b67565dd96626729c4c14 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Processor.php @@ -38,11 +38,12 @@ class Processor protected $_indexer; /** - * @param \Magento\Indexer\Model\IndexerInterface $indexer + * @param \Magento\Indexer\Model\IndexerFactory $indexerFactory */ - public function __construct(\Magento\Indexer\Model\IndexerInterface $indexer) - { - $this->_indexer = $indexer; + public function __construct( + \Magento\Indexer\Model\IndexerFactory $indexerFactory + ) { + $this->_indexer = $indexerFactory->create(); } /** diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php index d05003eb8430c3c3ba9fa563d2e8b16d43de5ce7..e9c45da962841b8b6286d38732bc4dd333260e63 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php @@ -39,7 +39,7 @@ class PriceScope extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Indexer\Model\IndexerInterface $indexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -49,7 +49,7 @@ class PriceScope extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Indexer\Model\IndexerInterface $indexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Indexer/Url.php b/app/code/Magento/Catalog/Model/Indexer/Url.php index baa7ccdfeffc46480a2493fef1c2f3fc64e6c64c..251c76ba61191f86407c68333291c8280e806a80 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Url.php +++ b/app/code/Magento/Catalog/Model/Indexer/Url.php @@ -87,7 +87,7 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory * @param \Magento\Catalog\Model\Url $catalogUrl - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,7 +96,7 @@ class Url extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Registry $registry, \Magento\Catalog\Model\Resource\UrlFactory $catalogResourceUrlFactory, \Magento\Catalog\Model\Url $catalogUrl, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Layer.php b/app/code/Magento/Catalog/Model/Layer.php index ce9ba6cfccc77992e94d7993082f2be9fa9ea802..69b1f01098de31f5d4f404a3a58daa5fcd5d5a49 100644 --- a/app/code/Magento/Catalog/Model/Layer.php +++ b/app/code/Magento/Catalog/Model/Layer.php @@ -226,7 +226,7 @@ class Layer extends \Magento\Object * * @param mixed $category * @return \Magento\Catalog\Model\Layer - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setCurrentCategory($category) { @@ -234,12 +234,12 @@ class Layer extends \Magento\Object $category = $this->_categoryFactory->create()->load($category); } if (!$category instanceof \Magento\Catalog\Model\Category) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The category must be an instance of \Magento\Catalog\Model\Category.') ); } if (!$category->getId()) { - throw new \Magento\Core\Exception(__('Please correct the category.')); + throw new \Magento\Model\Exception(__('Please correct the category.')); } if ($category->getId() != $this->getCurrentCategory()->getId()) { diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php index 30097a7c89f298c8cd39c3cba0d5de18a855af02..66424e85424d9375460a03749d73046ac3182de3 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php @@ -276,13 +276,13 @@ abstract class AbstractFilter extends \Magento\Object * Get attribute model associated with filter * * @return \Magento\Catalog\Model\Resource\Eav\Attribute - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAttributeModel() { $attribute = $this->getData('attribute_model'); if (is_null($attribute)) { - throw new \Magento\Core\Exception(__('The attribute model is not defined.')); + throw new \Magento\Model\Exception(__('The attribute model is not defined.')); } return $attribute; } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php b/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php index 90935eb20b9fad97a9abe77ae56a2ffde1a862b2..6e1fe21ee8638e9e43d95af6f98c16661e69ce33 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Layer\Filter\Attribute - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $filter = $this->_objectManager->create($className, $data); if (!$filter instanceof \Magento\Catalog\Model\Layer\Filter\AbstractFilter) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter' ); } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php index 423a359cbb53bb56b9dfa2994693375d6b50c3a3..35cdacd08422258c75acdb442d9be1a503048436 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Item.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Item.php @@ -70,13 +70,13 @@ class Item extends \Magento\Object * Get filter instance * * @return \Magento\Catalog\Model\Layer\Filter\AbstractFilter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getFilter() { $filter = $this->getData('filter'); if (!is_object($filter)) { - throw new \Magento\Core\Exception(__('The filter must be an object. Please set correct filter.')); + throw new \Magento\Model\Exception(__('The filter must be an object. Please set correct filter.')); } return $filter; } diff --git a/app/code/Magento/Catalog/Model/Layer/State.php b/app/code/Magento/Catalog/Model/Layer/State.php index 446b5e06e56184b52eaf8f987fbf9ecec2072125..0e519dd5b4a8c2189d4ef03fc0b6b0a052c15b56 100644 --- a/app/code/Magento/Catalog/Model/Layer/State.php +++ b/app/code/Magento/Catalog/Model/Layer/State.php @@ -53,12 +53,12 @@ class State extends \Magento\Object * * @param array $filters * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setFilters($filters) { if (!is_array($filters)) { - throw new \Magento\Core\Exception(__('The filters must be an array.')); + throw new \Magento\Model\Exception(__('The filters must be an array.')); } $this->setData('filters', $filters); return $this; diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 6ecea966a81aad9ec7a9378a7bbf8b5cf99afa9b..abafa246bb6d8a16335b2cacb0bb6f74b99268d3 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -522,7 +522,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O */ public function getCategoryId() { - $category = $this->_coreRegistry->registry('current_category'); + $category = $this->_registry->registry('current_category'); if ($category) { return $category->getId(); } @@ -773,7 +773,6 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements \Magento\O */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->cleanCache(); $this->_indexIndexer->logEvent($this, self::ENTITY, \Magento\Index\Model\Event::TYPE_DELETE); return parent::_beforeDelete(); diff --git a/app/code/Magento/Catalog/Model/Product/Action.php b/app/code/Magento/Catalog/Model/Product/Action.php index a62bbfc972050d34ae9ba21ad277f38414fe5861..785b93ececca96322473c83386349d82afdbc17b 100644 --- a/app/code/Magento/Catalog/Model/Product/Action.php +++ b/app/code/Magento/Catalog/Model/Product/Action.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Action extends \Magento\Core\Model\AbstractModel +class Action extends \Magento\Model\AbstractModel { /** * Index indexer @@ -59,7 +59,7 @@ class Action extends \Magento\Core\Model\AbstractModel * @param \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory * @param \Magento\Index\Model\Indexer $indexIndexer * @param \Magento\Indexer\Model\IndexerInterface $categoryIndexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Action extends \Magento\Core\Model\AbstractModel \Magento\Catalog\Model\Product\WebsiteFactory $productWebsiteFactory, \Magento\Index\Model\Indexer $indexIndexer, \Magento\Indexer\Model\IndexerInterface $categoryIndexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index 554c86de98465ad5386a5704109a585625821d6f..d2fdecefd4bdba498fd3b35e9f0e60893887d806 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -18,23 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice; +use Magento\Catalog\Model\Product\Attribute\Backend\Price; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Catalog product abstract group price backend attribute model - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice; - -abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Price +abstract class AbstractGroupprice extends Price { /** * Website currency codes and rates @@ -147,7 +142,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu * Validate group price data * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -172,7 +167,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu ) ); if (isset($duplicates[$compare])) { - throw new \Magento\Core\Exception($this->_getDuplicateErrorMessage()); + throw new \Magento\Model\Exception($this->_getDuplicateErrorMessage()); } $duplicates[$compare] = true; } @@ -213,7 +208,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu $websiteCurrency = $rates[$priceRow['website_id']]['code']; if ($baseCurrency == $websiteCurrency && isset($duplicates[$globalCompare])) { - throw new \Magento\Core\Exception($this->_getDuplicateErrorMessage()); + throw new \Magento\Model\Exception($this->_getDuplicateErrorMessage()); } } @@ -271,7 +266,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu foreach ($data as $k => $v) { $data[$k]['website_price'] = $v['price']; if ($v['all_groups']) { - $data[$k]['cust_group'] = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $data[$k]['cust_group'] = CustomerGroupServiceInterface::CUST_GROUP_ALL; } } @@ -356,7 +351,7 @@ abstract class AbstractGroupprice extends \Magento\Catalog\Model\Product\Attribu array_merge(array($data['website_id'], $data['cust_group']), $this->_getAdditionalUniqueFields($data)) ); - $useForAllGroups = $data['cust_group'] == \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $useForAllGroups = $data['cust_group'] == CustomerGroupServiceInterface::CUST_GROUP_ALL; $customerGroupId = !$useForAllGroups ? $data['cust_group'] : 0; $new[$key] = array_merge( diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php index ff97bab8b937c9ce4ff479d849196ed28301e9d2..f12421e52d67b8aa41cd6c8397af70519fac8e99 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Media.php @@ -33,7 +33,7 @@ */ namespace Magento\Catalog\Model\Product\Attribute\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; class Media extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php index 33cd75399db03f585c2c55dbefd6dca8718eb049..eebc0c6fa7ecb2d7976f2cd4ca0915ca415f0119 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Price.php @@ -164,7 +164,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -175,7 +175,7 @@ class Price extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } if (!preg_match('/^\d*(\.|,)?\d{0,4}$/i', $value) || $value < 0) { - throw new \Magento\Core\Exception(__('Please enter a number 0 or greater in this field.')); + throw new \Magento\Model\Exception(__('Please enter a number 0 or greater in this field.')); } return true; diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php index 14c290269dfdf63b9d9b97ac677caab9485c6f07..96092d099307ea8fa107914ce9c5430115a0746e 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Sku.php @@ -65,7 +65,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate SKU * * @param Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -77,7 +77,7 @@ class Sku extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend } if ($this->string->strlen($object->getSku()) > self::SKU_MAX_LENGTH) { - throw new \Magento\Core\Exception(__('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH)); + throw new \Magento\Model\Exception(__('SKU length should be %1 characters maximum.', self::SKU_MAX_LENGTH)); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php index bbef2afae0ce897f5859e42d9d0221b46c907fa5..4c17cc120ac301874cc71316b766a63888349bac 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php @@ -99,7 +99,7 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -107,7 +107,7 @@ class Stock extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if (!empty($value['qty']) && !preg_match('/^-?\d*(\.|,)?\d{0,4}$/i', $value['qty'])) { - throw new \Magento\Core\Exception(__('Please enter a valid number in this field.')); + throw new \Magento\Model\Exception(__('Please enter a valid number in this field.')); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php index c5c6855d2b04380e9ccbb03b4b4f9fb73dcc66aa..3759b25d60a1e348fb6b434b4bc9624b5b1d4d56 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Weight.php @@ -40,7 +40,7 @@ class Weight extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend * Validate * * @param \Magento\Catalog\Model\Product $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validate($object) @@ -48,7 +48,7 @@ class Weight extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend $attrCode = $this->getAttribute()->getAttributeCode(); $value = $object->getData($attrCode); if (!empty($value) && !\Zend_Validate::is($value, 'Between', array('min' => 0, 'max' => 99999999.9999))) { - throw new \Magento\Core\Exception(__('Please enter a number 0 or greater in this field.')); + throw new \Magento\Model\Exception(__('Please enter a number 0 or greater in this field.')); } return true; } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php index f42959eb9403a577f74a81bdbad47073c0174dcf..7d2b37210673a242cbf36714b1780974eefd10da 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php @@ -39,7 +39,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -47,7 +47,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index 26f2482e0b7ae80c650846154d7ae44d075cdcd5..9a82598ac7fa11d987f27ef54d11794a926871ff 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -37,12 +37,8 @@ use Magento\Catalog\Model\Product; * @method \Magento\Catalog\Model\Product\Compare\Item setProductId(int $value) * @method int getStoreId() * @method \Magento\Catalog\Model\Product\Compare\Item setStoreId(int $value) - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Item extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * Model cache tag @@ -100,7 +96,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ * @param \Magento\Log\Model\Visitor $logVisitor * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -111,7 +107,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ \Magento\Log\Model\Visitor $logVisitor, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -157,18 +153,6 @@ class Item extends \Magento\Core\Model\AbstractModel implements \Magento\Object\ return $this; } - /** - * Add customer data from customer object - * - * @param \Magento\Customer\Model\Customer $customer - * @return $this - */ - public function addCustomerData(\Magento\Customer\Model\Customer $customer) - { - $this->setCustomerId($customer->getId()); - return $this; - } - /** * Set visitor * diff --git a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php index 2fd77cdb824ed6852cefe8c9f987963d4fbe2fac..c5cd7bdb0701ea2a5ba2d6ac2ef5048d5f2f17eb 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/ListCompare.php @@ -172,7 +172,7 @@ class ListCompare extends \Magento\Object { $item->addVisitorId($this->_logVisitor->getId()); if ($this->_customerSession->isLoggedIn()) { - $item->addCustomerData($this->_customerSession->getCustomer()); + $item->setCustomerId($this->_customerSession->getCustomerId()); } return $this; @@ -187,6 +187,6 @@ class ListCompare extends \Magento\Object */ public function hasItems($customerId, $visitorId) { - return $this->_catalogProductCompareItem->getCount($customerId, $visitorId); + return (bool)$this->_catalogProductCompareItem->getCount($customerId, $visitorId); } } diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 4bb7bd5138566fad327ec66692c2a5db3657ec51..806803108d4fc89a8708a23b59979833dfb0b254 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -36,7 +36,7 @@ namespace Magento\Catalog\Model\Product; use Magento\Core\Model\Store; use Magento\Image as MagentoImage; -class Image extends \Magento\Core\Model\AbstractModel +class Image extends \Magento\Model\AbstractModel { /** * @var int @@ -192,7 +192,7 @@ class Image extends \Magento\Core\Model\AbstractModel * @param \Magento\View\Url $viewUrl * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -207,7 +207,7 @@ class Image extends \Magento\Core\Model\AbstractModel \Magento\View\Url $viewUrl, \Magento\View\FileSystem $viewFileSystem, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php index 5528e70829055afe78bce82f6fb43f00d37f82cb..8a6c47270bb186d2cb0da1431a3caa102f480309 100644 --- a/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php +++ b/app/code/Magento/Catalog/Model/Product/Indexer/Eav.php @@ -67,7 +67,7 @@ class Eav extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -75,7 +75,7 @@ class Eav extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Link.php b/app/code/Magento/Catalog/Model/Product/Link.php index d65f0c7be084e5bb322ec805eb0c484d01e9d73e..41a1d3d46c693ba7f9d2fdd4a27d4f5282dcc706 100644 --- a/app/code/Magento/Catalog/Model/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Product/Link.php @@ -44,7 +44,7 @@ use Magento\Catalog\Model\Resource\Product\Link\Product\Collection as ProductCol * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { const LINK_TYPE_RELATED = 1; @@ -76,7 +76,7 @@ class Link extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory * @param \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -85,7 +85,7 @@ class Link extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Link\CollectionFactory $linkCollectionFactory, \Magento\Catalog\Model\Resource\Product\Link\Product\CollectionFactory $productCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index 45eaf6499a0be6f7ef072341bf7a8b68aac26f91..ae31863b036edaca45ce11a5044154bd911583f1 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -27,8 +27,8 @@ namespace Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Resource\Product\Option\Value\Collection; -use Magento\Core\Exception; -use Magento\Core\Model\AbstractModel; +use Magento\Model\Exception; +use Magento\Model\AbstractModel; /** * Catalog product option model @@ -127,7 +127,7 @@ class Option extends AbstractModel * @param Option\Value $productOptionValue * @param \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -137,7 +137,7 @@ class Option extends AbstractModel Option\Value $productOptionValue, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -150,7 +150,7 @@ class Option extends AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php index f133ebd4dc25c5ae747120479ea9c465b9f6a2ff..8adc72f513368b8a11cefb362d775a52d2d0952c 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -65,7 +65,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * * @param array $values All product option values, i.e. array (option_id => mixed, option_id => mixed...) * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateUserValue($values) { @@ -120,11 +120,11 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType } elseif (!$isValid && $option->getIsRequire() && !$this->getSkipCheckRequiredOption()) { $this->setIsValid(false); if (!$dateValid) { - throw new \Magento\Core\Exception(__('Please specify date required option(s).')); + throw new \Magento\Model\Exception(__('Please specify date required option(s).')); } elseif (!$timeValid) { - throw new \Magento\Core\Exception(__('Please specify time required option(s).')); + throw new \Magento\Model\Exception(__('Please specify time required option(s).')); } else { - throw new \Magento\Core\Exception(__('Please specify the product\'s required option(s).')); + throw new \Magento\Model\Exception(__('Please specify the product\'s required option(s).')); } } else { $this->setUserValue(null); @@ -138,7 +138,7 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * Prepare option value for cart * * @return string|null Prepared option value - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareForCart() { diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php index 4976f5f79b96d502ccffe032a62bb7824fb3171e..15e470002669998ec144b49b27f44a2a12544e1f 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/DefaultType.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option default type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php index f04f10a391fac2144b244517ae5fb965433a7e69..d8bf51a94bcfc67eba526dc55da139ba1e62034f 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Option\Type\DefaultType - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $option = $this->_objectManager->create($className, $data); if (!$option instanceof \Magento\Catalog\Model\Product\Option\Type\DefaultType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Option\Type\DefaultType' ); } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index e54d6a2ea223fe72076484320aa3c8440e8240e0..e327c3609be7217cde29b566765823a5ae8b6070 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option file type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php index 9ffbbbca39410d2ce22e7f27f0cde26e6da1524f..e239ae4acc1da7cfb89f77251f22811144c6fcef 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option select type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php index f8e14be6e552089fbb435d0ca41704f4bc4b42da..2ef030b0f46084318f80a883476647cfd2e5b6ee 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Text.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product\Option\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog product option text type diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index ce11e11dd21cff93054f2ff0e9f842ffa80f047f..3a1992c8c58b1882cb9557b64c1decc4e0c13b5e 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -42,7 +42,7 @@ use Magento\Catalog\Model\Product\Option; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Value extends \Magento\Core\Model\AbstractModel +class Value extends \Magento\Model\AbstractModel { /** * @var array @@ -70,7 +70,7 @@ class Value extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -78,7 +78,7 @@ class Value extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index d0063929fe90a92a0304d5c7c7d417a5b9b5a463..1e19df3bfa6578ae359d4bbd92e163755d3d9290 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -381,7 +381,7 @@ abstract class AbstractType // try to add custom options try { $options = $this->_prepareOptions($buyRequest, $product, $processMode); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { return $e->getMessage(); } @@ -488,7 +488,7 @@ abstract class AbstractType * Process File Queue * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function processFileQueue() { @@ -511,7 +511,7 @@ abstract class AbstractType $rootDir = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::ROOT_DIR); $rootDir->create($rootDir->getRelativePath($path)); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __("We can't create writeable directory \"%1\".", $path) ); } @@ -525,7 +525,7 @@ abstract class AbstractType if (isset($queueOptions['option'])) { $queueOptions['option']->setIsValid(false); } - throw new \Magento\Core\Exception(__("The file upload failed.")); + throw new \Magento\Model\Exception(__("The file upload failed.")); } $this->_fileStorageDb->saveFile($dst); break; @@ -620,7 +620,7 @@ abstract class AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -630,7 +630,7 @@ abstract class AbstractType $customOption = $product->getCustomOption(self::OPTION_PREFIX . $option->getId()); if (!$customOption || strlen($customOption->getValue()) == 0) { $product->setSkipCheckRequiredOption(true); - throw new \Magento\Core\Exception(__('The product has required options.')); + throw new \Magento\Model\Exception(__('The product has required options.')); } } } @@ -1045,7 +1045,7 @@ abstract class AbstractType if (is_string($result)) { $errors[] = $result; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $errors[] = $e->getMessages(); } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Catalog/Model/Product/Type/Pool.php b/app/code/Magento/Catalog/Model/Product/Type/Pool.php index 2b5a6af2f5a85b14406a7c1c9114730c925630a1..6b844d3c8d0924672a043a00cc2abf019ea54517 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Pool.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Pool.php @@ -52,14 +52,14 @@ class Pool * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Type\AbstractType - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function get($className, array $data = array()) { $product = $this->_objectManager->get($className, $data); if (!$product instanceof \Magento\Catalog\Model\Product\Type\AbstractType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Type\AbstractType' ); } diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php old mode 100644 new mode 100755 index b4908c97ac6a5b17fbc5ee923dddbdbb6e8818d8..5965d59c7b417a474baf2e1833dc7b735d154c59 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -250,7 +250,7 @@ class Price */ public function getTierPrice($qty, $product) { - $allGroups = \Magento\Customer\Model\Group::CUST_GROUP_ALL; + $allGroups = \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL; $prices = $product->getData('tier_price'); if (is_null($prices)) { diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php b/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php index 341760321953c214498f56a3dc96112da54830bf..7bc114f121f0982383c14a703491d0ebb8d8eb69 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Catalog\Model\Product\Type\Price - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $price = $this->_objectManager->create($className, $data); if (!$price instanceof \Magento\Catalog\Model\Product\Type\Price) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( $className . ' doesn\'t extends \Magento\Catalog\Model\Product\Type\Price' ); } diff --git a/app/code/Magento/Catalog/Model/Product/Url.php b/app/code/Magento/Catalog/Model/Product/Url.php index 02181f016d2a685ac7fa76a47aed3d47013c889a..90f2a85d9f2cfa02751d573fa4ed917b03fe869b 100644 --- a/app/code/Magento/Catalog/Model/Product/Url.php +++ b/app/code/Magento/Catalog/Model/Product/Url.php @@ -191,7 +191,7 @@ class Url extends \Magento\Object * @param \Magento\Catalog\Model\Category $category * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getUrlPath($product, $category = null) { @@ -201,7 +201,7 @@ class Url extends \Magento\Object /** @todo get default category */ return $path; } elseif (!$category instanceof \Magento\Catalog\Model\Category) { - throw new \Magento\Core\Exception('Invalid category object supplied'); + throw new \Magento\Model\Exception('Invalid category object supplied'); } return $this->_catalogCategory->getCategoryUrlPath($category->getUrlPath()) . '/' . $path; diff --git a/app/code/Magento/Catalog/Model/Product/Website.php b/app/code/Magento/Catalog/Model/Product/Website.php index 36777346b576286029e8ad65ac1b54ddd4bc9703..152fa844000356ecd7d93a210d589cde4f83ce30 100644 --- a/app/code/Magento/Catalog/Model/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Product/Website.php @@ -39,7 +39,7 @@ */ namespace Magento\Catalog\Model\Product; -class Website extends \Magento\Core\Model\AbstractModel +class Website extends \Magento\Model\AbstractModel { /** * Initialize resource model @@ -67,14 +67,14 @@ class Website extends \Magento\Core\Model\AbstractModel * @param array $websiteIds * @param array $productIds * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function removeProducts($websiteIds, $productIds) { try { $this->_getResource()->removeProducts($websiteIds, $productIds); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong removing products from the websites.')); + throw new \Magento\Model\Exception(__('Something went wrong removing products from the websites.')); } return $this; } @@ -85,14 +85,14 @@ class Website extends \Magento\Core\Model\AbstractModel * @param array $websiteIds * @param array $productIds * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProducts($websiteIds, $productIds) { try { $this->_getResource()->addProducts($websiteIds, $productIds); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong adding products to websites.')); + throw new \Magento\Model\Exception(__('Something went wrong adding products to websites.')); } return $this; } diff --git a/app/code/Magento/Catalog/Model/Resource/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Attribute.php index 5ef305ec8e30b4a771958cc008e008f631707a2b..173d6d46c2e7d663ae11f8b0e6f342e650a621ba 100644 --- a/app/code/Magento/Catalog/Model/Resource/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Attribute.php @@ -70,10 +70,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $applyTo = $object->getApplyTo(); if (is_array($applyTo)) { @@ -85,10 +85,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_clearUselessAttributeValues($object); return parent::_afterSave($object); @@ -97,10 +97,10 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Clear useless attribute values * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _clearUselessAttributeValues(\Magento\Core\Model\AbstractModel $object) + protected function _clearUselessAttributeValues(\Magento\Model\AbstractModel $object) { $origData = $object->getOrigData(); @@ -125,11 +125,11 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute /** * Delete entity * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function deleteEntity(\Magento\Core\Model\AbstractModel $object) + public function deleteEntity(\Magento\Model\AbstractModel $object) { if (!$object->getEntityAttributeId()) { return $this; @@ -151,8 +151,8 @@ class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute try { $this->attrLockValidator->validate($attribute, $result['attribute_set_id']); - } catch (\Magento\Core\Exception $exception) { - throw new \Magento\Core\Exception( + } catch (\Magento\Model\Exception $exception) { + throw new \Magento\Model\Exception( __("Attribute '%1' is locked. ", $attribute->getAttributeCode()) . $exception->getMessage() ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php index a841b9613be4ee937cc0a086f0a1bac562367444..7c76bcde49ae6c8f63df47623ccc8dde9eba2c11 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php index 47ae821e0b50f769f75bd0ff9789afe6ac4f6078..01fffa83ae84e24402cc9b824190ac7f2b6ee7d8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Category\Flat; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -78,7 +78,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Config.php b/app/code/Magento/Catalog/Model/Resource/Config.php index f53bd5d870bb06cbc5730826bf3b9435f868cd57..d8ebeaf670b97957463c731c453cd66bca93fbf9 100644 --- a/app/code/Magento/Catalog/Model/Resource/Config.php +++ b/app/code/Magento/Catalog/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * catalog_product entity type id diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php index bfcad10cf5ff689f09ca45c9c0030429193899e8..69d86627aede42155fb723891094a7e7e026c3b1 100644 --- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php @@ -142,7 +142,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * @param \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor * @param \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper * @param LockValidatorInterface $lockValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -162,7 +162,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute \Magento\Catalog\Model\Indexer\Product\Flat\Processor $productFlatIndexerProcessor, \Magento\Catalog\Helper\Product\Flat\Indexer $productFlatIndexerHelper, LockValidatorInterface $lockValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -199,8 +199,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object before save data * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -212,8 +212,8 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute if ($this->_data['is_global'] != $this->_origData['is_global']) { try { $this->attrLockValidator->validate($this); - } catch (\Magento\Core\Exception $exception) { - throw new \Magento\Core\Exception(__('Do not change the scope. ' . $exception->getMessage())); + } catch (\Magento\Model\Exception $exception) { + throw new \Magento\Model\Exception(__('Do not change the scope. ' . $exception->getMessage())); } } } @@ -233,7 +233,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * Processing object after save data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { @@ -273,7 +273,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute * Register indexing event before delete catalog eav attribute * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeDelete() { diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php index 5c3b5c04ebd210f9e17b11dd09722573873be73c..ccff61097effca0bd0a0d0c478e13c8fa251b01e 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table name diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php index e8d635c8914c940672caa138e4b38ec99e432a4a..f35a2fa8d4ead20c016e5823da4a4828bc95042a 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Decimal extends \Magento\Core\Model\Resource\Db\AbstractDb +class Decimal extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table name diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php index 481031a9ce92fd77e656677060fcd132f6a85c10..5e8196ca77657eebf95750ff0a1cc6eb2ba5481b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Layer\Filter; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Price extends \Magento\Core\Model\Resource\Db\AbstractDb +class Price extends \Magento\Model\Resource\Db\AbstractDb { /** * Minimal possible price diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index 15fd3bb9d9d7521a834ccd29d4d6a324ecc0aa64..68373ad56ad7743357908eba9493abf669a64d12 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -34,7 +34,7 @@ */ namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice; -abstract class AbstractGroupprice extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractGroupprice extends \Magento\Model\Resource\Db\AbstractDb { /** * Load Tier Prices for product diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php index 8575bffecbb48d40b7bda81e9c8a53e4e5459f8f..c4f0ea1f3ef1261f05a1a41bfe30d0be567ebab8 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Attribute\Backend; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Media extends \Magento\Core\Model\Resource\Db\AbstractDb +class Media extends \Magento\Model\Resource\Db\AbstractDb { const GALLERY_TABLE = 'catalog_product_entity_media_gallery'; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php index d82f3b79011752c2ca5ed6996a4617a63710597a..80b616fe095946c85565e9eb05f4d9189eeb0d73 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection \Magento\Event\ManagerInterface $eventManager, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index eaae6b81edb21a850efb491987fae6869e701525..aa09cb3ea8785e3378456d2b3adf0981bab4133f 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -27,6 +27,7 @@ namespace Magento\Catalog\Model\Resource\Product; use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; use Magento\Core\Model\Store; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Product collection @@ -513,7 +514,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl */ public function setEntity($entity) { - if ($this->isEnabledFlat() && $entity instanceof \Magento\Core\Model\Resource\Db\AbstractDb) { + if ($this->isEnabledFlat() && $entity instanceof \Magento\Model\Resource\Db\AbstractDb) { $this->_entity = $entity; return $this; } @@ -2075,10 +2076,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl foreach ($adapter->fetchAll($select) as $row) { $tierPrices[$row['product_id']][] = array( 'website_id' => $row['website_id'], - 'cust_group' => $row['all_groups'] ? \Magento\Customer\Model\Group::CUST_GROUP_ALL : $row['cust_group'], + 'cust_group' => $row['all_groups'] ? CustomerGroupServiceInterface::CUST_GROUP_ALL : $row['cust_group'], 'price_qty' => $row['price_qty'], 'price' => $row['price'], - 'website_price' => $row['price'] + 'website_price' => $row['price'], + ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php index 87d8ea239791e29c2aac2fb14aa7a19d40778ec4..5fc1b3d9d9a7363439d40c6ce8dc49631c05d66f 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Compare; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php index 5c7bc4f389c57f81d37dfb080674e64439110c2e..c6ec3435ecfb955c904fb88a33d9bf1a3dafaa42 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Flat.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Store; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Flat extends \Magento\Core\Model\Resource\Db\AbstractDb +class Flat extends \Magento\Model\Resource\Db\AbstractDb { /** * Store scope Id diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php index 5d2a6d39bf9dc33b81babeebd71ca0a5dd9bf9f9..9ce0342ff060b3c8fd5db1a09ee747e130a5e835 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Indexer/Eav.php @@ -104,13 +104,13 @@ class Eav extends AbstractIndexer * * @param string $type * @return \Magento\Catalog\Model\Resource\Product\Indexer\Eav\AbstractEav - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getIndexer($type) { $indexers = $this->getIndexers(); if (!isset($indexers[$type])) { - throw new \Magento\Core\Exception(__('We found an unknown EAV indexer type "%1".', $type)); + throw new \Magento\Model\Exception(__('We found an unknown EAV indexer type "%1".', $type)); } return $indexers[$type]; } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link.php b/app/code/Magento/Catalog/Model/Resource/Product/Link.php index 917ea73a121e3b9f1d7453ff20c0a6ceeaa6c986..ef919978887c14f91b18a53eda2da4216745db42 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Product Link Attributes Table diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php index 8dd97a7f373a1c894f7119622e547664d92230b1..9b8997e84bc1e2d526fbf5466c5458a09e0e7bbf 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Link/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Link; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Product object diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option.php b/app/code/Magento/Catalog/Model/Resource/Product/Option.php index 63226107ff41df0b57f7f528ff72f2aa0afea731..a43c43a9df61d29a3b8214232be602014f458753 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager @@ -88,10 +88,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save options store data * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -102,10 +102,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save value prices * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _saveValuePrices(\Magento\Core\Model\AbstractModel $object) + protected function _saveValuePrices(\Magento\Model\AbstractModel $object) { $priceTable = $this->getTable('catalog_product_option_price'); $readAdapter = $this->_getReadAdapter(); @@ -247,10 +247,10 @@ class Option extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save titles * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValueTitles(\Magento\Core\Model\AbstractModel $object) + protected function _saveValueTitles(\Magento\Model\AbstractModel $object) { $readAdapter = $this->_getReadAdapter(); $writeAdapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php index 10cd58a012f5d1e28f51aa705c52467e590fa5d6..8662843eed807745091776dbbbf4fb6fb92ec5ad 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store manager @@ -54,7 +54,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $optionValueCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_optionValueCollectionFactory = $optionValueCollectionFactory; $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php index bf3c0d2ef687a2aad2695a2a3e3bae88083ebd4b..fbb6d6b259d61facfdd069d83c01040a362ddd0b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Value extends \Magento\Core\Model\Resource\Db\AbstractDb +class Value extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager @@ -89,10 +89,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb * Proceed operations after object is saved * Save options store data * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $this->_saveValuePrices($object); $this->_saveValueTitles($object); @@ -103,10 +103,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save option value price data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValuePrices(\Magento\Core\Model\AbstractModel $object) + protected function _saveValuePrices(\Magento\Model\AbstractModel $object) { $priceTable = $this->getTable('catalog_product_option_type_price'); @@ -215,10 +215,10 @@ class Value extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save option value title data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _saveValueTitles(\Magento\Core\Model\AbstractModel $object) + protected function _saveValueTitles(\Magento\Model\AbstractModel $object) { $titleTable = $this->getTable('catalog_product_option_type_title'); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php index 2d959f27ef22d329f8961c7bc310d1e039ff5311..a540942437eda0abe1dc43648f66a78def260975 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Option/Value/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product\Option\Value; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Relation.php b/app/code/Magento/Catalog/Model/Resource/Product/Relation.php index c0ba908d23752a3a5dbd7bef985ce3f18653054d..cb3e915dec7ed5a9f76a21a40ec3d1376bab38bf 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Relation.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Relation.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource\Product; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Relation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Relation extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model and define main table diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Website.php b/app/code/Magento/Catalog/Model/Resource/Product/Website.php index e8783e99666d3bc687572d3826c9ce98adc64e25..e126fb05668cbcf92eec948ffa20a80ede0dba8d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Website.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Website.php @@ -26,7 +26,7 @@ namespace Magento\Catalog\Model\Resource\Product; /** * Catalog Product Website Resource Model */ -class Website extends \Magento\Core\Model\Resource\Db\AbstractDb +class Website extends \Magento\Model\Resource\Db\AbstractDb { /** * Store manager diff --git a/app/code/Magento/Catalog/Model/Resource/Url.php b/app/code/Magento/Catalog/Model/Resource/Url.php index b967fb03530b962c696d5a920ed02c389970d076..71b468b41de1fe262622cb4f73ab28391ecbd62d 100644 --- a/app/code/Magento/Catalog/Model/Resource/Url.php +++ b/app/code/Magento/Catalog/Model/Resource/Url.php @@ -32,7 +32,7 @@ namespace Magento\Catalog\Model\Resource; * @package Magento_Catalog * @author Magento Core Team <core@magentocommerce.com> */ -class Url extends \Magento\Core\Model\Resource\Db\AbstractDb +class Url extends \Magento\Model\Resource\Db\AbstractDb { /** * Stores configuration array @@ -358,7 +358,7 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb * @param array $rewriteData * @param int|\Magento\Object $rewrite * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRewrite($rewriteData, $rewrite) { @@ -367,7 +367,7 @@ class Url extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->insertOnDuplicate($this->getMainTable(), $rewriteData); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong saving the URL rewite.')); + throw new \Magento\Model\Exception(__('Something went wrong saving the URL rewite.')); } if ($rewrite && $rewrite->getId()) { diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index f5427e9c804bf31a8513573666a8f54c8b7d1117..79337d55bed236038d38971112323a71cdc5ce35 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -44,7 +44,7 @@ class Suffix extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -54,7 +54,7 @@ class Suffix extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\Url\Rewrite $coreUrlRewrite, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Template/Filter/Factory.php b/app/code/Magento/Catalog/Model/Template/Filter/Factory.php index 4c01c84adaeb053b2155e8361a41c37d1036d8ce..f77945d01795dcd0fb1b6a212b2d2c977b9e9fb3 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter/Factory.php +++ b/app/code/Magento/Catalog/Model/Template/Filter/Factory.php @@ -52,14 +52,14 @@ class Factory * @param string $className * @param array $data * @return \Magento\Filter\Template - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, array $data = array()) { $filter = $this->_objectManager->create($className, $data); if (!$filter instanceof \Magento\Filter\Template) { - throw new \Magento\Core\Exception($className . ' doesn\'t extends \Magento\Filter\Template'); + throw new \Magento\Model\Exception($className . ' doesn\'t extends \Magento\Filter\Template'); } return $filter; } diff --git a/app/code/Magento/Catalog/Model/Url.php b/app/code/Magento/Catalog/Model/Url.php index b85c3e2831b9ea9653605fe80f4152b3db93633e..c489a597cd1232850d31d1551313515379832180 100644 --- a/app/code/Magento/Catalog/Model/Url.php +++ b/app/code/Magento/Catalog/Model/Url.php @@ -902,12 +902,12 @@ class Url * @param \Magento\Object $category * @param string $parentPath * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function generatePath($type = 'target', $product = null, $category = null, $parentPath = null) { if (!$product && !$category) { - throw new \Magento\Core\Exception(__('Please specify either a category or a product, or both.')); + throw new \Magento\Model\Exception(__('Please specify either a category or a product, or both.')); } // generate id_path @@ -949,7 +949,7 @@ class Url // for product & category if (!$category) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('A category object is required for determining the product request path.') ); } diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index 4038c71c1b20b369e34aa28499b1d96e15ed143f..f0574227d63e18edb198e0a3ddb9be40db65335d 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -29,6 +29,7 @@ <preference for="Magento\Catalog\Model\Product\PriceModifierInterface" type="Magento\Catalog\Model\Product\PriceModifier\Composite" /> <preference for="Magento\Catalog\Model\Attribute\LockValidatorInterface" type="Magento\Catalog\Model\Attribute\LockValidatorComposite" /> <preference for="Magento\Catalog\Model\Entity\Product\Attribute\Group\AttributeMapperInterface" type="Magento\Catalog\Model\Entity\Product\Attribute\Group\AttributeMapper" /> + <preference for="Magento\Catalog\Block\Product\ReviewRendererInterface" type="Magento\Catalog\Block\Product\ReviewRenderer\DefaultProvider" /> <type name="Magento\Log\Model\Resource\Log"> <plugin name="catalogLog" type="Magento\Catalog\Model\Plugin\Log" /> </type> @@ -168,7 +169,7 @@ <plugin name="catalogProductFlatIndexerStoreGroup" type="Magento\Catalog\Model\Indexer\Product\Flat\Plugin\StoreGroup" /> <plugin name="categoryStoreGroupAroundSave" type="Magento\Catalog\Model\Indexer\Category\Product\Plugin\StoreGroup"/> </type> - <type name="Magento\Customer\Model\Resource\Group"> + <type name="Magento\Customer\Service\V1\CustomerGroupServiceInterface"> <plugin name="invalidatePriceIndexerOnCustomerGroup" type="Magento\Catalog\Model\Indexer\Product\Price\Plugin\CustomerGroup"/> </type> <type name="Magento\Catalog\Model\Indexer\Product\Price\Plugin\AbstractPlugin"> @@ -202,15 +203,13 @@ <argument name="indexer" xsi:type="object" shared="false">Magento\Indexer\Model\IndexerInterface</argument> </arguments> </type> - <type name="Magento\Catalog\Model\Indexer\Product\Flat\Processor"> - <arguments> - <argument name="indexer" xsi:type="object" shared="true">Magento\Indexer\Model\Indexer</argument> - </arguments> - </type> <type name="Magento\ImportExport\Model\Import"> <plugin name="catalogProductFlatIndexerImport" type="\Magento\Catalog\Model\Indexer\Product\Flat\Plugin\Import" /> <plugin name="invalidatePriceIndexerOnImport" type="\Magento\Catalog\Model\Indexer\Product\Price\Plugin\Import" /> </type> + <type name="Magento\CatalogRule\Model\Rule"> + <plugin name="reindexPriceOnRuleApply" type="\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule" /> + </type> <type name="Magento\Catalog\Helper\Product\Flat\Indexer"> <arguments> <argument name="flatAttributeGroups" xsi:type="array"> @@ -312,4 +311,12 @@ <plugin name="page-cache-indexer-reindex-product-flat" type="Magento\Catalog\Model\Indexer\Product\AffectCache" sortOrder="10"/> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="catalogCategory" xsi:type="string">Magento\Catalog\Model\Category</item> + <item name="catalogProduct" xsi:type="string">Magento\Catalog\Model\Product</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index b7a373541de5a430e282cbc7a32404500bf3b53e..7fd7dcedb6ba1529b6e2c3fee392bb87f696b7b8 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -45,7 +45,6 @@ <module name="Magento_Backend"/> <module name="Magento_Widget"/> <module name="Magento_Wishlist"/> - <module name="Magento_Review"/> <module name="Magento_Tax"/> <module name="Magento_Bundle"/> <module name="Magento_ImportExport"/> @@ -56,7 +55,6 @@ <module name="Magento_CatalogSearch"/> <module name="Magento_Weee"/> <module name="Magento_ProductAlert"/> - <module name="Magento_Rating"/> </depends> </module> </config> diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index ef810ff0aa76f31947fcca40ed72ae145dbc2821..1ab046da2d97260c41e743242dc0037bac7f26c6 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -58,7 +58,6 @@ "Amount","Summe" "An error occurred while adding products to websites.","Ein Fehler ist aufgetreten, während Produkte zu Webseiten hinzugefügt wurden." "An error occurred while clearing comparison list.","Beim Löschen der Vergleichsliste ist ein Fehler aufgetreten." -"An error occurred while deleting this review.","Beim Löschen dieser Rezension ist ein Fehler aufgetreten." "An error occurred while removing products from websites.","Ein Fehler ist aufgetreten, während Produkte von Webseiten entfernt wurden." "An error occurred while saving the URL rewrite","Ein Fehler ist beim Speichern der URL-Umschreibung aufgetreten." "An error occurred while saving the attribute set.","Beim Speichern des Eigenschaftensatzes ist ein Fehler aufgetreten." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Beim Speichern des Produktes ist ein Fehler aufgetreten." "An error occurred while saving the search query.","Beim Speichern der Suchanfrage ist ein Fehler aufgetreten." "An error occurred while saving this group.","Beim Speichern dieser Gruppe ist ein Fehler aufgetreten." -"An error occurred while saving this review.","Beim Speichern der Rezension ist ein Fehler aufgetreten." "An error occurred while trying to delete the category.","Beim Versuch die Kategorie zu löschen ist ein Fehler aufgetreten." "An error occurred while updating the product(s) attributes.","Beim Aktualisieren der Eigenschaften der/des Produkte(s) ist ein Fehler aufgetreten." "An error occurred while updating the product(s) status.","Bei der Aktualisierung des Status der/des Produkte(s) ist ein Fehler aufgetreten." @@ -211,7 +209,6 @@ "Custom Options","Kundenoptionen" "Custom options","Benutzerdefinierte Optionen" "Customer Group","Kundengruppe" -"Customers Reviews","Berichte der Kunden" "Customers Tagged Product","Produkt vom Kunden markiert" "Data Type for Saving in Database","Datentyp für das Speichern in Datenbank" "Date & Time Custom Options","Benutzerdefinierten Optionen bezüglich Datum und Uhrzeit" @@ -442,7 +439,6 @@ "Page Title Separator","Trennzeichen im Seitentitel" "Parent Category","Überkategorie" "Pending","Ausstehend" -"Pending Reviews RSS","Ausstehende Kundenmeinungen RSS" "Percentage","Prozentsatz" "Please add rows to option.","Bitte Zeilen zur Option hinzufügen." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","ACHTUNG: Bei einem Klick auf die Zeile werden die Paketdaten geladen und überschreiben alle ungespeicherten Formulardaten." @@ -499,7 +495,6 @@ "Product Listing Sort by","Verfügbare Produktauflistung sortiert nach" "Product","Produktbezeichnung" "Product Prices","Produktpreise" -"Product Reviews","Produktreviews" "Product Tags","Produkttags" "Product Tier Price API","Produktstaffelpreis API" "Product Type","Produkttyp" @@ -515,7 +510,6 @@ "Products","Produkte" "Products Comparison List","Produkt Vergleichsliste" "Products Information","Produktinformationen" -"Products Reviews","Artikelbewertungen" "Products Sitemap","Sitemap Produkte" "Products only","Nur Produkte" "Products per Page on Grid Allowed Values","Produkte pro Seite (erlaubte Werte für Gitter)" @@ -579,7 +573,6 @@ "Retrieve product types","Produkttypen abrufen" "Retrieve products data","Produktdaten abfragen" "Retrieve products list by filters","Produktliste gemäß Filter abrufen" -"Reviews","Bewertungen" "Roll Over for preview","Darüber scrollen für eine Vorschau" "Root","Root" "SKU","Artikelposition" @@ -678,9 +671,6 @@ "The product has been duplicated.","Das Produkt wurde dupliziert." "The product has been saved.","Das Produkt wurde gespeichert." "The product has required options","Das Produkt hat Pflichtangaben" -"The review has been deleted","Diese Bewertung wurde gelöscht" -"The review has been saved.","Diese Bewertung wrude gespeichert." -"The review was removed by another user or does not exist.","Diese Bewertung wurde von einem anderen Benutzer entfernt oder existiert nicht." "The search was deleted.","Diese Suche wurde gelöscht." "The text is too long","Der Text ist zu lang" "There are no %s available.","Es sind keine %s verfügbar." diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index a558c4df83231c79a926cb24d1a196ae51e5ba24..73557c01ae258f7cd730459930f96a41f06a7df5 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -58,7 +58,6 @@ "Amount","Amount" "An error occurred while adding products to websites.","An error occurred while adding products to websites." "An error occurred while clearing comparison list.","An error occurred while clearing comparison list." -"An error occurred while deleting this review.","An error occurred while deleting this review." "An error occurred while removing products from websites.","An error occurred while removing products from websites." "An error occurred while saving the URL rewrite","An error occurred while saving the URL rewrite" "An error occurred while saving the attribute set.","An error occurred while saving the attribute set." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","An error occurred while saving the product. " "An error occurred while saving the search query.","An error occurred while saving the search query." "An error occurred while saving this group.","An error occurred while saving this group." -"An error occurred while saving this review.","An error occurred while saving this review." "An error occurred while trying to delete the category.","An error occurred while trying to delete the category." "An error occurred while updating the product(s) attributes.","An error occurred while updating the product(s) attributes." "An error occurred while updating the product(s) status.","An error occurred while updating the product(s) status." @@ -212,7 +210,6 @@ "Custom Options","Custom Options" "Custom options","Custom options" "Customer Group","Customer Group" -"Customers Reviews","Customers Reviews" "Customers Tagged Product","Customers Tagged Product" "Data Type for Saving in Database","Data Type for Saving in Database" "Date & Time Custom Options","Date & Time Custom Options" @@ -443,7 +440,6 @@ "Page Title Separator","Page Title Separator" "Parent Category","Parent Category" "Pending","Pending" -"Pending Reviews RSS","Pending Reviews RSS" "Percentage","Percentage" "Please add rows to option.","Please add rows to option." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost." @@ -501,7 +497,6 @@ "Product Listing Sort by","Product Listing Sort by" "Product","Product" "Product Prices","Product Prices" -"Product Reviews","Product Reviews" "Product Tags","Product Tags" "Product Tier Price API","Product Tier Price API" "Product Type","Product Type" @@ -517,7 +512,6 @@ "Products","Products" "Products Comparison List","Products Comparison List" "Products Information","Products Information" -"Products Reviews","Products Reviews" "Products Sitemap","Products Sitemap" "Products only","Products only" "Products per Page on Grid Allowed Values","Products per Page on Grid Allowed Values" @@ -581,7 +575,6 @@ "Retrieve product types","Retrieve product types" "Retrieve products data","Retrieve products data" "Retrieve products list by filters","Retrieve products list by filters" -"Reviews","Reviews" "Roll Over for preview","Roll Over for preview" "Root","Root" "SKU","SKU" @@ -680,9 +673,6 @@ "The product has been duplicated.","The product has been duplicated." "The product has been saved.","The product has been saved." "The product has required options","The product has required options" -"The review has been deleted","The review has been deleted" -"The review has been saved.","The review has been saved." -"The review was removed by another user or does not exist.","The review was removed by another user or does not exist." "The search was deleted.","The search was deleted." "The text is too long","The text is too long" "There are no %s available.","There are no %s available." diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index 426fe1357124756567ef3e7afc1da9c128f2892c..9ea8012442dfe7de6aefc579b0282ff65b86781a 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -58,7 +58,6 @@ "Amount","Importe" "An error occurred while adding products to websites.","Se produjo un error mientras se agregaban productos a los sitios web." "An error occurred while clearing comparison list.","Se produjo un error mientras se borraba la lista de comparación." -"An error occurred while deleting this review.","Se produjo un error al eliminar esta revisión." "An error occurred while removing products from websites.","Se produjo un error mientras se eliminaban productos de sitios web." "An error occurred while saving the URL rewrite","Se produjo un error al guardar la URL reescrita" "An error occurred while saving the attribute set.","Se produjo un error mientras se guardaba el conjunto de atributos." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Se produjo un error mientras se guardaba el producto." "An error occurred while saving the search query.","Se produjo un error mientras se guardaba el enunciado de búsqueda." "An error occurred while saving this group.","Se produjo un error mientras se guardaba este grupo." -"An error occurred while saving this review.","Se produjo un error al guardar esta revisión." "An error occurred while trying to delete the category.","Se produjo un error mientras se intentaba eliminar la categorÃa." "An error occurred while updating the product(s) attributes.","Se produjo un error al actualizar los atributos del producto o productos." "An error occurred while updating the product(s) status.","Se produjo un error al actualizar el estado del producto o productos." @@ -211,7 +209,6 @@ "Custom Options","Opciones Personalizadas" "Custom options","Opciones de personalización" "Customer Group","Grupo de Clientes" -"Customers Reviews","Revisiones Personalizadas" "Customers Tagged Product","Producto Etiquetado de Clientes" "Data Type for Saving in Database","Tipo de Datos a Guardar en la Base de Datos" "Date & Time Custom Options","Opciones Personalizadas de Fecha y Hora" @@ -442,7 +439,6 @@ "Page Title Separator","Separador de tÃtulo de página" "Parent Category","CategorÃa principal" "Pending","Pendiente" -"Pending Reviews RSS","RSS de reseñas pendientes" "Percentage","Porcentaje" "Please add rows to option.","Por favor, añadir filas a la opción." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Tenga en cuenta que al hacer clic en la fila se cargarán los datos de paquete del archivo seleccionado, y se perderán todos los datos del formulario que no se hayan guardado." @@ -499,7 +495,6 @@ "Product Listing Sort by","Listado de Productos Ordenar Por" "Product","Nombre de Producto" "Product Prices","Precios de Producto" -"Product Reviews","Opiniones de Producto" "Product Tags","Etiqueta de Producto" "Product Tier Price API","API de Precio de Nivel de Producto" "Product Type","Tipo de Producto" @@ -515,7 +510,6 @@ "Products","Productos" "Products Comparison List","Lista de Comparación de Productos" "Products Information","Información de Productos" -"Products Reviews","Opiniones de Productos" "Products Sitemap","Mapa del sitio de productos" "Products only","Sólo productos" "Products per Page on Grid Allowed Values","Productos por Página en Valores Permitidos por la CuadrÃcula" @@ -579,7 +573,6 @@ "Retrieve product types","Recuperar tipos de producto" "Retrieve products data","Recuperar datos de productos" "Retrieve products list by filters","Recuperar lista de productos por medio de filtros" -"Reviews","Reseñas" "Roll Over for preview","Desplegar para visualización previa" "Root","RaÃz" "SKU","SKU (Número de Referencia)" @@ -678,9 +671,6 @@ "The product has been duplicated.","Se duplicó el producto." "The product has been saved.","Se ha guardado el producto." "The product has required options","El producto tiene opciones obligatorias" -"The review has been deleted","Se eliminó la reseña" -"The review has been saved.","Se guardó la reseña." -"The review was removed by another user or does not exist.","La reseña no existe o fue eliminada por otro usuario." "The search was deleted.","Se eliminó la búsqueda." "The text is too long","El texto es demasiado largo." "There are no %s available.","No hay %s disponibles." diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index 88d596b28e6cdafa1a2958e7bab902e2112d8175..b1eee5ea79157ba62ed3343bf2de4e8f3209d817 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -58,7 +58,6 @@ "Amount","Montant" "An error occurred while adding products to websites.","Une erreur est survenue pendant l'ajout de produits sur les sites Internet." "An error occurred while clearing comparison list.","Une erreur est survenue pendant la suppression de la list de comparaison." -"An error occurred while deleting this review.","Une erreur est survenue en effaçant ce commentaire" "An error occurred while removing products from websites.","Une erreur est survenue pendant le retrait de produits des sites Internet." "An error occurred while saving the URL rewrite","Une erreur est survenue lors de l'enregistrement de la réécriture de l'URL" "An error occurred while saving the attribute set.","Une erreur est survenue pendant la sauvegarde de la série d'attributs." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Une erreur est survenue pendant la sauvegarde du produit." "An error occurred while saving the search query.","Une erreur est survenue pendant la sauvegarde de la demande de recherche." "An error occurred while saving this group.","Une erreur est survenue pendant la sauvegarde de ce groupe." -"An error occurred while saving this review.","Une erreur est survenue en enregistrant ce commentaire" "An error occurred while trying to delete the category.","Une erreur est survenue en essayant de supprimer cette catégorie." "An error occurred while updating the product(s) attributes.","Une erreur est survenue pendant la mise à jour des attributs du/des produit(s)." "An error occurred while updating the product(s) status.","Une erreur est survenue pendant la mise à jour du statut du/des produit(s)." @@ -211,7 +209,6 @@ "Custom Options","Personnaliser les options" "Custom options","Options personnalisées" "Customer Group","Groupe du client" -"Customers Reviews","Avis des clients" "Customers Tagged Product","Les acheteurs ont étiqueté le produit" "Data Type for Saving in Database","Type de données pour enregistrement dans la base de données" "Date & Time Custom Options","Options de date et d'heure personnalisées" @@ -442,7 +439,6 @@ "Page Title Separator","Séparateur titre de la page" "Parent Category","Catégorie parent" "Pending","En cours" -"Pending Reviews RSS","RSS des avis en attente" "Percentage","Pourcentage" "Please add rows to option.","Veuillez ajouter des lignes à l'option." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Veuillez faire attention : une fois que vous cliquez sur la ligne, les données du paquet sélectionné se chargeront et toutes les données non-enregistrées seront perdues." @@ -499,7 +495,6 @@ "Product Listing Sort by","Liste des Produits triés par" "Product","Nom du produit" "Product Prices","Prix des Produits" -"Product Reviews","Avis sur le produit" "Product Tags","Étiquettes des produits" "Product Tier Price API","Produit Niveau de Prix API" "Product Type","Type de Produit" @@ -515,7 +510,6 @@ "Products","Produits" "Products Comparison List","Liste de comparaison des produits" "Products Information","Information des produits" -"Products Reviews","Avis sur les produits" "Products Sitemap","Plan du site produits" "Products only","Produits seulement" "Products per Page on Grid Allowed Values","Produits par page sur les valeurs autorisées des lignes" @@ -579,7 +573,6 @@ "Retrieve product types","Extraire les types de produit" "Retrieve products data","Récupérer les données produits" "Retrieve products list by filters","Extraire la liste des produits par filtrage" -"Reviews","Commentaires" "Roll Over for preview","Passez votre souris par-dessus pour la prévisualisation" "Root","Racine" "SKU","UGS" @@ -678,9 +671,6 @@ "The product has been duplicated.","Le produit a été dupliqué." "The product has been saved.","Le produit a été sauvegardé." "The product has required options","Le produit a des options obligatoires." -"The review has been deleted","Le rapport a été supprimé" -"The review has been saved.","Le rapport a été enregistré." -"The review was removed by another user or does not exist.","Le rapport a été supprimé par un autre utilisateur ou n'existe pas." "The search was deleted.","La recherche a été supprimée." "The text is too long","Le texte est trop long" "There are no %s available.","Il n'y a pas de %s disponible." diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index 8cd20429f813e86069520cf48d5bcf6dc80fe942..3bba923d85ba646cd18e8729f15c309f6d4e1b5e 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -58,7 +58,6 @@ "Amount","Aantal" "An error occurred while adding products to websites.","Er is een fout opgetreden tijdens het toevoegen van producten aan websites." "An error occurred while clearing comparison list.","Er is een fout opgetreden tijdens het opschonen vergelijkingslijst." -"An error occurred while deleting this review.","Er is een fout opgetreden bij het verwijderen van deze recentie." "An error occurred while removing products from websites.","Er is een fout opgetreden tijdens het verwijderen van producten van websites." "An error occurred while saving the URL rewrite","Er is een fout opgetreden tijdens het opslaan van de URL rewrite" "An error occurred while saving the attribute set.","Er is een fout opgetreden tijdens het opslaan van de attribuut set." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Er is een fout opgetreden tijdens het opslaan van het product." "An error occurred while saving the search query.","Er is een fout opgetreden tijdens het opslaan van de zoek query." "An error occurred while saving this group.","Er is een fout opgetreden tijdens het opslaan van deze groep." -"An error occurred while saving this review.","Er is een fout opgetreden bij het opslaan van deze recensie." "An error occurred while trying to delete the category.","Er is een fout opgetreden tijdens het proberen de categorie te verwijderen." "An error occurred while updating the product(s) attributes.","Er is een fout opgetreden tijdens het updaten van de product attributen." "An error occurred while updating the product(s) status.","Er is een fout opgetreden tijdens het updaten van de product status." @@ -211,7 +209,6 @@ "Custom Options","Custom Opties" "Custom options","Aangepaste opties" "Customer Group","Klantgroep" -"Customers Reviews","Klantenrecensies" "Customers Tagged Product","Door Klanten Getagd Product" "Data Type for Saving in Database","Data type om in Database op te slaan" "Date & Time Custom Options","Datum & Tijd Custom Opties" @@ -442,7 +439,6 @@ "Page Title Separator","Pagina Titel Afscheider" "Parent Category","Parent Categorie" "Pending","In afwachting" -"Pending Reviews RSS","In Afwachting van Reviews RSS" "Percentage","Percentage" "Please add rows to option.","Voeg rijen toe aan optie." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Wees voorzichtig aangezien er een pakket data formulier geladen wordt zodra u op de rij klikt en alle niet opgeslagen data zal verloren gaan." @@ -499,7 +495,6 @@ "Product Listing Sort by","Sorteer Product Lijst op" "Product","Productnaam" "Product Prices","Productprijzen" -"Product Reviews","Productbeoordelingen" "Product Tags","Productlabels" "Product Tier Price API","Product niveau prijs API" "Product Type","Product Type" @@ -515,7 +510,6 @@ "Products","Producten" "Products Comparison List","Productvergelijkingslijst" "Products Information","Producteninformatie" -"Products Reviews","Productrecensies" "Products Sitemap","Producten sitemap" "Products only","Producten alleen" "Products per Page on Grid Allowed Values","Producten per pagina op raamwerk toegestane waardes" @@ -579,7 +573,6 @@ "Retrieve product types","Ophalen producttypes" "Retrieve products data","Haal product data op" "Retrieve products list by filters","Ophalen productlijst op filters" -"Reviews","Reviews" "Roll Over for preview","Beweeg uw muis erover heen voor een voorvertoning" "Root","Root" "SKU","SKU" @@ -678,9 +671,6 @@ "The product has been duplicated.","Het product is verdubbeld." "The product has been saved.","Het product is opgeslagen." "The product has required options","Het product heeft verplichte opties" -"The review has been deleted","De beoordeling is verwijderd" -"The review has been saved.","De beoordeling is opgeslagen." -"The review was removed by another user or does not exist.","De beoordeling werd verwijderd door een andere gebruiker of bestaat niet." "The search was deleted.","De zoekactie werd verwijderd." "The text is too long","De tekst is te lang" "There are no %s available.","Er zijn geen %s beschikbaar." diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index aacea184851875f75627c3730f8f75e453e828ac..ff867c22e0acd2bece0c9b98eee3f190051a3a33 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -58,7 +58,6 @@ "Amount","Valor" "An error occurred while adding products to websites.","Ocorreu um erro durante a adição de produtos aos websites." "An error occurred while clearing comparison list.","Ocorreu um erro durante a limpeza da lista de comparação." -"An error occurred while deleting this review.","Ocorreu um erro ao excluir essa resenha." "An error occurred while removing products from websites.","Ocorreu um erro durante a retirada de produtos dos sites." "An error occurred while saving the URL rewrite","Ocorreu um erro ao salvar o URL reescrito" "An error occurred while saving the attribute set.","Ocorreu um erro ao salvar o conjunto de atributos." @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","Ocorreu um erro ao salvar o produto." "An error occurred while saving the search query.","Ocorreu um erro ao salvar a consulta de pesquisa." "An error occurred while saving this group.","Ocorreu um erro ao salvar este grupo." -"An error occurred while saving this review.","Ocorreu um erro ao salvar a resenha." "An error occurred while trying to delete the category.","Ocorreu um erro ao tentar eliminar a categoria." "An error occurred while updating the product(s) attributes.","Ocorreu um erro durante a atualização do(s) atributo(s) do(s) produto(s)." "An error occurred while updating the product(s) status.","Ocorreu um erro durante a atualização do status do(s) produto(s)." @@ -211,7 +209,6 @@ "Custom Options","Personalizar Opções" "Custom options","Opções personalizadas" "Customer Group","Grupo de Clientes" -"Customers Reviews","Análises dos clientes" "Customers Tagged Product","Produtos marcados pelos clientes" "Data Type for Saving in Database","Tipo de dado para salvar na base de dados" "Date & Time Custom Options","Opções personalizadas de data e hora" @@ -442,7 +439,6 @@ "Page Title Separator","Separador de TÃtulo de Página" "Parent Category","Categoria Pai" "Pending","Pendente" -"Pending Reviews RSS","Comentários RSS Pendentes" "Percentage","Percentagem" "Please add rows to option.","Por favor adicione linhas à opção." "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","Por favor tome cuidado pois quando você clica na linha ela vai carregar os dados do formulário do pacote, o arquivo selecionado, e todos os dados não guardados do formulário serão perdidos." @@ -499,7 +495,6 @@ "Product Listing Sort by","LIstagem de Produto Ordenada por" "Product","Nome do produto" "Product Prices","Preços de Produto" -"Product Reviews","Comentários sobre Produto" "Product Tags","Etiquetas de Produto" "Product Tier Price API","API para NÃveis de Preço do Produto" "Product Type","Tipo de Produto" @@ -515,7 +510,6 @@ "Products","Produtos" "Products Comparison List","Lista de Comparação de Produtos" "Products Information","Informações de Produtos" -"Products Reviews","Comentários sobre Produtos" "Products Sitemap","Sitemap de Produtos" "Products only","Somente produtos" "Products per Page on Grid Allowed Values","Produtos por Página nos Valores Permitidos na Grade" @@ -579,7 +573,6 @@ "Retrieve product types","Recuperar tipos de produto" "Retrieve products data","Recuperar dados de produtos" "Retrieve products list by filters","Recuperar lista de produtos com filtros" -"Reviews","Resenhas" "Roll Over for preview","Passe o mouse para visualizar" "Root","Raiz" "SKU","Unidade de Manutenção de Estoque" @@ -678,9 +671,6 @@ "The product has been duplicated.","O produto foi duplicado." "The product has been saved.","O produto foi salvo." "The product has required options","O produto requer opções" -"The review has been deleted","A análise foi apagada" -"The review has been saved.","A análise foi salva." -"The review was removed by another user or does not exist.","A análise foi removida por outro usuário ou não existe." "The search was deleted.","A pesquisa foi apagada." "The text is too long","O texto é muito longo" "There are no %s available.","Não há %s disponÃveis." diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv index 8669e613a9c2c63e9d0ee56bd8ce5c8e5980442c..79ac27d8357d26f26bc02f6225b836e451e6f2f8 100644 --- a/app/code/Magento/Catalog/i18n/zh_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_CN.csv @@ -58,7 +58,6 @@ "Amount","æ•°é‡" "An error occurred while adding products to websites.","æ·»åŠ äº§å“到网站时å‘生错误。" "An error occurred while clearing comparison list.","清除对照表时å‘生错误。" -"An error occurred while deleting this review.","åˆ é™¤è¯¥è¯„è®ºæ—¶å‡ºé”™ã€‚" "An error occurred while removing products from websites.","ä»Žç½‘ç«™ç§»é™¤äº§å“æ—¶å‘生错误。" "An error occurred while saving the URL rewrite","ä¿å˜é‡å†™çš„URLæ—¶å‘生错误。" "An error occurred while saving the attribute set.","ä¿å˜å±žæ€§é›†æ—¶å‘生错误。" @@ -66,7 +65,6 @@ "An error occurred while saving the product. ","ä¿å˜äº§å“æ—¶å‘生错误。" "An error occurred while saving the search query.","ä¿å˜æœç´¢æŸ¥è¯¢æ—¶å‘生错误。" "An error occurred while saving this group.","ä¿å˜è¿™ä¸ªåˆ†ç»„æ—¶å‘生错误。" -"An error occurred while saving this review.","ä¿å˜è¯¥è¯„论时出错。" "An error occurred while trying to delete the category.","åˆ é™¤è¯¥ç±»åˆ«æ—¶å‘生错误。" "An error occurred while updating the product(s) attributes.","更新产å“属性时å‘生错误。" "An error occurred while updating the product(s) status.","更新产å“çŠ¶æ€æ—¶å‘生错误。" @@ -211,7 +209,6 @@ "Custom Options","自定义选项" "Custom options","自定义选项" "Customer Group","客户组" -"Customers Reviews","客户评测" "Customers Tagged Product","å®¢æˆ·æ ‡è®°çš„äº§å“" "Data Type for Saving in Database","è¦ä¿å˜åœ¨æ•°æ®åº“ä¸çš„æ•°æ®ç±»åž‹" "Date & Time Custom Options","日期和时间自定义选项" @@ -442,7 +439,6 @@ "Page Title Separator","页颿 ‡é¢˜åˆ†éš”器" "Parent Category","父分类" "Pending","挂起" -"Pending Reviews RSS","挂起评测RSS" "Percentage","百分率" "Please add rows to option.","è¯·æ·»åŠ é€‰é¡¹è¡Œã€‚" "Please be careful as once you click on the row it will load package data form the selected file and all unsaved form data will be lost.","请å°å¿ƒï¼Œä¸€æ—¦æ‚¨ç‚¹å‡»è¿™ä¸€è¡Œï¼Œå°±ä¼šä»Žæ‰€é€‰æ–‡ä»¶ä¸åŠ è½½åŒ…è£¹æ•°æ®ï¼Œæ‰€æœ‰æœªä¿å˜çš„æ•°æ®éƒ½å°†ä¸¢å¤±ã€‚" @@ -499,7 +495,6 @@ "Product Listing Sort by","产å“列表排列顺åº" "Product","产å“å" "Product Prices","产å“ä»·æ ¼" -"Product Reviews","产å“评测" "Product Tags","äº§å“æ ‡ç¾" "Product Tier Price API","产å“å±‚çº§ä»·æ ¼ API" "Product Type","产å“类型" @@ -515,7 +510,6 @@ "Products","产å“" "Products Comparison List","äº§å“æ¯”较列表" "Products Information","产å“ä¿¡æ¯" -"Products Reviews","产å“评论" "Products Sitemap","产å“网站地图" "Products only","仅产å“" "Products per Page on Grid Allowed Values","ç½‘æ ¼å…许的数值ä¸çš„æ¯é¡µäº§å“æ•°é‡" @@ -579,7 +573,6 @@ "Retrieve product types","获å–产å“类型" "Retrieve products data","获å–äº§å“æ•°æ®" "Retrieve products list by filters","按照ç›é€‰å™¨èŽ·å–产å“列表" -"Reviews","评测" "Roll Over for preview","翻转预览" "Root","æ ¹" "SKU","SKU" @@ -678,9 +671,6 @@ "The product has been duplicated.","产å“å·²å¤åˆ¶ã€‚" "The product has been saved.","产å“å·²ä¿å˜ã€‚" "The product has required options","产å“包å«å¿…需的选项" -"The review has been deleted","è¯„è®ºå·²è¢«åˆ é™¤" -"The review has been saved.","评论已ä¿å˜ã€‚" -"The review was removed by another user or does not exist.","评论已被å¦ä¸€ç”¨æˆ·åˆ 除,或评论ä¸å˜åœ¨ã€‚" "The search was deleted.","æœç´¢è¢«åˆ 除。" "The text is too long","文本过长" "There are no %s available.","没有å¯ç”¨çš„ %s。" diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.php rename to app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0-1.6.0.0.1.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0-1.6.0.0.1.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.0-1.6.0.0.1.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.18-1.6.0.0.23.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.18-1.6.0.0.23.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.18-1.6.0.0.23.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.24-1.6.0.0.25.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.24-1.6.0.0.25.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.24-1.6.0.0.25.php diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.25-1.6.0.0.26.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php similarity index 100% rename from app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.25-1.6.0.0.26.php rename to app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php diff --git a/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml b/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml index b4b7691ee78f0f65ca9ff01a18eb63804518c1ce..b37162783c0416d63c3d123489d5d7d2e46c9953 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/attribute.phtml @@ -27,7 +27,6 @@ * Product view template * * @see \Magento\Catalog\Block\Product\View - * @see \Magento\Review\Block\Product\View */ ?> <?php diff --git a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml index 26c39b6e9deae28f20d226da515d8c2174855292..8dd0b4574eeecc000b8ce04e36c3b85e4286da24 100644 --- a/app/code/Magento/Catalog/view/frontend/product/view/form.phtml +++ b/app/code/Magento/Catalog/view/frontend/product/view/form.phtml @@ -26,7 +26,6 @@ * Product view template * * @var $this \Magento\Catalog\Block\Product\View - * @var $this \Magento\Review\Block\Product\View */ ?> <?php $_helper = $this->helper('Magento\Catalog\Helper\Output'); ?> diff --git a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php index 97aa77bebf7409b6759e4d62784553a4d9ec397c..53192e05846ea268ce30bd00867e34335f3b94d7 100644 --- a/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php +++ b/app/code/Magento/CatalogInventory/Model/Config/Backend/Managestock.php @@ -47,7 +47,7 @@ class Managestock extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\CatalogInventory\Model\Stock\Status $stockStatus - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Managestock extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\CatalogInventory\Model\Stock\Status $stockStatus, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php index e1891d1d8a8262894c15a28a55008b7dc488dc83..41f5052a591e1218159403655555137d48ba8eed 100644 --- a/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Indexer/Stock.php @@ -93,7 +93,7 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer * @param \Magento\Registry $registry * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -102,7 +102,7 @@ class Stock extends \Magento\Index\Model\Indexer\AbstractIndexer \Magento\Registry $registry, \Magento\Index\Model\Indexer $indexer, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php index f40f57674a004f81d37cee166131564403cafaa0..a1b696fe6d467a0c7c663b6c8b1a4f21f1214974 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator.php @@ -55,7 +55,7 @@ class QuantityValidator * @param \Magento\Event\Observer $observer * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(\Magento\Event\Observer $observer) { @@ -160,7 +160,7 @@ class QuantityValidator } else { /* @var $stockItem \Magento\CatalogInventory\Model\Stock\Item */ if (!$stockItem instanceof \Magento\CatalogInventory\Model\Stock\Item) { - throw new \Magento\Core\Exception(__('The stock item for Product in option is not valid.')); + throw new \Magento\Model\Exception(__('The stock item for Product in option is not valid.')); } $result = $this->stockItemInitializer->initialize($stockItem, $quoteItem, $qty); diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php index 47059831aa276f99dc6004dfaebbb05641ba71d5..d4985a48010810bd551c1c75a636e965897b89df 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/Option.php @@ -49,7 +49,7 @@ class Option * * @return \Magento\Object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initialize( \Magento\Sales\Model\Quote\Item\Option $option, @@ -64,7 +64,7 @@ class Option $stockItem = $option->getProduct()->getStockItem(); if (!$stockItem instanceof \Magento\CatalogInventory\Model\Stock\Item) { - throw new \Magento\Core\Exception(__('The stock item for Product in option is not valid.')); + throw new \Magento\Model\Exception(__('The stock item for Product in option is not valid.')); } /** diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php index add18bf0a7dc8d72b245fcf3ba142d90555fbbec..c16f1075e8d3c2ab1a53985e67b26ca6c9f09bf3 100644 --- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php +++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/StockItem.php @@ -57,7 +57,7 @@ class StockItem * @param int $qty * * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initialize( \Magento\CatalogInventory\Model\Stock\Item $stockItem, diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php index 628fc65d092a88112e0003dc67c8af45384d6bf9..d99e97b17d2070294f477d8e37b524fd49dac4a0 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock.php @@ -329,13 +329,13 @@ class Stock extends \Magento\Catalog\Model\Resource\Product\Indexer\AbstractInde * * @param string $productTypeId * @return \Magento\CatalogInventory\Model\Resource\Indexer\Stock\StockInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getIndexer($productTypeId) { $types = $this->_getTypeIndexers(); if (!isset($types[$productTypeId])) { - throw new \Magento\Core\Exception(__('Unsupported product type "%1".', $productTypeId)); + throw new \Magento\Model\Exception(__('Unsupported product type "%1".', $productTypeId)); } return $types[$productTypeId]; } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php index b46486e7c1029d8093751236c3a112bb3f79675c..fbbf8f751b4d943561176ce7409c44452bb60c2b 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/DefaultStock.php @@ -131,12 +131,12 @@ class DefaultStock extends \Magento\Catalog\Model\Resource\Product\Indexer\Abstr * Retrieve active Product Type Id * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getTypeId() { if (is_null($this->_typeId)) { - throw new \Magento\Core\Exception(__('Undefined product type')); + throw new \Magento\Model\Exception(__('Undefined product type')); } return $this->_typeId; } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php index 29f51181e5a06f07ed6205cfd04d28c341c0bffa..cf1c1c3ab4cd6e291239892e6af53e816e4f9f04 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Indexer/Stock/StockInterface.php @@ -61,7 +61,7 @@ interface StockInterface * Retrieve Product Type Id for indexer * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getTypeId(); } diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php index 0ada75484fcae7b774442b0ee941b8a477a82c7a..a5d61e1468e7ae3e9f2766e7a87a46e2db6c5bd0 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock.php @@ -28,7 +28,7 @@ */ namespace Magento\CatalogInventory\Model\Resource; -class Stock extends \Magento\Core\Model\Resource\Db\AbstractDb +class Stock extends \Magento\Model\Resource\Db\AbstractDb { /** * Is initialized configuration flag diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php index 4313364738e673625e5382ff979705fa886b9410..d973619cae69895bd87c641bdc2616f6cc3d1783 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogInventory\Model\Resource\Stock; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Core store config diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php index 81999aa72d100663367ec5d6e0f812fe3608077b..a72939cb30bdd04f3e2faa3ce83f75db0809e841 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Item/Collection.php @@ -29,7 +29,7 @@ namespace Magento\CatalogInventory\Model\Resource\Stock\Item; use Magento\CatalogInventory\Model\Stock; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -43,7 +43,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -52,7 +52,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -157,13 +157,13 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param string $comparisonMethod * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addQtyFilter($comparisonMethod, $qty) { $methods = array('<' => 'lt', '>' => 'gt', '=' => 'eq', '<=' => 'lteq', '>=' => 'gteq', '<>' => 'neq'); if (!isset($methods[$comparisonMethod])) { - throw new \Magento\Core\Exception(__('%1 is not a correct comparison method.', $comparisonMethod)); + throw new \Magento\Model\Exception(__('%1 is not a correct comparison method.', $comparisonMethod)); } return $this->addFieldToFilter('main_table.qty', array($methods[$comparisonMethod] => $qty)); diff --git a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php index a879f7a26f535e20264b1b6ed123cb61c60d4022..9b97b0064b4fe4a0b2f480d220fa927dbd16d40f 100644 --- a/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Resource/Stock/Status.php @@ -26,7 +26,7 @@ namespace Magento\CatalogInventory\Model\Resource\Stock; /** * CatalogInventory Stock Status per website Resource Model */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Store model manager diff --git a/app/code/Magento/CatalogInventory/Model/Stock.php b/app/code/Magento/CatalogInventory/Model/Stock.php index ac38f0b9afbbb6bb7a32ae80b0322fc909ed361c..828dd89dc646f666945986a4d2cb109e00bb1d56 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock.php +++ b/app/code/Magento/CatalogInventory/Model/Stock.php @@ -35,7 +35,7 @@ use Magento\CatalogInventory\Model\Stock\Item; * @method string getStockName() * @method \Magento\CatalogInventory\Model\Stock setStockName(string $value) */ -class Stock extends \Magento\Core\Model\AbstractModel +class Stock extends \Magento\Model\AbstractModel { const BACKORDERS_NO = 0; @@ -82,7 +82,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -93,7 +93,7 @@ class Stock extends \Magento\Core\Model\AbstractModel \Magento\CatalogInventory\Helper\Data $catalogInventoryData, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\CatalogInventory\Model\Stock\ItemFactory $stockItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -187,7 +187,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * * @param array $items * @return Item[] - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerProductsSale($items) { @@ -201,7 +201,7 @@ class Stock extends \Magento\Core\Model\AbstractModel $item->setData($itemInfo); if (!$item->checkQty($qtys[$item->getProductId()])) { $this->_getResource()->commit(); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Not all of your products are available in the requested quantity.') ); } @@ -231,7 +231,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * * @param \Magento\Object $item * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerItemSale(\Magento\Object $item) { @@ -249,7 +249,7 @@ class Stock extends \Magento\Core\Model\AbstractModel } } } else { - throw new \Magento\Core\Exception(__('We cannot specify a product identifier for the order item.')); + throw new \Magento\Model\Exception(__('We cannot specify a product identifier for the order item.')); } return $this; } diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Item.php b/app/code/Magento/CatalogInventory/Model/Stock/Item.php index 07d4fe770af85d4e73b9275a2542eaa2d2f36c9e..39fdaec88c182a414ab959246034428510b3173b 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Item.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Item.php @@ -70,7 +70,7 @@ use Magento\Catalog\Model\Product; * @package Magento_CatalogInventory * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const XML_PATH_GLOBAL = 'cataloginventory/options/'; @@ -216,7 +216,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Math\Division $mathDivision * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -233,7 +233,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Locale\FormatInterface $localeFormat, \Magento\Math\Division $mathDivision, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -558,7 +558,7 @@ class Item extends \Magento\Core\Model\AbstractModel * Check quantity * * @param int|float $qty - * @exception \Magento\Core\Exception + * @exception \Magento\Model\Exception * @return bool */ public function checkQty($qty) diff --git a/app/code/Magento/CatalogInventory/Model/Stock/Status.php b/app/code/Magento/CatalogInventory/Model/Stock/Status.php index 311d7ed43199ca2e3a3bf3e3d21c4d1c307be2f9..a888e599be19e0aa2e12eaa9284f0049f262c92b 100644 --- a/app/code/Magento/CatalogInventory/Model/Stock/Status.php +++ b/app/code/Magento/CatalogInventory/Model/Stock/Status.php @@ -43,7 +43,7 @@ use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; * @method int getStockStatus() * @method \Magento\CatalogInventory\Model\Stock\Status setStockStatus(int $value) */ -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /**#@+ * Stock Status values @@ -102,7 +102,7 @@ class Status extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param ItemFactory $stockItemFactory * @param \Magento\CatalogInventory\Helper\Data $catalogInventoryData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -114,7 +114,7 @@ class Status extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, ItemFactory $stockItemFactory, \Magento\CatalogInventory\Helper\Data $catalogInventoryData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php index 0980e26b536c7cb07888fcb241cb2f9a06202d37..b9b50f88974f2c4a62beeaf6f86e3dfba52324f0 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Minsaleqty.php @@ -45,7 +45,7 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class Minsaleqty extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\CatalogInventory\Helper\Minsaleqty $catalogInventoryMinsaleqty, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php index 2bc7a3aa08f7b7abca2301fc31e7e8bf2678cce9..8610c625b05fe62c6a7379a1aefceaeb569c5ae4 100644 --- a/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php +++ b/app/code/Magento/CatalogInventory/Model/System/Config/Backend/Qtyincrements.php @@ -30,7 +30,7 @@ */ namespace Magento\CatalogInventory\Model\System\Config\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; class Qtyincrements extends \Magento\Core\Model\Config\Value { diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php index 371695205575536ade68b38715e146fa2c596957..806b4b43e687e16ea5afa2fdd2fa6c42a72f18a7 100644 --- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php +++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog.php @@ -36,7 +36,7 @@ namespace Magento\CatalogRule\Controller\Adminhtml\Promo; use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\CatalogRule\Model\Rule\Job; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Stdlib\DateTime\Filter\Date; use Magento\Registry; use Magento\Rule\Model\Condition\AbstractCondition; diff --git a/app/code/Magento/CatalogRule/Model/Flag.php b/app/code/Magento/CatalogRule/Model/Flag.php index 4c59433fd0076a0ddcd11d56f86976ff4e088dd3..dcb4fa20d3dd0dc087e713f763a9a894c1e391d0 100644 --- a/app/code/Magento/CatalogRule/Model/Flag.php +++ b/app/code/Magento/CatalogRule/Model/Flag.php @@ -33,7 +33,7 @@ */ namespace Magento\CatalogRule\Model; -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * Flag code diff --git a/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php index 9ffeb7c748ae7a3c895e5115e86d9617010afc62..5f49e71c4e0cfea8c55646bd51fda458d1709ca4 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Grid/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Grid; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; class Collection extends \Magento\CatalogRule\Model\Resource\Rule\Collection { diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule.php b/app/code/Magento/CatalogRule/Model/Resource/Rule.php index e7a4ef798ea67a31465ce4c1ee43b56634a0728f..8cc6be2f141836c2147f643c95bb9ae88bd6de63 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule.php @@ -36,8 +36,8 @@ namespace Magento\CatalogRule\Model\Resource; use Magento\Catalog\Model\Product; use Magento\CatalogRule\Model\Rule as ModelRule; -use Magento\Core\Model\AbstractModel; -use Magento\Core\Model\Resource\Db\AbstractDb; +use Magento\Model\AbstractModel; +use Magento\Model\Resource\Db\AbstractDb; class Rule extends \Magento\Rule\Model\Resource\AbstractResource { diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php index aaeb63188310311af48116fdade81655fe78e2d6..9119f7f307d1be5391fedb9328b28991863966bc 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price.php @@ -34,7 +34,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Rule\Product; -class Price extends \Magento\Core\Model\Resource\Db\AbstractDb +class Price extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php index 69ff5cff971bc8eb11296261e8befb8bd3c1172b..c94f7c52ccda073c55101e2904930c6584c18d09 100644 --- a/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php +++ b/app/code/Magento/CatalogRule/Model/Resource/Rule/Product/Price/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogRule\Model\Resource\Rule\Product\Price; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @return void diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php index 656f0b35e29a7124d09015581aa96fa433aa3269..fc82c7cd4bbd2a316b40541e2abe3376292809f6 100644 --- a/app/code/Magento/CatalogRule/Model/Rule.php +++ b/app/code/Magento/CatalogRule/Model/Rule.php @@ -122,7 +122,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel protected $_relatedCacheTypes; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -176,13 +176,13 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory * @param \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\CatalogRule\Helper\Data $catalogRuleData * @param \Magento\App\Cache\TypeListInterface $cacheTypesList * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $relatedCacheTypes * @param array $data @@ -197,13 +197,13 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\CatalogRule\Model\Rule\Condition\CombineFactory $combineFactory, \Magento\CatalogRule\Model\Rule\Action\CollectionFactory $actionCollectionFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Index\Model\Indexer $indexer, \Magento\Customer\Model\Session $customerSession, \Magento\CatalogRule\Helper\Data $catalogRuleData, \Magento\App\Cache\TypeListInterface $cacheTypesList, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), array $data = array() @@ -372,10 +372,6 @@ class Rule extends \Magento\Rule\Model\AbstractModel $this->getResourceCollection()->walk(array($this->_getResource(), 'updateRuleProductData')); $this->_getResource()->applyAllRulesForDateRange(); $this->_invalidateCache(); - $indexProcess = $this->_indexer->getProcessByCode('catalog_product_price'); - if ($indexProcess) { - $indexProcess->reindexAll(); - } } /** diff --git a/app/code/Magento/CatalogRule/Model/Rule/Job.php b/app/code/Magento/CatalogRule/Model/Rule/Job.php index 9be011bce2e2e267b0e3def7684591038b645acd..6666a64c1ee21a4bcf1b79386f45279125d6a5e5 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Job.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Job.php @@ -71,7 +71,7 @@ class Job extends \Magento\Object try { $this->_eventManager->dispatch('catalogrule_apply_all'); $this->setSuccess(__('The rules have been applied.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setError($e->getMessage()); } return $this; diff --git a/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php b/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php index 5e0681f2177cdc83b92a15cf01e48f007b9a98b2..b979b74eeac64b879c70a7a50a6f9881f2dc0556 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Product/Price.php @@ -53,7 +53,7 @@ namespace Magento\CatalogRule\Model\Rule\Product; use Magento\DB\Select; -class Price extends \Magento\Core\Model\AbstractModel +class Price extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php index b1af77e895da74e67c715bdcf52f0903c7adc94a..235b613f2e93364dc6e04bf4aa989f486e290535 100644 --- a/app/code/Magento/CatalogSearch/Block/Advanced/Result.php +++ b/app/code/Magento/CatalogSearch/Block/Advanced/Result.php @@ -179,7 +179,7 @@ class Result extends Template */ public function getFormUrl() { - return $this->_urlFactory->create()->setQueryParams( + return $this->_urlFactory->create()->addQueryParams( $this->getRequest()->getQuery() )->getUrl( '*/*/', diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced.php b/app/code/Magento/CatalogSearch/Controller/Advanced.php index a4420c2c40515bcea2fd585ea7d9479b4d21a4d5..fa73fa5990163e45bd20bf1289013d0cb88337b7 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced.php @@ -99,9 +99,9 @@ class Advanced extends \Magento\App\Action\Action $this->_view->loadLayout(); try { $this->_catalogSearchAdvanced->addFilters($this->getRequest()->getQuery()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); - $defaultUrl = $this->_urlFactory->create()->setQueryParams( + $defaultUrl = $this->_urlFactory->create()->addQueryParams( $this->getRequest()->getQuery() )->getUrl( '*/*/' diff --git a/app/code/Magento/CatalogSearch/Model/Advanced.php b/app/code/Magento/CatalogSearch/Model/Advanced.php index 309215655dd006b93de938b7a42859f8fe364124..89f1f2b8bf24c9ba902c787e5f320936f1cce7a6 100644 --- a/app/code/Magento/CatalogSearch/Model/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Advanced.php @@ -62,8 +62,8 @@ use Magento\CatalogSearch\Model\Advanced as ModelAdvanced; use Magento\CatalogSearch\Model\Resource\Advanced\Collection; use Magento\CatalogSearch\Model\Resource\EngineInterface; use Magento\CatalogSearch\Model\Resource\EngineProvider; -use Magento\Core\Exception; -use Magento\Core\Model\AbstractModel; +use Magento\Model\Exception; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; use Magento\Core\Model\StoreManagerInterface; diff --git a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php index 14a586257096bd56925b84ec81a2c4c50d9d5248..c0b1472238131992c24814c4c1a9e6de2c31706d 100644 --- a/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php +++ b/app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php @@ -39,7 +39,7 @@ use Magento\CatalogSearch\Model\Fulltext; use Magento\Core\Model\Config\Value; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\StoreManagerInterface; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Fulltext.php index c811e995545624fb11315eace8c4a660357976c4..cde051757589ea842d8650751b4cd7c9da280539 100644 --- a/app/code/Magento/CatalogSearch/Model/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Fulltext.php @@ -27,10 +27,10 @@ namespace Magento\CatalogSearch\Model; use Magento\CatalogSearch\Helper\Data; use Magento\CatalogSearch\Model\Query; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store\Config; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php index 5da980fc37805faec3a1d04b9b41bf24fe3313a1..aa7fee2cd35563556e46a0231eb958c869b2428a 100644 --- a/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Indexer/Fulltext.php @@ -40,7 +40,7 @@ use Magento\CatalogSearch\Model\Fulltext as ModelFulltext; use Magento\CatalogSearch\Model\Resource\Indexer\Fulltext as IndexerFulltext; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store; use Magento\Core\Model\Store\Group; use Magento\Core\Model\StoreManagerInterface; diff --git a/app/code/Magento/CatalogSearch/Model/Query.php b/app/code/Magento/CatalogSearch/Model/Query.php index cd1459a86c35c94d9c576be76592965278416583..8388de6b683caafc16377648be963d4a441bbbb1 100644 --- a/app/code/Magento/CatalogSearch/Model/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Query.php @@ -29,10 +29,10 @@ use Magento\CatalogSearch\Model\Resource\Query\Collection as QueryCollection; use Magento\CatalogSearch\Model\Resource\Query\CollectionFactory as QueryCollectionFactory; use Magento\CatalogSearch\Model\Resource\Search\Collection; use Magento\CatalogSearch\Model\Resource\Search\CollectionFactory; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Model\Context; use Magento\Registry; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; use Magento\Core\Model\Store\Config; use Magento\Core\Model\StoreManagerInterface; use Magento\Data\Collection\Db; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php index d8a06173eae57fb9f7f3f576d1222e9581b7aed3..0c39976602b3fba5b32e95c7d0464b4021160485 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Advanced extends \Magento\Core\Model\Resource\Db\AbstractDb +class Advanced extends \Magento\Model\Resource\Db\AbstractDb { /** * Core event manager proxy diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php index a9de3d49759a43e1e136ba496975d41a7ac002ce..2889ca3019d92ea6966446d418ce172480f3cfbb 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Advanced/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogSearch\Model\Resource\Advanced; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Collection Advanced diff --git a/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php b/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php index db6fcf788a7ac572cafe044d3d27e2b2f4718daf..9f02627e83cdd5acf3fe16e45c77782ff5367f03 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/EngineInterface.php @@ -88,7 +88,7 @@ interface EngineInterface /** * Return resource model for the full text search * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ public function getResource(); diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php index 1df4c1a054ee176edf85470bda41e6968453b8b8..6133ee36f181147d6d756f249557f5a659d50349 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext.php @@ -28,7 +28,7 @@ namespace Magento\CatalogSearch\Model\Resource; /** * CatalogSearch Fulltext Index resource model */ -class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fulltext extends \Magento\Model\Resource\Db\AbstractDb { /** * Searchable attributes cache diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php index 58355a682dc12d5495a887015233ec2746ac8307..9b74c9b54f76981b28c916b4b93ee34ad76e3579 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Fulltext/Engine.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource\Fulltext; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Engine extends \Magento\Core\Model\Resource\Db\AbstractDb implements +class Engine extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\CatalogSearch\Model\Resource\EngineInterface { /** diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php b/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php index c13d46af85de85a4291ba68b2943b27c42209fe8..f172d07f0935884239fc9f9391afc669c398d293 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Indexer/Fulltext.php @@ -32,7 +32,7 @@ namespace Magento\CatalogSearch\Model\Resource\Indexer; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Fulltext extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fulltext extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define catalog product table as main table diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query.php b/app/code/Magento/CatalogSearch/Model/Resource/Query.php index ea84d7fa3996064a792d2f5a3ef6d5cd8f9ba3cb..e046ff13a9e50051a443a24529c6ffb91ffa4f24 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query.php @@ -25,7 +25,7 @@ */ namespace Magento\CatalogSearch\Model\Resource; -use Magento\Core\Model\Resource\Db\AbstractDb; +use Magento\Model\Resource\Db\AbstractDb; /** * Catalog search query resource model @@ -76,11 +76,11 @@ class Query extends AbstractDb /** * Custom load model by search query string * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $value * @return $this */ - public function loadByQuery(\Magento\Core\Model\AbstractModel $object, $value) + public function loadByQuery(\Magento\Model\AbstractModel $object, $value) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable() @@ -107,11 +107,11 @@ class Query extends AbstractDb /** * Custom load model only by query text (skip synonym for) * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $value * @return $this */ - public function loadByQueryText(\Magento\Core\Model\AbstractModel $object, $value) + public function loadByQueryText(\Magento\Model\AbstractModel $object, $value) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable() @@ -135,12 +135,12 @@ class Query extends AbstractDb /** * Loading string as a value or regular numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int|string $value * @param null|string $field * @return $this|AbstractDb */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_numeric($value)) { return parent::load($object, $value); @@ -151,10 +151,10 @@ class Query extends AbstractDb } /** - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->dateTime->formatDate($this->_date->gmtTimestamp())); return $this; diff --git a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php index 494a2418ec1ce4fa0a6c5594d18043a79f910231..c3999747761df91e970d4db3c6058135ce4ed02d 100644 --- a/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php +++ b/app/code/Magento/CatalogSearch/Model/Resource/Query/Collection.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Store; * @package Magento_CatalogSearch * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store for filter @@ -65,7 +65,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -75,7 +75,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\CatalogSearch\Model\Resource\Helper $resourceHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php index 286804d6187468ecdcba583137c58e92f42d581c..fa0fd97dc2151b7c4f6dd8bd37502f2852e58792 100644 --- a/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php +++ b/app/code/Magento/Centinel/Controller/Adminhtml/Centinel/Index.php @@ -69,7 +69,7 @@ class Index extends \Magento\Backend\App\Action $validator->reset(); $this->_getPayment()->importData($paymentData); $result['authenticationUrl'] = $validator->getAuthenticationStartUrl(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['message'] = $e->getMessage(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Centinel/Model/Service.php b/app/code/Magento/Centinel/Model/Service.php index d1186067b1aa317fd99d8cf116b0d0280932d891..797de3087f2384476afafe4a0656e71fc896c5fa 100644 --- a/app/code/Magento/Centinel/Model/Service.php +++ b/app/code/Magento/Centinel/Model/Service.php @@ -327,7 +327,7 @@ class Service extends \Magento\Object * * @param \Magento\Object $data * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate($data) { @@ -350,12 +350,12 @@ class Service extends \Magento\Object // check whether is authenticated before placing order if ($this->getIsPlaceOrder()) { if ($validationState->getChecksum() != $newChecksum) { - throw new \Magento\Core\Exception(__('Payment information error. Please start over.')); + throw new \Magento\Model\Exception(__('Payment information error. Please start over.')); } if ($validationState->isAuthenticateSuccessful()) { return; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please verify the card with the issuer bank before placing the order.') ); } else { @@ -366,7 +366,7 @@ class Service extends \Magento\Object if ($validationState->isLookupSuccessful()) { return; } - throw new \Magento\Core\Exception(__('This card has failed validation and cannot be used.')); + throw new \Magento\Model\Exception(__('This card has failed validation and cannot be used.')); } } diff --git a/app/code/Magento/Checkout/Block/Cart.php b/app/code/Magento/Checkout/Block/Cart.php index 50013cc3dd4b779445ea4d5594759861f317e45e..0dd067767919a8c06ac043de815dd881c55879db 100644 --- a/app/code/Magento/Checkout/Block/Cart.php +++ b/app/code/Magento/Checkout/Block/Cart.php @@ -205,13 +205,13 @@ class Cart extends \Magento\Checkout\Block\Cart\AbstractCart * * @param string $name Block name in layout * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethodHtml($name) { $block = $this->getLayout()->getBlock($name); if (!$block) { - throw new \Magento\Core\Exception(__('Invalid method: %1', $name)); + throw new \Magento\Model\Exception(__('Invalid method: %1', $name)); } return $block->toHtml(); } diff --git a/app/code/Magento/Checkout/Block/Cart/Crosssell.php b/app/code/Magento/Checkout/Block/Cart/Crosssell.php index 6d2a97eb42d3f68a4f1959615a038d8add0d0394..69a01ffb7a36385bd20656bf54382dc62615e36c 100644 --- a/app/code/Magento/Checkout/Block/Cart/Crosssell.php +++ b/app/code/Magento/Checkout/Block/Cart/Crosssell.php @@ -89,17 +89,7 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\CatalogInventory\Model\Stock $stock, @@ -115,16 +105,6 @@ class Crosssell extends \Magento\Catalog\Block\Product\AbstractProduct $this->_itemRelationsList = $itemRelationsList; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php index 070b28fa39f738d8ea75522a2b4e8ff25c711d66..d361b1e3ed4e45f88da57126349b66e00f297c08 100644 --- a/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php +++ b/app/code/Magento/Checkout/Controller/Adminhtml/Agreement.php @@ -124,7 +124,7 @@ class Agreement extends \Magento\Backend\App\Action $this->_redirect('checkout/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving this condition.')); @@ -153,7 +153,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The condition has been deleted.')); $this->_redirect('checkout/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while deleting this condition.')); diff --git a/app/code/Magento/Checkout/Controller/Cart.php b/app/code/Magento/Checkout/Controller/Cart.php index 21f802d963f074a4557509cf93b136384290aa25..546398ee7ae813f6e69a5b3934963c83c6d8f09c 100644 --- a/app/code/Magento/Checkout/Controller/Cart.php +++ b/app/code/Magento/Checkout/Controller/Cart.php @@ -250,7 +250,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } $this->_goBack(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice( $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()) @@ -294,7 +294,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro foreach ($itemsCollection as $item) { try { $this->cart->addOrderItem($item, 1); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { @@ -376,15 +376,15 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro $quoteItem = $this->cart->getQuote()->getItemById($id); if (!$quoteItem) { - throw new \Magento\Core\Exception(__("We can't find the quote item.")); + throw new \Magento\Model\Exception(__("We can't find the quote item.")); } $item = $this->cart->updateItem($id, new \Magento\Object($params)); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } if ($item->getHasError()) { - throw new \Magento\Core\Exception($item->getMessage()); + throw new \Magento\Model\Exception($item->getMessage()); } $related = $this->getRequest()->getParam('related_product'); @@ -410,7 +410,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } $this->_goBack(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_checkoutSession->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { @@ -489,7 +489,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro $this->cart->updateItems($cartData)->save(); } $this->_checkoutSession->setCartWasUpdated(true); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( $this->_objectManager->get('Magento\Escaper')->escapeHtml($e->getMessage()) ); @@ -509,7 +509,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro try { $this->cart->truncate()->save(); $this->_checkoutSession->setCartWasUpdated(true); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $this->messageManager->addError($exception->getMessage()); } catch (\Exception $exception) { $this->messageManager->addException($exception, __('We cannot update the shopping cart.')); @@ -631,7 +631,7 @@ class Cart extends \Magento\App\Action\Action implements \Magento\Catalog\Contro } else { $this->messageManager->addSuccess(__('The coupon code was canceled.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We cannot apply the coupon code.')); diff --git a/app/code/Magento/Checkout/Controller/Onepage.php b/app/code/Magento/Checkout/Controller/Onepage.php index cac26a84ecdd7af6c2adebaef4b9f173552269cb..b6e8ad545e79f2cb4a27dd979c3136f6feeaa966 100755 --- a/app/code/Magento/Checkout/Controller/Onepage.php +++ b/app/code/Magento/Checkout/Controller/Onepage.php @@ -69,7 +69,7 @@ class Onepage extends Action * @param CustomerAccountService $customerAccountService * @param CustomerMetadataService $customerMetadataService * @param \Magento\Registry $coreRegistry - * @param \Magento\Translate\InlineInterface $translateInline, + * @param \Magento\Translate\InlineInterface $translateInline * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator */ public function __construct( @@ -505,7 +505,7 @@ class Onepage extends Action $result['fields'] = $e->getFields(); } $result['error'] = $e->getMessage(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['error'] = $e->getMessage(); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -617,7 +617,7 @@ class Onepage extends Action } $result['goto_section'] = 'payment'; $result['update_section'] = array('name' => 'payment-method', 'html' => $this->_getPaymentMethodsHtml()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); $this->_objectManager->get( 'Magento\Checkout\Helper\Data' diff --git a/app/code/Magento/Checkout/Helper/Data.php b/app/code/Magento/Checkout/Helper/Data.php index 62a66ed98805e7340b781dd8aa11ebb69aa79ec2..8f8cf1fdd3c920c08bdf503cce35d91749a70755 100644 --- a/app/code/Magento/Checkout/Helper/Data.php +++ b/app/code/Magento/Checkout/Helper/Data.php @@ -77,11 +77,9 @@ class Data extends \Magento\App\Helper\AbstractHelper protected $_transportBuilder; /** - * Translator model - * - * @var \Magento\TranslateInterface + * @var \Magento\Translate\Inline\StateInterface */ - protected $_translator; + protected $inlineTranslation; /** * @param \Magento\App\Helper\Context $context @@ -91,7 +89,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\TranslateInterface $translator + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Helper\Context $context, @@ -101,7 +99,7 @@ class Data extends \Magento\App\Helper\AbstractHelper \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Checkout\Model\Resource\Agreement\CollectionFactory $agreementCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\TranslateInterface $translator + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_storeManager = $storeManager; @@ -109,7 +107,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $this->_localeDate = $localeDate; $this->_agreementCollectionFactory = $agreementCollectionFactory; $this->_transportBuilder = $transportBuilder; - $this->_translator = $translator; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context); } @@ -246,7 +244,7 @@ class Data extends \Magento\App\Helper\AbstractHelper */ public function sendPaymentFailedEmail($checkout, $message, $checkoutType = 'onepage') { - $this->_translator->setTranslateInline(false); + $this->inlineTranslation->suspend(); $template = $this->_coreStoreConfig->getConfig('checkout/payment_failed/template', $checkout->getStoreId()); @@ -334,7 +332,7 @@ class Data extends \Magento\App\Helper\AbstractHelper $transport->sendMessage(); } - $this->_translator->setTranslateInline(true); + $this->inlineTranslation->resume(); return $this; } diff --git a/app/code/Magento/Checkout/Model/Agreement.php b/app/code/Magento/Checkout/Model/Agreement.php index 06c7cb3272971b7e58b562143f234adf3e5cbd8f..5f436f67389f79b698b2c093f558831d32b85c71 100644 --- a/app/code/Magento/Checkout/Model/Agreement.php +++ b/app/code/Magento/Checkout/Model/Agreement.php @@ -45,7 +45,7 @@ namespace Magento\Checkout\Model; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Agreement extends \Magento\Core\Model\AbstractModel +class Agreement extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Checkout/Model/Cart.php b/app/code/Magento/Checkout/Model/Cart.php index 0d83b4636360f0f167f583b3c546d7ad5c2933aa..174ca475a0b88d670f30cad3ef2da5512954338e 100644 --- a/app/code/Magento/Checkout/Model/Cart.php +++ b/app/code/Magento/Checkout/Model/Cart.php @@ -272,7 +272,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * * @param Product|int|string $productInfo * @return Product - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getProduct($productInfo) { @@ -294,7 +294,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI $product->getWebsiteIds() ) ) { - throw new \Magento\Core\Exception(__('We can\'t find the product.')); + throw new \Magento\Model\Exception(__('We can\'t find the product.')); } return $product; } @@ -328,7 +328,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param int|Product $productInfo * @param \Magento\Object|int|array $requestInfo * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProduct($productInfo, $requestInfo = null) { @@ -351,7 +351,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($productId) { try { $result = $this->getQuote()->addProduct($product, $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_checkoutSession->setUseNotice(false); $result = $e->getMessage(); } @@ -367,10 +367,10 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($this->_checkoutSession->getUseNotice() === null) { $this->_checkoutSession->setUseNotice(true); } - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } } else { - throw new \Magento\Core\Exception(__('The product does not exist.')); + throw new \Magento\Model\Exception(__('The product does not exist.')); } $this->_eventManager->dispatch( @@ -469,7 +469,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function updateItems($data) { @@ -494,7 +494,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI $itemInQuote = $this->getQuote()->getItemById($item->getId()); if (!$itemInQuote && $item->getHasError()) { - throw new \Magento\Core\Exception($item->getMessage()); + throw new \Magento\Model\Exception($item->getMessage()); } if (isset($itemInfo['before_suggest_qty']) && $itemInfo['before_suggest_qty'] != $qty) { @@ -644,7 +644,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI * @param int|array|\Magento\Object $requestInfo * @param null|array|\Magento\Object $updatingParams * @return \Magento\Sales\Model\Quote\Item|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see \Magento\Sales\Model\Quote::updateItem() */ @@ -653,7 +653,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI try { $item = $this->getQuote()->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__('This quote item does not exist.')); + throw new \Magento\Model\Exception(__('This quote item does not exist.')); } $productId = $item->getProduct()->getId(); $product = $this->_getProduct($productId); @@ -672,7 +672,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI } $result = $this->getQuote()->updateItem($itemId, $request, $updatingParams); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_checkoutSession->setUseNotice(false); $result = $e->getMessage(); } @@ -684,7 +684,7 @@ class Cart extends \Magento\Object implements \Magento\Checkout\Model\Cart\CartI if ($this->_checkoutSession->getUseNotice() === null) { $this->_checkoutSession->setUseNotice(true); } - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } $this->_eventManager->dispatch( diff --git a/app/code/Magento/Checkout/Model/Observer.php b/app/code/Magento/Checkout/Model/Observer.php index b76a51080a559a55adbe8c9dfbb60e9744977de2..5e4f8164625096d04b5c51fd6b2819872532f847 100644 --- a/app/code/Magento/Checkout/Model/Observer.php +++ b/app/code/Magento/Checkout/Model/Observer.php @@ -70,7 +70,7 @@ class Observer { try { $this->_checkoutSession->loadCustomerQuote(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Load customer quote error')); @@ -78,7 +78,7 @@ class Observer } /** - * @param Observer $observer + * @param \Magento\Event\Observer $observer * @return void */ public function salesQuoteSaveAfter($observer) diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement.php b/app/code/Magento/Checkout/Model/Resource/Agreement.php index 1a00d59e00c75618b99948666c6d8b7ec7a4911b..b81de86d77bcd7477f36cd5868c0efd437b9555d 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Agreement extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Filter\FilterManager @@ -62,10 +62,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run before save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { // format height $height = $object->getContentHeight(); @@ -83,10 +83,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run after save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $condition = array('agreement_id = ?' => $object->getId()); $this->_getWriteAdapter()->delete($this->getTable('checkout_agreement_store'), $condition); @@ -104,10 +104,10 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method to run after load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { $select = $this->_getReadAdapter()->select()->from( $this->getTable('checkout_agreement_store'), @@ -128,7 +128,7 @@ class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php index e30acc0cc6c97a00ef13dae5ed9fec3d074fbe7b..506fa2d9d0d872e14e03a399ceaeff2bb83754a1 100644 --- a/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php +++ b/app/code/Magento/Checkout/Model/Resource/Agreement/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource\Agreement; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var array diff --git a/app/code/Magento/Checkout/Model/Resource/Cart.php b/app/code/Magento/Checkout/Model/Resource/Cart.php index 5a998769a7f7aac2de796be48f74ecffd19fcc89..03bac206c72ab4a4b829481da29f3297fecc999e 100644 --- a/app/code/Magento/Checkout/Model/Resource/Cart.php +++ b/app/code/Magento/Checkout/Model/Resource/Cart.php @@ -32,7 +32,7 @@ namespace Magento\Checkout\Model\Resource; * @package Magento_Checkout * @author Magento Core Team <core@magentocommerce.com> */ -class Cart extends \Magento\Core\Model\Resource\Db\AbstractDb +class Cart extends \Magento\Model\Resource\Db\AbstractDb { /** * Model initialization diff --git a/app/code/Magento/Checkout/Model/Type/AbstractType.php b/app/code/Magento/Checkout/Model/Type/AbstractType.php index 14d23715b74dfcb67f0c3e4eebc6cbc6bfe4459a..beb19d77487b2c08df7922eeb87f4e09448ff44b 100644 --- a/app/code/Magento/Checkout/Model/Type/AbstractType.php +++ b/app/code/Magento/Checkout/Model/Type/AbstractType.php @@ -86,12 +86,7 @@ abstract class AbstractType extends \Magento\Object */ public function getCheckoutSession() { - $checkout = $this->getData('checkout_session'); - if (is_null($checkout)) { - $checkout = $this->_checkoutSession; - $this->setData('checkout_session', $checkout); - } - return $checkout; + return $this->_checkoutSession; } /** diff --git a/app/code/Magento/Checkout/Model/Type/Onepage.php b/app/code/Magento/Checkout/Model/Type/Onepage.php index 840091962345282921b4a902bd4d40b55b1a22b7..d96ff08318b6d3490c943fa30cda5279faabc9d5 100644 --- a/app/code/Magento/Checkout/Model/Type/Onepage.php +++ b/app/code/Magento/Checkout/Model/Type/Onepage.php @@ -720,18 +720,18 @@ class Onepage * Validate quote state to be integrated with one page checkout process * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function validate() { $quote = $this->getQuote(); if ($quote->isMultipleShippingAddresses()) { - throw new \Magento\Core\Exception(__('There are more than one shipping address.')); + throw new \Magento\Model\Exception(__('There are more than one shipping address.')); } if ($quote->getCheckoutMethod() == self::METHOD_GUEST && !$this->_helper->isAllowedGuestCheckout($quote)) { - throw new \Magento\Core\Exception(__('Sorry, guest checkout is not enabled.')); + throw new \Magento\Model\Exception(__('Sorry, guest checkout is not enabled.')); } } diff --git a/app/code/Magento/Checkout/etc/module.xml b/app/code/Magento/Checkout/etc/module.xml index 9e017c012420c8f3b32f077377c7a87c4fd97356..7d8b94585ac5e7b9d063d9cfef44142447692cc2 100644 --- a/app/code/Magento/Checkout/etc/module.xml +++ b/app/code/Magento/Checkout/etc/module.xml @@ -43,7 +43,6 @@ <module name="Magento_Wishlist"/> <module name="Magento_Weee"/> <module name="Magento_Backend"/> - <module name="Magento_Theme"/> <module name="Magento_Service"/> <module name="Magento_PageCache"/> </depends> diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Page.php b/app/code/Magento/Cms/Controller/Adminhtml/Page.php index 6c3942777af322a4bae785bb76c060a052b3e11f..1558c20dfa33149b430daa7c94b238ad280f7cd9 100644 --- a/app/code/Magento/Cms/Controller/Adminhtml/Page.php +++ b/app/code/Magento/Cms/Controller/Adminhtml/Page.php @@ -198,7 +198,7 @@ class Page extends \Magento\Backend\App\Action // go to grid $this->_redirect('*/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong while saving the page.')); diff --git a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php index 1670d97f3174895d5c812c8a908a9cfda104f7e4..2277e05a14d32b19423379d4bae9b324220019ec 100644 --- a/app/code/Magento/Cms/Helper/Wysiwyg/Images.php +++ b/app/code/Magento/Cms/Helper/Wysiwyg/Images.php @@ -216,7 +216,7 @@ class Images extends \Magento\App\Helper\AbstractHelper * Try to create target directory if it doesn't exist * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCurrentPath() { @@ -236,7 +236,7 @@ class Images extends \Magento\App\Helper\AbstractHelper } } catch (\Magento\Filesystem\FilesystemException $e) { $message = __('The directory %1 is not writable by server.', $currentPath); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } $this->_currentPath = $currentPath; } diff --git a/app/code/Magento/Cms/Model/Block.php b/app/code/Magento/Cms/Model/Block.php index 481941f2541e0f39ebb97c026b02d2d9b5811e97..e85e19ef652b8b4096dca6be2e1afd8c46e07835 100644 --- a/app/code/Magento/Cms/Model/Block.php +++ b/app/code/Magento/Cms/Model/Block.php @@ -43,7 +43,7 @@ namespace Magento\Cms\Model; * @method int getIsActive() * @method \Magento\Cms\Model\Block setIsActive(int $value) */ -class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Block extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * CMS block cache tag @@ -73,8 +73,8 @@ class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object /** * Prevent blocks recursion * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -82,7 +82,7 @@ class Block extends \Magento\Core\Model\AbstractModel implements \Magento\Object if (false == strstr($this->getContent(), $needle)) { return parent::_beforeSave(); } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Make sure that static block content does not reference the block itself.') ); } diff --git a/app/code/Magento/Cms/Model/Page.php b/app/code/Magento/Cms/Model/Page.php index 7105114e9928708ef414dbf104b64912d7d5fe8f..a0d812747ab3e00846fd7d4d92e8e9c69a2b2532 100644 --- a/app/code/Magento/Cms/Model/Page.php +++ b/app/code/Magento/Cms/Model/Page.php @@ -65,7 +65,7 @@ namespace Magento\Cms\Model; * @method string getCustomThemeTo() * @method \Magento\Cms\Model\Page setCustomThemeTo(string $value) */ -class Page extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Page extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * No route page id diff --git a/app/code/Magento/Cms/Model/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Page/Urlrewrite.php index 926156b483cb18c933d080ea432129c35c1b68ce..d1975756b0275b672b1e4d622ecb5f8c1d75c2de 100644 --- a/app/code/Magento/Cms/Model/Page/Urlrewrite.php +++ b/app/code/Magento/Cms/Model/Page/Urlrewrite.php @@ -34,7 +34,7 @@ namespace Magento\Cms\Model\Page; * @method \Magento\Cms\Model\Page\Urlrewrite setCmsPageId() setCmsPageId(int) * @method \Magento\Cms\Model\Page\Urlrewrite setUrlRewriteId() setUrlRewriteId(int) */ -class Urlrewrite extends \Magento\Core\Model\AbstractModel +class Urlrewrite extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/Cms/Model/Resource/Block.php b/app/code/Magento/Cms/Model/Resource/Block.php index 02609aac090bb4431c144424ba8fa6f1f9af479f..6e09e906d4833ccc8e295797ca401dced947722a 100644 --- a/app/code/Magento/Cms/Model/Resource/Block.php +++ b/app/code/Magento/Cms/Model/Resource/Block.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource; /** * CMS block model */ -class Block extends \Magento\Core\Model\Resource\Db\AbstractDb +class Block extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime @@ -72,10 +72,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process block data before deleting * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\Cms\Model\Resource\Page */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { $condition = array('block_id = ?' => (int)$object->getId()); @@ -87,14 +87,14 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$this->getIsUniqueBlockToStores($object)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('A block identifier with the same properties already exists in the selected store.') ); } @@ -109,10 +109,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $oldStores = $this->lookupStoreIds($object->getId()); $newStores = (array)$object->getStores(); @@ -143,12 +143,12 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load an object using 'identifier' field if there's no field specified and value is not numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (!is_numeric($value) && is_null($field)) { $field = 'identifier'; @@ -160,10 +160,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if ($object->getId()) { $stores = $this->lookupStoreIds($object->getId()); @@ -212,10 +212,10 @@ class Block extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check for unique of identifier of block to selected store(s). * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - public function getIsUniqueBlockToStores(\Magento\Core\Model\AbstractModel $object) + public function getIsUniqueBlockToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore()) { $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); diff --git a/app/code/Magento/Cms/Model/Resource/Block/Collection.php b/app/code/Magento/Cms/Model/Resource/Block/Collection.php index d8a707580a9a9d8776786be076434c2faaa76ba8..6c58d6661827e9cc1addd499dda082c89d9342e7 100644 --- a/app/code/Magento/Cms/Model/Resource/Block/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Block/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Block; /** * CMS block model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Cms/Model/Resource/Page.php b/app/code/Magento/Cms/Model/Resource/Page.php index 8b9b4b4e2669c2e64e9272504d9637bb2765c49f..ee8cc0a11a99c11c74867270f6651d7d4d8c1c81 100644 --- a/app/code/Magento/Cms/Model/Resource/Page.php +++ b/app/code/Magento/Cms/Model/Resource/Page.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource; /** * Cms page mysql resource */ -class Page extends \Magento\Core\Model\Resource\Db\AbstractDb +class Page extends \Magento\Model\Resource\Db\AbstractDb { /** * Store model @@ -95,10 +95,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process page data before deleting * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { $condition = array('page_id = ?' => (int)$object->getId()); @@ -110,11 +110,11 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process page data before saving * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { /* * For two attributes which represent timestamp data in DB @@ -132,15 +132,15 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb } if (!$this->getIsUniquePageToStores($object)) { - throw new \Magento\Core\Exception(__('A page URL key for specified store already exists.')); + throw new \Magento\Model\Exception(__('A page URL key for specified store already exists.')); } if (!$this->isValidPageIdentifier($object)) { - throw new \Magento\Core\Exception(__('The page URL key contains capital letters or disallowed symbols.')); + throw new \Magento\Model\Exception(__('The page URL key contains capital letters or disallowed symbols.')); } if ($this->isNumericPageIdentifier($object)) { - throw new \Magento\Core\Exception(__('The page URL key cannot be made of only numbers.')); + throw new \Magento\Model\Exception(__('The page URL key cannot be made of only numbers.')); } // modify create / update dates @@ -156,10 +156,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Assign page to store views * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $oldStores = $this->lookupStoreIds($object->getId()); $newStores = (array)$object->getStores(); @@ -192,12 +192,12 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load an object using 'identifier' field if there's no field specified and value is not numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (!is_numeric($value) && is_null($field)) { $field = 'identifier'; @@ -209,10 +209,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform operations after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if ($object->getId()) { $stores = $this->lookupStoreIds($object->getId()); @@ -291,10 +291,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check for unique of identifier of page to selected store(s). * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - public function getIsUniquePageToStores(\Magento\Core\Model\AbstractModel $object) + public function getIsUniquePageToStores(\Magento\Model\AbstractModel $object) { if ($this->_storeManager->hasSingleStore() || !$object->hasStores()) { $stores = array(\Magento\Core\Model\Store::DEFAULT_STORE_ID); @@ -318,10 +318,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check whether page identifier is numeric * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - protected function isNumericPageIdentifier(\Magento\Core\Model\AbstractModel $object) + protected function isNumericPageIdentifier(\Magento\Model\AbstractModel $object) { return preg_match('/^[0-9]+$/', $object->getData('identifier')); } @@ -329,10 +329,10 @@ class Page extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check whether page identifier is valid * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ - protected function isValidPageIdentifier(\Magento\Core\Model\AbstractModel $object) + protected function isValidPageIdentifier(\Magento\Model\AbstractModel $object) { return preg_match('/^[a-z0-9][a-z0-9_\/-]+(\.[a-z0-9_-]+)?$/', $object->getData('identifier')); } diff --git a/app/code/Magento/Cms/Model/Resource/Page/Collection.php b/app/code/Magento/Cms/Model/Resource/Page/Collection.php index 4bd37f0b4b1f2f52b7363da4091d2cd4ad42046e..82266142b42f47437aa325f548edf0da48a3dc27 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Collection.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * CMS page collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Load data for preview flag @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -60,7 +60,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Cms/Model/Resource/Page/Service.php b/app/code/Magento/Cms/Model/Resource/Page/Service.php index f086a414dc0a28d309fc7b17ef13662b8d31e4e7..6abea9a00e3916ce167a6c13932c13a659a1bb0a 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Service.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Service.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * Cms page service resource model */ -class Service extends \Magento\Core\Model\Resource\Db\AbstractDb +class Service extends \Magento\Model\Resource\Db\AbstractDb { /** * Init cms page service model diff --git a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php index c9affbccfb6ec40f09906ac43097383e1fdb62c2..f859a465cc66cf93f4176f9cf18018f85dad4843 100644 --- a/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php +++ b/app/code/Magento/Cms/Model/Resource/Page/Urlrewrite.php @@ -28,7 +28,7 @@ namespace Magento\Cms\Model\Resource\Page; /** * Cms page url rewrite resource model */ -class Urlrewrite extends \Magento\Core\Model\Resource\Db\AbstractDb +class Urlrewrite extends \Magento\Model\Resource\Db\AbstractDb { /** * Init cms page urlrewrite model diff --git a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php index 6fbccb158936fcd6301113753cb9c2f54353c9c4..8f5cad2c4fe1086e851d0005f182c349ab8eaa54 100644 --- a/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php +++ b/app/code/Magento/Cms/Model/Wysiwyg/Images/Storage.php @@ -353,12 +353,12 @@ class Storage extends \Magento\Object * @param string $name New directory name * @param string $path Parent directory path * @return array New directory info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createDirectory($name, $path) { if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please correct the folder name. Use only letters, numbers, underscores and dashes.') ); } @@ -371,7 +371,7 @@ class Storage extends \Magento\Object $newPath = $path . '/' . $name; $relativeNewPath = $this->_directory->getRelativePath($newPath); if ($this->_directory->isDirectory($relativeNewPath)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found a directory with the same name. Please try another folder name.') ); } @@ -391,7 +391,7 @@ class Storage extends \Magento\Object ); return $result; } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('We cannot create a new directory.')); + throw new \Magento\Model\Exception(__('We cannot create a new directory.')); } } @@ -400,7 +400,7 @@ class Storage extends \Magento\Object * * @param string $path Target dir * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteDirectory($path) { @@ -412,7 +412,7 @@ class Storage extends \Magento\Object $path = $this->getThumbnailRoot() . $this->_getRelativePathToRoot($path); $this->_deleteByPath($path); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('We cannot delete directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete directory %1.', $path)); } } @@ -462,7 +462,7 @@ class Storage extends \Magento\Object * @param string $targetPath Target directory * @param string $type Type of storage, e.g. image, media etc. * @return array File info Array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadFile($targetPath, $type = null) { @@ -477,7 +477,7 @@ class Storage extends \Magento\Object $result = $uploader->save($targetPath); if (!$result) { - throw new \Magento\Core\Exception(__('We cannot upload the file.')); + throw new \Magento\Model\Exception(__('We cannot upload the file.')); } // create thumbnail @@ -699,16 +699,16 @@ class Storage extends \Magento\Object * * @param string $path * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validatePath($path) { $root = $this->_sanitizePath($this->_cmsWysiwygImages->getStorageRoot()); if ($root == $path) { - throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete root directory %1.', $path)); } if (strpos($path, $root) !== 0) { - throw new \Magento\Core\Exception(__('Directory %1 is not under storage root path.', $path)); + throw new \Magento\Model\Exception(__('Directory %1 is not under storage root path.', $path)); } } diff --git a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php index a378517648bb2203079e56eabef699e52da77004..2d9df1edd29357d702969411ec50aa1fd6bcce02 100644 --- a/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Block/Product/View/Type/Configurable.php @@ -27,6 +27,7 @@ namespace Magento\ConfigurableProduct\Block\Product\View\Type; use Magento\Catalog\Model\Product\PriceModifierInterface; use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -60,14 +61,14 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView protected $_jsonEncoder; /** - * @var \Magento\Catalog\Helper\Image + * @var \Magento\Catalog\Helper\Product\Price */ - protected $_imageHelper; + protected $priceHelper; /** - * @var \Magento\Catalog\Helper\Product\Price + * @var CustomerAccountService */ - protected $priceHelper; + protected $_customerAccountService; /** * @var \Magento\Catalog\Model\Product\PriceModifierInterface @@ -91,48 +92,30 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView * @param \Magento\Catalog\Helper\Product $catalogProduct * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param \Magento\Catalog\Model\Product\PriceModifierInterface $priceModifier + * @param CustomerAccountService $customerAccountService * @param array $data * @param array $priceBlockTypes * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Helper\Product $catalogProduct, \Magento\Catalog\Helper\Product\Price $priceHelper, + CustomerAccountService $customerAccountService, PriceModifierInterface $priceModifier, array $data = array(), array $priceBlockTypes = array() ) { - $this->_imageHelper = $imageHelper; $this->_catalogProduct = $catalogProduct; $this->_jsonEncoder = $jsonEncoder; $this->priceHelper = $priceHelper; $this->priceModifier = $priceModifier; + $this->_customerAccountService = $customerAccountService; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes @@ -321,9 +304,12 @@ class Configurable extends \Magento\Catalog\Block\Product\View\AbstractView } } - if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER) + + if (is_null($this->priceHelper->getCustomer()->getId()) + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) ) { - $this->priceHelper->setCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER)); + $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->priceHelper->setCustomer($this->_customerAccountService->getCustomer($customerId)); } $_request = $this->priceHelper->getRateRequest(false, false, false); diff --git a/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php b/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php index 6d6efe9979e916a1eca1206b9072844e42b1975a..fcbac59d429a598e7c2c77f1ec28a2fa57ea161d 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php +++ b/app/code/Magento/ConfigurableProduct/Model/Attribute/LockValidator.php @@ -43,13 +43,13 @@ class LockValidator implements LockValidatorInterface /** * Check attribute lock state * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param null $attributeSet - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @return void */ - public function validate(\Magento\Core\Model\AbstractModel $object, $attributeSet = null) + public function validate(\Magento\Model\AbstractModel $object, $attributeSet = null) { $adapter = $this->resource->getConnection('read'); $attrTable = $this->resource->getTableName('catalog_product_super_attribute'); @@ -77,7 +77,7 @@ class LockValidator implements LockValidatorInterface } if ($adapter->fetchOne($select, $bind)) { - throw new \Magento\Core\Exception(__('This attribute is used in configurable products.')); + throw new \Magento\Model\Exception(__('This attribute is used in configurable products.')); } } } diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php index 66079b7bd7ae44e9b61de479dcb4010076bf3946..c11a465980070527dd259099d14cb5337998d583 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php @@ -803,7 +803,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -820,7 +820,7 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType } } if (empty($attributes)) { - throw new \Magento\Core\Exception($this->getSpecifyOptionMessage()); + throw new \Magento\Model\Exception($this->getSpecifyOptionMessage()); } } return $this; diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php index c1cf918e76cd4c5953687586953a03ca2d74f02c..8eb6401706f75e7b37a6095a5ef78f583bfc07d3 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable/Attribute.php @@ -37,7 +37,7 @@ namespace Magento\ConfigurableProduct\Model\Product\Type\Configurable; * @method Attribute setProductAttribute(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $value) * @method \Magento\Eav\Model\Entity\Attribute\AbstractAttribute getProductAttribute() */ -class Attribute extends \Magento\Core\Model\AbstractModel +class Attribute extends \Magento\Model\AbstractModel { /** * Initialize resource model diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php index 8b86dfd8b5b46812c0601873d04bc84dc4b6cc34..4eb75a09e5bcd3aca63e0448969ae20f5e136469 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable.php @@ -25,7 +25,7 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type; -class Configurable extends \Magento\Core\Model\Resource\Db\AbstractDb +class Configurable extends \Magento\Model\Resource\Db\AbstractDb { /** * Catalog product relation diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php index b72c0c90d08bd3400b22f8ffac7e427ef725b660..26baad63213b611c9f7ade26a30fdff26aa00cc0 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute.php @@ -25,7 +25,7 @@ */ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable; -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Label table name cache diff --git a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php index 073a180ee5ac842a0c13c9aab7b9ccc9c97eb722..3d77f0eec6be87d9fce88ef5a38be881f4871eb7 100644 --- a/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php +++ b/app/code/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/Attribute/Collection.php @@ -28,7 +28,7 @@ namespace Magento\ConfigurableProduct\Model\Resource\Product\Type\Configurable\A /** * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Configurable attributes label table name diff --git a/app/code/Magento/ConfigurableProduct/etc/module.xml b/app/code/Magento/ConfigurableProduct/etc/module.xml index ebf21c52ff73d21b1ba54ac9e74dfde10bfe67b4..1536277354743fdc6954567ea7cdc56057b5b868 100644 --- a/app/code/Magento/ConfigurableProduct/etc/module.xml +++ b/app/code/Magento/ConfigurableProduct/etc/module.xml @@ -37,9 +37,7 @@ <module name="Magento_CatalogInventory" /> <module name="Magento_Sales" /> <module name="Magento_Core" /> - <module name="Magento_Tax" /> <module name="Magento_Checkout" /> - <module name="Magento_Wishlist" /> <module name="Magento_Theme" /> <module name="Magento_Backend" /> <module name="Magento_Eav" /> diff --git a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php index 22190e370652ea15956090315bb95b3a37a8114e..108c7b7de6cdd3380e1c9bc9f92bf36d4c9a4ce4 100644 --- a/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php +++ b/app/code/Magento/Connect/Controller/Adminhtml/Extension/Custom.php @@ -85,7 +85,7 @@ class Custom extends \Magento\Backend\App\Action try { $data = $this->_objectManager->get('Magento\Connect\Helper\Data')->loadLocalPackage($packageName); if (!$data) { - throw new \Magento\Core\Exception(__('Something went wrong loading the package data.')); + throw new \Magento\Model\Exception(__('Something went wrong loading the package data.')); } $data = array_merge($data, array('file_name' => $packageName)); $session->setCustomExtensionPackageFormData($data); @@ -132,7 +132,7 @@ class Custom extends \Magento\Backend\App\Action } else { $this->_forward('create'); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch (\Exception $e) { @@ -164,7 +164,7 @@ class Custom extends \Magento\Backend\App\Action } } $this->_redirect('adminhtml/*'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*'); } catch (\Exception $e) { diff --git a/app/code/Magento/Connect/Model/Extension.php b/app/code/Magento/Connect/Model/Extension.php index aa63b0a615837603d9448e96a59975b6744c1d87..182f244818c9f633c7e65e4085e36a32328c66b7 100644 --- a/app/code/Magento/Connect/Model/Extension.php +++ b/app/code/Magento/Connect/Model/Extension.php @@ -112,7 +112,7 @@ class Extension extends \Magento\Object * Set package object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function generatePackageXml() { @@ -121,7 +121,7 @@ class Extension extends \Magento\Object $this->_setPackage()->_setRelease()->_setAuthors()->_setDependencies()->_setContents(); if (!$this->getPackage()->validate()) { $message = $this->getPackage()->getErrors(); - throw new \Magento\Core\Exception(__($message[0])); + throw new \Magento\Model\Exception(__($message[0])); } $this->setPackageXml($this->getPackage()->getPackageXml()); return $this; diff --git a/app/code/Magento/Contacts/Controller/Index.php b/app/code/Magento/Contacts/Controller/Index.php index 75a1b8a2755e27b05cc586e3d6291fc70a85fdef..3797bee1694e0d7faa98e5413b7befae13efa6d0 100644 --- a/app/code/Magento/Contacts/Controller/Index.php +++ b/app/code/Magento/Contacts/Controller/Index.php @@ -51,16 +51,24 @@ class Index extends \Magento\App\Action\Action */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { parent::__construct($context); $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; } /** @@ -110,9 +118,7 @@ class Index extends \Magento\App\Action\Action } $post = $this->getRequest()->getPost(); if ($post) { - $translate = $this->_objectManager->get('Magento\TranslateInterface'); - /* @var $translate \Magento\TranslateInterface */ - $translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); try { $postObject = new \Magento\Object(); $postObject->setData($post); @@ -160,7 +166,7 @@ class Index extends \Magento\App\Action\Action $transport->sendMessage(); - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addSuccess( __('Thanks for contacting us with your comments and questions. We\'ll respond to you very soon.') @@ -169,7 +175,7 @@ class Index extends \Magento\App\Action\Action return; } catch (\Exception $e) { - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addError( __('We can\'t process your request right now. Sorry, that\'s all we know.') ); diff --git a/app/code/Magento/Core/App/Media.php b/app/code/Magento/Core/App/Media.php index ed02ec0db153d400b9c192de2c1b0f1244b0a2a9..0e6ee61c19262736a0ebc223cacf901fb6d6720b 100644 --- a/app/code/Magento/Core/App/Media.php +++ b/app/code/Magento/Core/App/Media.php @@ -26,12 +26,12 @@ namespace Magento\Core\App; use Magento\App\State; -use Magento\LauncherInterface; +use Magento\AppInterface; use Magento\ObjectManager; use Magento\Core\Model\File\Storage\Request; use Magento\Core\Model\File\Storage\Response; -class Media implements LauncherInterface +class Media implements AppInterface { /** * @var \Magento\App\State diff --git a/app/code/Magento/Core/Controller/Ajax.php b/app/code/Magento/Core/Controller/Ajax.php deleted file mode 100644 index 655743862ace740fdc22a56751fa9cb9f9cd77b0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Controller/Ajax.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - */ -namespace Magento\Core\Controller; - -class Ajax extends \Magento\App\Action\Action -{ - /** - * Ajax action for inline translation - * - * @return void - */ - public function translateAction() - { - $translationParams = (array)$this->getRequest()->getPost('translate'); - $area = $this->getRequest()->getPost('area'); - /** @var \Magento\Core\Helper\Translate $translationHelper */ - $translationHelper = $this->_objectManager->get('Magento\Core\Helper\Translate'); - $response = $translationHelper->apply($translationParams, $area); - $this->getResponse()->setBody($response); - $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); - } -} diff --git a/app/code/Magento/Core/Helper/Data.php b/app/code/Magento/Core/Helper/Data.php index 271d3663afdbf08cffca6bdaff76f804974684a1..f057e775345a1b6cc3f8a8a8fbb722de98384c2e 100644 --- a/app/code/Magento/Core/Helper/Data.php +++ b/app/code/Magento/Core/Helper/Data.php @@ -226,11 +226,7 @@ class Data extends \Magento\App\Helper\AbstractHelper public function jsonEncode($valueToEncode, $cycleCheck = false, $options = array()) { $json = \Zend_Json::encode($valueToEncode, $cycleCheck, $options); - $translateInline = $this->_inlineFactory->get(); - if ($translateInline->isAllowed()) { - $translateInline->processResponseBody($json, true); - } - + $this->translateInline->processResponseBody($json, true); return $json; } diff --git a/app/code/Magento/Core/Helper/File/Media.php b/app/code/Magento/Core/Helper/File/Media.php index c8508b598b3237e159ef66046f7239dd3f3e50d7..ac82cbec2115e67585da70024df86ff7729f53e2 100644 --- a/app/code/Magento/Core/Helper/File/Media.php +++ b/app/code/Magento/Core/Helper/File/Media.php @@ -69,7 +69,7 @@ class Media extends \Magento\App\Helper\AbstractHelper * @param string $mediaDirectory * @param string $path * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function collectFileInfo($mediaDirectory, $path) { @@ -79,10 +79,10 @@ class Media extends \Magento\App\Helper\AbstractHelper $dir = $this->filesystem->getDirectoryRead(\Magento\App\Filesystem::MEDIA_DIR); $relativePath = $dir->getRelativePath($fullPath); if (!$dir->isFile($relativePath)) { - throw new \Magento\Core\Exception(__('File %1 does not exist', $fullPath)); + throw new \Magento\Model\Exception(__('File %1 does not exist', $fullPath)); } if (!$dir->isReadable($relativePath)) { - throw new \Magento\Core\Exception(__('File %1 is not readable', $fullPath)); + throw new \Magento\Model\Exception(__('File %1 is not readable', $fullPath)); } $path = str_replace(array('/', '\\'), '/', $path); diff --git a/app/code/Magento/Core/Helper/File/Storage.php b/app/code/Magento/Core/Helper/File/Storage.php index 745f116609c85e42de18054d924756ef91c67284..fa0fe188804e959b1d095dab5a8e0e07c968f277 100644 --- a/app/code/Magento/Core/Helper/File/Storage.php +++ b/app/code/Magento/Core/Helper/File/Storage.php @@ -139,7 +139,7 @@ class Storage extends \Magento\App\Helper\AbstractHelper * * @param int|null $storage * @param array $params - * @return \Magento\Core\Model\AbstractModel|bool + * @return \Magento\Model\AbstractModel|bool */ public function getStorageModel($storage = null, $params = array()) { diff --git a/app/code/Magento/Core/Helper/Js.php b/app/code/Magento/Core/Helper/Js.php index 7e94efea9b06e231b655b55ac2038baa44340af2..d5d2c51e8b6a66967549a270320066f69142df30 100644 --- a/app/code/Magento/Core/Helper/Js.php +++ b/app/code/Magento/Core/Helper/Js.php @@ -36,45 +36,25 @@ class Js extends \Magento\App\Helper\AbstractHelper * * @var array */ - protected $_translateData = null; + protected $_translateData = []; /** * @var \Magento\View\Url */ protected $_viewUrl; - /** - * Core data - * - * @var \Magento\Core\Helper\Data - */ - protected $_coreData = null; - /** * @param \Magento\App\Helper\Context $context - * @param \Magento\Core\Helper\Data $coreData * @param \Magento\View\Url $viewUrl */ public function __construct( \Magento\App\Helper\Context $context, - \Magento\Core\Helper\Data $coreData, \Magento\View\Url $viewUrl ) { - $this->_coreData = $coreData; parent::__construct($context); $this->_viewUrl = $viewUrl; } - /** - * Retrieve JSON of JS sentences translation - * - * @return string - */ - public function getTranslateJson() - { - return $this->_coreData->jsonEncode($this->getTranslateData()); - } - /** * Retrieve JS translator initialization javascript * @@ -82,7 +62,9 @@ class Js extends \Magento\App\Helper\AbstractHelper */ public function getTranslatorScript() { - $script = '(function($) {$.mage.translate.add(' . $this->getTranslateJson() . ')})(jQuery);'; + $script = '(function($) {$.mage.translate.add(' + . $this->encode($this->getTranslateData()) + . ')})(jQuery);'; return $this->getScript($script); } @@ -115,8 +97,7 @@ class Js extends \Magento\App\Helper\AbstractHelper */ public function getTranslateData() { - if ($this->_translateData === null) { - $this->_translateData = array(); + if (!$this->_translateData) { $this->_populateTranslateData(); } return $this->_translateData; @@ -470,4 +451,17 @@ class Js extends \Magento\App\Helper\AbstractHelper $this->_translateData[$key] = $translatedText; } } + + /** + * Encode the mixed $data into the JSON format. + * + * @param mixed $data + * @return string + */ + public function encode($data) + { + $json = \Zend_Json::encode($data); + $this->translateInline->processResponseBody($json, false); + return $json; + } } diff --git a/app/code/Magento/Core/Helper/Url/Rewrite.php b/app/code/Magento/Core/Helper/Url/Rewrite.php index 3b86260399c17e1711b830be1f85ef52b8e2b2c5..d6f5b33c8de30c039042cc5e487ee651746c8745 100644 --- a/app/code/Magento/Core/Helper/Url/Rewrite.php +++ b/app/code/Magento/Core/Helper/Url/Rewrite.php @@ -90,7 +90,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper * Either returns TRUE (success) or throws error (validation failed) * * @param string $requestPath - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validateRequestPath($requestPath) @@ -98,7 +98,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper try { $this->_validateRequestPath($requestPath); } catch (\Exception $e) { - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } return true; } @@ -108,7 +108,7 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper * Either returns TRUE (success) or throws error (validation failed) * * @param string $suffix - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function validateSuffix($suffix) @@ -120,11 +120,11 @@ class Rewrite extends \Magento\App\Helper\AbstractHelper // Make message saying about suffix, not request path switch ($e->getCode()) { case self::VERR_MANYSLASHES: - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Two and more slashes together are not permitted in url rewrite suffix') ); case self::VERR_ANCHOR: - throw new \Magento\Core\Exception(__('Anchor symbol (#) is not supported in url rewrite suffix')); + throw new \Magento\Model\Exception(__('Anchor symbol (#) is not supported in url rewrite suffix')); } } return true; diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php deleted file mode 100644 index b8c919830afdf7511b0c9104b0a70d1ef6699344..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/App.php +++ /dev/null @@ -1,479 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -/** - * Application model - * - * Application should have: areas, store, locale, translator, design package - */ -class App implements \Magento\AppInterface -{ - /**#@+ - * Product edition labels - */ - const EDITION_COMMUNITY = 'Community'; - - const EDITION_ENTERPRISE = 'Enterprise'; - - /**#@-*/ - - /** - * Current Magento edition. - * - * @var string - * @static - */ - protected $_currentEdition = self::EDITION_COMMUNITY; - - /** - * Magento version - */ - const VERSION = '2.0.0.0-dev70'; - - /** - * Application run code - */ - const PARAM_RUN_CODE = 'MAGE_RUN_CODE'; - - /** - * Application run type (store|website) - */ - const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE'; - - /** - * Disallow cache - */ - const PARAM_BAN_CACHE = 'global_ban_use_cache'; - - /** - * Allowed modules - */ - const PARAM_ALLOWED_MODULES = 'allowed_modules'; - - /** - * Caching params, that applied for all cache frontends regardless of type - */ - const PARAM_CACHE_FORCED_OPTIONS = 'cache_options'; - - /** - * Application loaded areas array - * - * @var array - */ - protected $_areas = array(); - - /** - * Application configuration object - * - * @var \Magento\App\ConfigInterface - */ - protected $_config; - - /** - * Cache object - * - * @var \Magento\App\CacheInterface - */ - protected $_cache; - - /** - * Request object - * - * @var \Magento\App\RequestInterface - */ - protected $_request; - - /** - * Response object - * - * @var \Magento\App\ResponseInterface - */ - protected $_response; - - /** - * Object manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Data base updater object - * - * @var \Magento\Module\UpdaterInterface - */ - protected $_dbUpdater; - - /** - * @var \Magento\App\State - */ - protected $_appState; - - /** - * @var \Magento\Event\ManagerInterface - */ - protected $_eventManager; - - /** - * @var \Magento\Config\Scope - */ - protected $_configScope; - - /** - * @param \Magento\App\ConfigInterface $config - * @param \Magento\App\CacheInterface $cache - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\App\State $appState - * @param \Magento\Config\Scope $configScope - */ - public function __construct( - \Magento\App\ConfigInterface $config, - \Magento\App\CacheInterface $cache, - \Magento\ObjectManager $objectManager, - \Magento\Event\ManagerInterface $eventManager, - \Magento\App\State $appState, - \Magento\Config\Scope $configScope - ) { - $this->_config = $config; - $this->_cache = $cache; - $this->_objectManager = $objectManager; - $this->_appState = $appState; - $this->_eventManager = $eventManager; - $this->_configScope = $configScope; - } - - /** - * Throw an exception, if the application has not been installed yet - * - * @return void - * @throws \Magento\Exception - */ - public function requireInstalledInstance() - { - if (false == $this->_appState->isInstalled()) { - throw new \Magento\Exception('Application is not installed yet, please complete the installation first.'); - } - } - - /** - * Retrieve cookie object - * - * @return \Magento\Stdlib\Cookie - */ - public function getCookie() - { - return $this->_objectManager->get('Magento\Stdlib\Cookie'); - } - - /** - * Re-declare custom error handler - * - * @param string $handler - * @return $this - */ - public function setErrorHandler($handler) - { - set_error_handler($handler); - return $this; - } - - /** - * Loading part of area data - * - * @param string $area - * @param string $part - * @return $this - */ - public function loadAreaPart($area, $part) - { - $this->getArea($area)->load($part); - return $this; - } - - /** - * Retrieve application area - * - * @param string $code - * @return \Magento\Core\Model\App\Area - */ - public function getArea($code) - { - if (!isset($this->_areas[$code])) { - $this->_areas[$code] = $this->_objectManager->create( - 'Magento\Core\Model\App\Area', - array('areaCode' => $code) - ); - } - return $this->_areas[$code]; - } - - /** - * Get distro locale code - * - * @return string - */ - public function getDistroLocaleCode() - { - return self::DISTRO_LOCALE_CODE; - } - - /** - * Retrieve layout object - * - * @return \Magento\View\LayoutInterface - */ - public function getLayout() - { - return $this->_objectManager->get('Magento\View\LayoutInterface'); - } - - /** - * Retrieve application base currency code - * - * @return string - */ - public function getBaseCurrencyCode() - { - return $this->_config->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); - } - - /** - * Retrieve configuration object - * - * @return \Magento\App\ConfigInterface - */ - public function getConfig() - { - return $this->_config; - } - - /** - * Get core cache model - * - * @return \Magento\App\CacheInterface - */ - public function getCacheInstance() - { - return $this->_cache; - } - - /** - * Retrieve cache object - * - * @return \Magento\Cache\FrontendInterface - */ - public function getCache() - { - return $this->_cache->getFrontend(); - } - - /** - * Loading cache data - * - * @param string $cacheId - * @return string - */ - public function loadCache($cacheId) - { - return $this->_cache->load($cacheId); - } - - /** - * Saving cache data - * - * @param mixed $data - * @param string $cacheId - * @param array $tags - * @param bool $lifeTime - * @return $this - */ - public function saveCache($data, $cacheId, $tags = array(), $lifeTime = false) - { - $this->_cache->save($data, $cacheId, $tags, $lifeTime); - return $this; - } - - /** - * Remove cache - * - * @param string $cacheId - * @return $this - */ - public function removeCache($cacheId) - { - $this->_cache->remove($cacheId); - return $this; - } - - /** - * Cleaning cache - * - * @param array $tags - * @return $this - */ - public function cleanCache($tags = array()) - { - $this->_cache->clean($tags); - return $this; - } - - /** - * Deletes all session files - * - * @return $this - */ - public function cleanAllSessions() - { - if (session_module_name() == 'files') { - /** @var \Magento\App\Filesystem $filesystem */ - $filesystem = $this->_objectManager->create('Magento\App\Filesystem'); - $sessionDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::SESSION_DIR); - foreach ($sessionDirectory->read() as $path) { - $sessionDirectory->delete($path); - } - } - return $this; - } - - /** - * Retrieve request object - * - * @return \Magento\App\RequestInterface - */ - public function getRequest() - { - if (!$this->_request) { - $this->_request = $this->_objectManager->get('Magento\App\RequestInterface'); - } - return $this->_request; - } - - /** - * Request setter - * - * @param \Magento\App\RequestInterface $request - * @return $this - */ - public function setRequest(\Magento\App\RequestInterface $request) - { - $this->_request = $request; - return $this; - } - - /** - * Retrieve response object - * - * @return \Magento\App\ResponseInterface - */ - public function getResponse() - { - if (!$this->_response) { - $this->_response = $this->_objectManager->get('Magento\App\ResponseInterface'); - $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8'); - } - return $this->_response; - } - - /** - * Response setter - * - * @param \Magento\App\ResponseInterface $response - * @return $this - */ - public function setResponse(\Magento\App\ResponseInterface $response) - { - $this->_response = $response; - return $this; - } - - /** - * Check if developer mode is enabled - * - * @return bool - */ - public function isDeveloperMode() - { - return $this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER; - } - - /** - * Get current Magento edition - * - * @static - * @return string - */ - public function getEdition() - { - return $this->_currentEdition; - } - - /** - * Set edition - * - * @param string $edition - * @return void - */ - public function setEdition($edition) - { - $this->_currentEdition = $edition; - } - - /** - * Gets the current Magento version string - * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/ - * - * @return string - */ - public function getVersion() - { - $info = $this->getVersionInfo(); - return trim( - "{$info['major']}.{$info['minor']}.{$info['revision']}" . ($info['patch'] != - '' ? ".{$info['patch']}" : "") . "-{$info['stability']}{$info['number']}", - '.-' - ); - } - - /** - * Gets the detailed Magento version information - * @link http://www.magentocommerce.com/blog/new-community-edition-release-process/ - * - * @return array - */ - public function getVersionInfo() - { - return array( - 'major' => '2', - 'minor' => '0', - 'revision' => '0', - 'patch' => '0', - 'stability' => 'dev', - 'number' => '70', - ); - } -} diff --git a/app/code/Magento/Core/Model/App/Area.php b/app/code/Magento/Core/Model/App/Area.php index 819248628687c958deaa16872d2dd224c1f546c3..7460dae9e79ce4cb87309dcade9d4ce7663c8fb1 100644 --- a/app/code/Magento/Core/Model/App/Area.php +++ b/app/code/Magento/Core/Model/App/Area.php @@ -31,19 +31,13 @@ */ namespace Magento\Core\Model\App; -class Area +class Area implements \Magento\App\AreaInterface { const AREA_GLOBAL = 'global'; const AREA_FRONTEND = 'frontend'; - - const AREA_ADMIN = 'admin'; - - const PART_CONFIG = 'config'; - - const PART_TRANSLATE = 'translate'; - - const PART_DESIGN = 'design'; + + const AREA_ADMIN = 'admin'; /** * Area parameter. @@ -277,15 +271,10 @@ class Area */ protected function _initTranslate() { - $dispatchResult = new \Magento\Object(array('inline_type' => null, 'params' => array('area' => $this->_code))); - $eventManager = $this->_objectManager->get('Magento\Event\ManagerInterface'); - $eventManager->dispatch( - 'translate_initialization_before', - array('translate_object' => $this->_translator, 'result' => $dispatchResult) - ); - $this->_translator->init(null, $dispatchResult, false); + $this->_translator->loadData(null, false); \Magento\Phrase::setRenderer($this->_objectManager->get('Magento\Phrase\RendererInterface')); + return $this; } diff --git a/app/code/Magento/Core/Model/App/Emulation.php b/app/code/Magento/Core/Model/App/Emulation.php index d8c1179adb6c281b68334a1050cd940ecc3a496a..68341b83b7c1d5f4af33cd8b13c0b72354eb6716 100644 --- a/app/code/Magento/Core/Model/App/Emulation.php +++ b/app/code/Magento/Core/Model/App/Emulation.php @@ -46,14 +46,7 @@ class Emulation extends \Magento\Object protected $_translate; /** - * @var \Magento\Core\Helper\Translate - */ - protected $_helperTranslate; - - /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Core\Model\Store\ConfigInterface */ protected $_coreStoreConfig; @@ -68,18 +61,23 @@ class Emulation extends \Magento\Object protected $_design; /** - * @var \Magento\Translate\Inline\ConfigFactory + * @var \Magento\Translate\Inline\ConfigInterface + */ + protected $inlineConfig; + + /** + * @var \Magento\Translate\Inline\StateInterface */ - protected $_configFactory; + protected $inlineTranslation; /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Core\Model\Design $design * @param \Magento\TranslateInterface $translate - * @param \Magento\Core\Helper\Translate $helperTranslate - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Translate\Inline\ConfigFactory $configFactory + * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig + * @param \Magento\Translate\Inline\ConfigInterface $inlineConfig + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data */ @@ -88,9 +86,9 @@ class Emulation extends \Magento\Object \Magento\View\DesignInterface $viewDesign, \Magento\Core\Model\Design $design, \Magento\TranslateInterface $translate, - \Magento\Core\Helper\Translate $helperTranslate, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Translate\Inline\ConfigFactory $configFactory, + \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, + \Magento\Translate\Inline\ConfigInterface $inlineConfig, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() ) { @@ -100,9 +98,9 @@ class Emulation extends \Magento\Object $this->_viewDesign = $viewDesign; $this->_design = $design; $this->_translate = $translate; - $this->_helperTranslate = $helperTranslate; $this->_coreStoreConfig = $coreStoreConfig; - $this->_configFactory = $configFactory; + $this->inlineConfig = $inlineConfig; + $this->inlineTranslation = $inlineTranslation; } /** @@ -175,10 +173,11 @@ class Emulation extends \Magento\Object if (is_null($storeId)) { $newTranslateInline = false; } else { - $newTranslateInline = $this->_configFactory->get()->isActive($storeId); + $newTranslateInline = $this->inlineConfig->isActive($storeId); } - $translateInline = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline($newTranslateInline); + + $translateInline = $this->inlineTranslation->isEnabled(); + $this->inlineTranslation->suspend($newTranslateInline); return $translateInline; } @@ -223,7 +222,9 @@ class Emulation extends \Magento\Object $initialLocaleCode = $this->_localeResolver->getLocaleCode(); $newLocaleCode = $this->_coreStoreConfig->getConfig($this->_localeResolver->getDefaultLocalePath(), $storeId); $this->_localeResolver->setLocaleCode($newLocaleCode); - $this->_translate->initLocale($newLocaleCode, $area); + $this->_translate->setLocale($newLocaleCode) + ->loadData($area, true); + return $initialLocaleCode; } @@ -235,7 +236,7 @@ class Emulation extends \Magento\Object */ protected function _restoreInitialInlineTranslation($initialTranslate) { - $this->_translate->setTranslateInline($initialTranslate); + $this->inlineTranslation->resume($initialTranslate); return $this; } @@ -263,7 +264,9 @@ class Emulation extends \Magento\Object $initialArea = \Magento\Core\Model\App\Area::AREA_ADMIN ) { $this->_localeResolver->setLocaleCode($initialLocaleCode); - $this->_translate->initLocale($initialLocaleCode); + $this->_translate->setLocale($initialLocaleCode) + ->loadData($initialArea, true); + return $this; } } diff --git a/app/code/Magento/Core/Model/Config/Value.php b/app/code/Magento/Core/Model/Config/Value.php index 0fb2f2d32bc98e526c66ed8cf54c576b0e7c5237..fd8a6dd9b386ab0d9b057575157de7bf0c15af78 100644 --- a/app/code/Magento/Core/Model/Config/Value.php +++ b/app/code/Magento/Core/Model/Config/Value.php @@ -41,7 +41,7 @@ namespace Magento\Core\Model\Config; * * @SuppressWarnings(PHPMD.NumberOfChildren) */ -class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Config\ValueInterface +class Value extends \Magento\Model\AbstractModel implements \Magento\App\Config\ValueInterface { /** * Prefix of model events names @@ -74,7 +74,7 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -83,7 +83,7 @@ class Value extends \Magento\Core\Model\AbstractModel implements \Magento\App\Co \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Design.php b/app/code/Magento/Core/Model/Design.php index 9582b5d9bd06b100ea3f6bb07bb0155f9cfb001c..78db14650e9efd4d8e2d3f754852c5de3b3e0fea 100644 --- a/app/code/Magento/Core/Model/Design.php +++ b/app/code/Magento/Core/Model/Design.php @@ -25,7 +25,8 @@ */ namespace Magento\Core\Model; -use Magento\Core\Model\Resource\AbstractResource; +use Magento\Model\Resource\AbstractResource; +use Magento\Model\AbstractModel; /** * Design settings change model diff --git a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php index a507aa349fa5b45665f02c036b2494b908686b8e..b20dc5c4ae46973eecfe2825b3472211e6edc911 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Exceptions.php +++ b/app/code/Magento/Core/Model/Design/Backend/Exceptions.php @@ -40,7 +40,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -62,7 +62,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * Validate value * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * if there is no field value, search value is empty or regular expression is not valid */ protected function _beforeSave() @@ -78,7 +78,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS // Validate that all values have come foreach (array('search', 'value') as $fieldName) { if (!isset($row[$fieldName])) { - throw new \Magento\Core\Exception(__("Exception does not contain field '{$fieldName}'")); + throw new \Magento\Model\Exception(__("Exception does not contain field '{$fieldName}'")); } } @@ -104,7 +104,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS * * @param string $search * @return string - * @throws \Magento\Core\Exception on invalid regular expression + * @throws \Magento\Model\Exception on invalid regular expression */ protected function _composeRegexp($search) { @@ -115,7 +115,7 @@ class Exceptions extends \Magento\Backend\Model\Config\Backend\Serialized\ArrayS // Find out - whether user wanted to enter regexp or normal string. if ($this->_isRegexp($search)) { - throw new \Magento\Core\Exception(__('Invalid regular expression: "%1".', $search)); + throw new \Magento\Model\Exception(__('Invalid regular expression: "%1".', $search)); } return '/' . preg_quote($search, '/') . '/i'; diff --git a/app/code/Magento/Core/Model/Design/Backend/Theme.php b/app/code/Magento/Core/Model/Design/Backend/Theme.php index 3b86a49758dcbd0755db50ef2ca01051f1f7b4d7..3f0521e866ad670afbd3f7803a576be6798b90e4 100644 --- a/app/code/Magento/Core/Model/Design/Backend/Theme.php +++ b/app/code/Magento/Core/Model/Design/Backend/Theme.php @@ -40,7 +40,7 @@ class Theme extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\View\DesignInterface $design - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -50,7 +50,7 @@ class Theme extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\View\DesignInterface $design, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Factory.php b/app/code/Magento/Core/Model/Factory.php index 7b03fdd94cfcfc47a3b30db2a8cd1eff5d602c21..8ea5ffa34089ebfa7f604e0235cf2f460298749c 100644 --- a/app/code/Magento/Core/Model/Factory.php +++ b/app/code/Magento/Core/Model/Factory.php @@ -49,13 +49,13 @@ class Factory * @param string $model * @param array $data * @throws \InvalidArgumentException - * @return AbstractModel + * @return \Magento\Model\AbstractModel */ public function create($model, array $data = array()) { $modelInstance = $this->_objectManager->create($model, $data); - if (false == $modelInstance instanceof \Magento\Core\Model\AbstractModel) { - throw new \InvalidArgumentException($model . ' is not instance of \Magento\Core\Model\AbstractModel'); + if (false == $modelInstance instanceof \Magento\Model\AbstractModel) { + throw new \InvalidArgumentException($model . ' is not instance of \Magento\Model\AbstractModel'); } return $modelInstance; } diff --git a/app/code/Magento/Core/Model/File/Storage.php b/app/code/Magento/Core/Model/File/Storage.php index f49eef4bdb22466263490881a7358a69adfce15c..0702e2fa593800d4ee742f6c177a7ce44eb06cc6 100644 --- a/app/code/Magento/Core/Model/File/Storage.php +++ b/app/code/Magento/Core/Model/File/Storage.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\File; use Magento\App\Filesystem; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Class Storage @@ -113,7 +113,7 @@ class Storage extends AbstractModel * @param \Magento\Core\Model\File\Storage\FileFactory $fileFactory * @param \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -127,7 +127,7 @@ class Storage extends AbstractModel \Magento\Core\Model\File\Storage\FileFactory $fileFactory, \Magento\Core\Model\File\Storage\DatabaseFactory $databaseFactory, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/File/Storage/Database.php b/app/code/Magento/Core/Model/File/Storage/Database.php index 6113bf50106a4c4e69ac52b6e07d047e7a565c5c..b97f8ba0b04dc1c6e190f3b9927d81099dfd2834 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Database.php @@ -66,12 +66,12 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Core\Helper\File\Media $mediaHelper * @param \Magento\Core\Model\Resource\File\Storage\Database $resource - * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory + * @param Directory\DatabaseFactory $directoryFactory * @param \Magento\Data\Collection\Db $resourceCollection - * @param string|null $connectionName + * @param null $connectionName * @param array $data */ public function __construct( @@ -79,7 +79,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Core\Helper\File\Media $mediaHelper, \Magento\Core\Model\Resource\File\Storage\Database $resource, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, @@ -94,7 +94,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $registry, $coreFileStorageDb, $dateModel, - $app, + $configuration, $resource, $resourceCollection, $connectionName, diff --git a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php index 8bc9d4878eda1d4cd32382890cd360675e139acd..f96210a33d6fc3fa899a46c817a48dc62f64e210 100644 --- a/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php +++ b/app/code/Magento/Core/Model/File/Storage/Database/AbstractDatabase.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\File\Storage\Database; /** * Class AbstractDatabase */ -abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel +abstract class AbstractDatabase extends \Magento\Model\AbstractModel { /** * Store media base directory path @@ -52,17 +52,17 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel protected $_date; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\App\ConfigInterface $configuration + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string|null $connectionName * @param array $data @@ -72,14 +72,14 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\App\ConfigInterface $configuration, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $connectionName = null, array $data = array() ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_app = $app; + $this->_configuration = $configuration; $this->_coreFileStorageDb = $coreFileStorageDb; $this->_date = $dateModel; if (!$connectionName) { @@ -95,10 +95,11 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel */ public function getConfigConnectionName() { - $connectionName = $this->_app->getConfig()->getValue( - \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, - 'default' - ); + $connectionName = $this->_configuration + ->getValue( + \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, + 'default' + ); if (empty($connectionName)) { $connectionName = 'default_setup'; } @@ -108,7 +109,7 @@ abstract class AbstractDatabase extends \Magento\Core\Model\AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ protected function _getResource() { diff --git a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php index e146f1e772dd5c1c2f135d8c94fb5f2cef8c8aac..cae83fec58b2303d01322d41562fb30c0ed80f87 100644 --- a/app/code/Magento/Core/Model/File/Storage/Directory/Database.php +++ b/app/code/Magento/Core/Model/File/Storage/Directory/Database.php @@ -54,11 +54,11 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * @param \Magento\Registry $registry * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Stdlib\DateTime\DateTime $dateModel - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory + * @param \Magento\App\ConfigInterface $configuration + * @param DatabaseFactory $directoryFactory * @param \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource * @param \Magento\Data\Collection\Db $resourceCollection - * @param string|null $connectionName + * @param null $connectionName * @param array $data */ public function __construct( @@ -66,7 +66,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas \Magento\Registry $registry, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Stdlib\DateTime\DateTime $dateModel, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Core\Model\File\Storage\Directory\DatabaseFactory $directoryFactory, \Magento\Core\Model\Resource\File\Storage\Directory\Database $resource, \Magento\Data\Collection\Db $resourceCollection = null, @@ -79,7 +79,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $registry, $coreFileStorageDb, $dateModel, - $app, + $configuration, $resource, $resourceCollection, $connectionName, @@ -193,7 +193,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas * Import directories to storage * * @param array $dirs - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function importDirectories($dirs) @@ -219,7 +219,7 @@ class Database extends \Magento\Core\Model\File\Storage\Database\AbstractDatabas $directory->setUploadTime($dateSingleton->date()); $directory->save(); } else { - throw new \Magento\Core\Exception(__('Parent directory does not exist: %1', $dir['path'])); + throw new \Magento\Model\Exception(__('Parent directory does not exist: %1', $dir['path'])); } } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Core/Model/File/Storage/File.php b/app/code/Magento/Core/Model/File/Storage/File.php index b21cd0e876f0fef1b4148af0549c517da7e54e5c..7ea324dffb650a136b0e36adf3db6449363983b0 100644 --- a/app/code/Magento/Core/Model/File/Storage/File.php +++ b/app/code/Magento/Core/Model/File/Storage/File.php @@ -287,7 +287,7 @@ class File * * @param array $file * @param bool $overwrite - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveFile($file, $overwrite = true) @@ -306,12 +306,12 @@ class File return $this->_fileUtility->saveFile($filename, $file['content'], $overwrite); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Unable to save file "%1" at "%2"', $file['filename'], $file['directory']) ); } } else { - throw new \Magento\Core\Exception(__('Wrong file info format')); + throw new \Magento\Model\Exception(__('Wrong file info format')); } return false; diff --git a/app/code/Magento/Core/Model/File/Storage/Flag.php b/app/code/Magento/Core/Model/File/Storage/Flag.php index c37fd0923dcac80d9a80de15245d86b1d4b31c75..acab6d1eefe5d3d98afa5e1a66ae613208f61c72 100644 --- a/app/code/Magento/Core/Model/File/Storage/Flag.php +++ b/app/code/Magento/Core/Model/File/Storage/Flag.php @@ -34,7 +34,7 @@ */ namespace Magento\Core\Model\File\Storage; -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * There was no synchronization diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index f14ec78004ccbbfbb6e398a697e0a6a174b6b8c1..23690fd2475b1a0410a71f1906b60deed70dced0 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -1400,7 +1400,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * * @param string|\Magento\View\Element\AbstractBlock $block * @param array $attributes - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\View\Element\AbstractBlock */ protected function _getBlockInstance($block, array $attributes = array()) @@ -1413,7 +1413,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn } } if (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $block)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $block)); } return $block; } @@ -1527,14 +1527,14 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * Get block singleton * * @param string $type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\App\Helper\AbstractHelper */ public function getBlockSingleton($type) { if (!isset($this->_helpers[$type])) { if (!$type) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $type)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $type)); } $helper = $this->_blockFactory->createBlock($type); diff --git a/app/code/Magento/Core/Model/Layout/Link.php b/app/code/Magento/Core/Model/Layout/Link.php index eb17e56d2fcd8dcbeaff95ad601ab8aad641731d..7fe511be50bb45945f9cf44d5a371aa0f15cbc77 100644 --- a/app/code/Magento/Core/Model/Layout/Link.php +++ b/app/code/Magento/Core/Model/Layout/Link.php @@ -35,7 +35,7 @@ namespace Magento\Core\Model\Layout; * @method \Magento\Core\Model\Layout\Link setThemeId($id) * @method \Magento\Core\Model\Layout\Link setLayoutUpdateId($id) */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { /** * Layout Update model initialization diff --git a/app/code/Magento/Core/Model/Layout/Update.php b/app/code/Magento/Core/Model/Layout/Update.php index 853270d2bedcf56b1abc83cda5518389704e0a34..fc12369c1f329ef0413f2db0fc32bff57d2aeb26 100644 --- a/app/code/Magento/Core/Model/Layout/Update.php +++ b/app/code/Magento/Core/Model/Layout/Update.php @@ -40,7 +40,7 @@ namespace Magento\Core\Model\Layout; * @method \Magento\Core\Model\Layout\Update setUpdatedAt() setUpdatedAt(string $updateDateTime) * @method \Magento\Core\Model\Resource\Layout\Update\Collection getCollection() */ -class Update extends \Magento\Core\Model\AbstractModel +class Update extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime @@ -51,7 +51,7 @@ class Update extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Update extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -80,7 +80,7 @@ class Update extends \Magento\Core\Model\AbstractModel /** * Set current updated date * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { diff --git a/app/code/Magento/Core/Model/Observer.php b/app/code/Magento/Core/Model/Observer.php index 9beb850517f98e90e01f29176fb6160c1a32df1e..71041357b0687a10c303e69c49dfe631957bac52 100644 --- a/app/code/Magento/Core/Model/Observer.php +++ b/app/code/Magento/Core/Model/Observer.php @@ -121,7 +121,7 @@ class Observer $pathPattern = $observer->getEvent()->getPathPattern(); try { $this->_registration->register($pathPattern); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); } return $this; diff --git a/app/code/Magento/Core/Model/Resource/Cache.php b/app/code/Magento/Core/Model/Resource/Cache.php index 49410249f3631aacc1dfd65cd484c98e3166a523..4ec67829de437c945e29ff55a0d06765ce12b4d2 100644 --- a/app/code/Magento/Core/Model/Resource/Cache.php +++ b/app/code/Magento/Core/Model/Resource/Cache.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Cache extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Magento\App\Cache\State\OptionsInterface +class Cache extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\App\Cache\State\OptionsInterface { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Config.php b/app/code/Magento/Core/Model/Resource/Config.php index 8894fb300de1e4a0decab6fba173e18efe187ef4..f82a708d0a3c1466cd70672e372c3be86e166829 100644 --- a/app/code/Magento/Core/Model/Resource/Config.php +++ b/app/code/Magento/Core/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Config/Data.php b/app/code/Magento/Core/Model/Resource/Config/Data.php index 55eb310737b42026352743367c1d93cd36005363..9827293ed222b7808236e564a4fe5ca1c6aaa1f0 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data.php @@ -34,7 +34,7 @@ use Magento\Core\Model\Website; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Data extends \Magento\Core\Model\Resource\Db\AbstractDb +class Data extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -49,10 +49,10 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Convert array to comma separated value * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$object->getId()) { $this->_checkUnique($object); @@ -68,10 +68,10 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb * Validate unique configuration data before save * Set id to object if exists configuration instead of throw exception * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _checkUnique(\Magento\Core\Model\AbstractModel $object) + protected function _checkUnique(\Magento\Model\AbstractModel $object) { $select = $this->_getReadAdapter()->select()->from( $this->getMainTable(), diff --git a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php index d31b34bd34a54471e1f97e508c27cd9dc24a9e81..9f89d809ab7fe0b8a1b6216e12e9af9bda25195b 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Config/Data/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Config\Data; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php index b9f1e9ef731219fe72eaf4152cc50975ee24d4cf..c98899ec99f7742c6c72d0fa037d90334ed92c95 100644 --- a/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php +++ b/app/code/Magento/Core/Model/Resource/Config/Value/Collection/Scoped.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Resource\Config\Value\Collection; -class Scoped extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Scoped extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Scope to filter by diff --git a/app/code/Magento/Core/Model/Resource/Design.php b/app/code/Magento/Core/Model/Resource/Design.php index 4fac11c843456510843d51bd6222ea7d483948e2..d9743f6d3d10e986520f25323ca04829467bb101 100644 --- a/app/code/Magento/Core/Model/Resource/Design.php +++ b/app/code/Magento/Core/Model/Resource/Design.php @@ -34,7 +34,7 @@ use Magento\Stdlib\DateTime; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Design extends \Magento\Core\Model\Resource\Db\AbstractDb +class Design extends \Magento\Model\Resource\Db\AbstractDb { /** * @var DateTime @@ -64,11 +64,11 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { if ($date = $object->getDateFrom()) { $object->setDateFrom($this->dateTime->formatDate($date)); @@ -92,7 +92,7 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb $object->getDateTo() ) ) { - throw new \Magento\Core\Exception(__('Start date cannot be greater than end date.')); + throw new \Magento\Model\Exception(__('Start date cannot be greater than end date.')); } $check = $this->_checkIntersection( @@ -103,7 +103,7 @@ class Design extends \Magento\Core\Model\Resource\Db\AbstractDb ); if ($check) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Your design change for the specified store intersects with another one, please specify another date range.' ) diff --git a/app/code/Magento/Core/Model/Resource/Design/Collection.php b/app/code/Magento/Core/Model/Resource/Design/Collection.php index 4dd9e74e559ed07f8354371f24c1eadfcb16e3fa..fd141975a4eb7a52517829653cef9cddc27e1280 100644 --- a/app/code/Magento/Core/Model/Resource/Design/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Design/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Design; /** * Core Design resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Stdlib\DateTime @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php index 43bad76577e9d0d228c29a8ed0b9efd2bc768b65..1540f4f048a6118f33d63ba96eea85aa019a42c4 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/AbstractStorage.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\File\Storage; /** * Class AbstractStorage */ -abstract class AbstractStorage extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractStorage extends \Magento\Model\Resource\Db\AbstractDb { /** * File storage connection name diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php index 3182c186cbc6d34c92876626c3aef47058936114..0093393f18510541e28a394b1a8b0e6a492ab263 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/Database.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/Database.php @@ -31,15 +31,15 @@ namespace Magento\Core\Model\Resource\File\Storage; class Database extends \Magento\Core\Model\Resource\File\Storage\AbstractStorage { /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; /** * @param \Magento\App\Resource $resource - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper */ - public function __construct(\Magento\App\Resource $resource, \Magento\Core\Model\Resource\Helper $resourceHelper) + public function __construct(\Magento\App\Resource $resource, \Magento\DB\Helper $resourceHelper) { parent::__construct($resource); $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/Core/Model/Resource/File/Storage/File.php b/app/code/Magento/Core/Model/Resource/File/Storage/File.php index fa4b725937a829aa80ee46e489f055074fbb761c..f697778093631c6f1168fec7ab610b2ca5b2f46e 100644 --- a/app/code/Magento/Core/Model/Resource/File/Storage/File.php +++ b/app/code/Magento/Core/Model/Resource/File/Storage/File.php @@ -103,7 +103,7 @@ class File * Save directory to storage * * @param array $dir - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveDir($dir) @@ -118,7 +118,7 @@ class File $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR)->create($path); } catch (\Exception $e) { $this->_logger->log($e->getMessage()); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Unable to create directory: %1', \Magento\App\Filesystem::MEDIA_DIR . '/' . $path) ); } @@ -132,7 +132,7 @@ class File * @param string $filePath * @param string $content * @param bool $overwrite - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ public function saveFile($filePath, $content, $overwrite = false) @@ -145,7 +145,7 @@ class File } } catch (\Magento\Filesystem\FilesystemException $e) { $this->_logger->log($e->getMessage()); - throw new \Magento\Core\Exception(__('Unable to save file: %1', $filePath)); + throw new \Magento\Model\Exception(__('Unable to save file: %1', $filePath)); } return false; diff --git a/app/code/Magento/Core/Model/Resource/Helper.php b/app/code/Magento/Core/Model/Resource/Helper.php deleted file mode 100644 index 44d6886d7bd9be8e4509221d0cb04cef449b79dd..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Resource/Helper.php +++ /dev/null @@ -1,324 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Resource helper class for MySql Magento DB Adapter - */ -namespace Magento\Core\Model\Resource; - -class Helper extends \Magento\Core\Model\Resource\Helper\AbstractHelper -{ - /** - * @param \Magento\App\Resource $resource - * @param string $modulePrefix - */ - public function __construct(\Magento\App\Resource $resource, $modulePrefix = 'core') - { - parent::__construct($resource, $modulePrefix); - } - - /** - * Returns array of quoted orders with direction - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - */ - protected function _prepareOrder(\Magento\DB\Select $select, $autoReset = false) - { - $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); - if (!$selectOrders) { - return array(); - } - - $orders = array(); - foreach ($selectOrders as $term) { - if (is_array($term)) { - if (!is_numeric($term[0])) { - $orders[] = sprintf('%s %s', $this->_getReadAdapter()->quoteIdentifier($term[0], true), $term[1]); - } - } else { - if (!is_numeric($term)) { - $orders[] = $this->_getReadAdapter()->quoteIdentifier($term, true); - } - } - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::ORDER); - } - - return $orders; - } - - /** - * Truncate alias name from field. - * - * Result string depends from second optional argument $reverse - * which can be true if you need the first part of the field. - * Field can be with 'dot' delimiter. - * - * @param string $field - * @param bool $reverse OPTIONAL - * @return string - */ - protected function _truncateAliasName($field, $reverse = false) - { - $string = $field; - if (!is_numeric($field) && strpos($field, '.') !== false) { - $size = strpos($field, '.'); - if ($reverse) { - $string = substr($field, 0, $size); - } else { - $string = substr($field, $size + 1); - } - } - - return $string; - } - - /** - * Returns quoted group by fields - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - */ - protected function _prepareGroup(\Magento\DB\Select $select, $autoReset = false) - { - $selectGroups = $select->getPart(\Zend_Db_Select::GROUP); - if (!$selectGroups) { - return array(); - } - - $groups = array(); - foreach ($selectGroups as $term) { - $groups[] = $this->_getReadAdapter()->quoteIdentifier($term, true); - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::GROUP); - } - - return $groups; - } - - /** - * Prepare and returns having array - * - * @param \Magento\DB\Select $select - * @param bool $autoReset - * @return array - * @throws \Zend_Db_Exception - */ - protected function _prepareHaving(\Magento\DB\Select $select, $autoReset = false) - { - $selectHavings = $select->getPart(\Zend_Db_Select::HAVING); - if (!$selectHavings) { - return array(); - } - - $havings = array(); - $columns = $select->getPart(\Zend_Db_Select::COLUMNS); - foreach ($columns as $columnEntry) { - $correlationName = (string)$columnEntry[1]; - $column = $columnEntry[2]; - foreach ($selectHavings as $having) { - /** - * Looking for column expression in the having clause - */ - if (strpos($having, $correlationName) !== false) { - if (is_string($column)) { - /** - * Replace column expression to column alias in having clause - */ - $havings[] = str_replace($correlationName, $column, $having); - } else { - throw new \Zend_Db_Exception( - sprintf("Can't prepare expression without column alias: '%s'", $correlationName) - ); - } - } - } - } - - if ($autoReset) { - $select->reset(\Zend_Db_Select::HAVING); - } - - return $havings; - } - - /** - * - * @param string $query - * @param int $limitCount - * @param int $limitOffset - * @param array $columnList - * @return string - */ - protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList = array()) - { - if ($limitCount !== null) { - $limitCount = intval($limitCount); - if ($limitCount <= 0) { - //throw new \Exception("LIMIT argument count={$limitCount} is not valid"); - } - - $limitOffset = intval($limitOffset); - if ($limitOffset < 0) { - //throw new \Exception("LIMIT argument offset={$limitOffset} is not valid"); - } - - if ($limitOffset + $limitCount != $limitOffset + 1) { - $columns = array(); - foreach ($columnList as $columnEntry) { - $columns[] = $columnEntry[2] ? $columnEntry[2] : $columnEntry[1]; - } - $query = sprintf('%s LIMIT %s, %s', $query, $limitCount, $limitOffset); - } - } - - return $query; - } - - /** - * Prepare select column list - * - * @param \Magento\DB\Select $select - * @param string|null $groupByCondition OPTIONAL - * @return mixed|array - * @throws \Zend_Db_Exception - */ - public function prepareColumnsList(\Magento\DB\Select $select, $groupByCondition = null) - { - if (!count($select->getPart(\Zend_Db_Select::FROM))) { - return $select->getPart(\Zend_Db_Select::COLUMNS); - } - - $columns = $select->getPart(\Zend_Db_Select::COLUMNS); - $tables = $select->getPart(\Zend_Db_Select::FROM); - $preparedColumns = array(); - - foreach ($columns as $columnEntry) { - list($correlationName, $column, $alias) = $columnEntry; - if ($column instanceof \Zend_Db_Expr) { - if ($alias !== null) { - if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', $column)) { - $column = new \Zend_Db_Expr($column); - } - $preparedColumns[strtoupper($alias)] = array(null, $column, $alias); - } else { - throw new \Zend_Db_Exception("Can't prepare expression without alias"); - } - } else { - if ($column == \Zend_Db_Select::SQL_WILDCARD) { - if ($tables[$correlationName]['tableName'] instanceof \Zend_Db_Expr) { - throw new \Zend_Db_Exception( - "Can't prepare expression when tableName is instance of \Zend_Db_Expr" - ); - } - $tableColumns = $this->_getReadAdapter()->describeTable($tables[$correlationName]['tableName']); - foreach (array_keys($tableColumns) as $col) { - $preparedColumns[strtoupper($col)] = array($correlationName, $col, null); - } - } else { - $columnKey = is_null($alias) ? $column : $alias; - $preparedColumns[strtoupper($columnKey)] = array($correlationName, $column, $alias); - } - } - } - - return $preparedColumns; - } - - /** - * Add prepared column group_concat expression - * - * @param \Magento\DB\Select $select - * @param string $fieldAlias Field alias which will be added with column group_concat expression - * @param string $fields - * @param string $groupConcatDelimiter - * @param string $fieldsDelimiter - * @param string $additionalWhere - * @return \Magento\DB\Select - */ - public function addGroupConcatColumn( - $select, - $fieldAlias, - $fields, - $groupConcatDelimiter = ',', - $fieldsDelimiter = '', - $additionalWhere = '' - ) { - if (is_array($fields)) { - $fieldExpr = $this->_getReadAdapter()->getConcatSql($fields, $fieldsDelimiter); - } else { - $fieldExpr = $fields; - } - if ($additionalWhere) { - $fieldExpr = $this->_getReadAdapter()->getCheckSql($additionalWhere, $fieldExpr, "''"); - } - $separator = ''; - if ($groupConcatDelimiter) { - $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); - } - $select->columns( - array($fieldAlias => new \Zend_Db_Expr(sprintf('GROUP_CONCAT(%s%s)', $fieldExpr, $separator))) - ); - return $select; - } - - /** - * Returns expression of days passed from $startDate to $endDate - * - * @param string|\Zend_Db_Expr $startDate - * @param string|\Zend_Db_Expr $endDate - * @return \Zend_Db_Expr - */ - public function getDateDiff($startDate, $endDate) - { - $dateDiff = '(TO_DAYS(' . $endDate . ') - TO_DAYS(' . $startDate . '))'; - return new \Zend_Db_Expr($dateDiff); - } - - /** - * Escapes and quotes LIKE value. - * Stating escape symbol in expression is not required, because we use standard MySQL escape symbol. - * For options and escaping see escapeLikeValue(). - * - * @param string $value - * @param array $options - * @return \Zend_Db_Expr - * - * @see escapeLikeValue() - */ - public function addLikeEscape($value, $options = array()) - { - $value = $this->escapeLikeValue($value, $options); - return new \Zend_Db_Expr($this->_getReadAdapter()->quote($value)); - } -} diff --git a/app/code/Magento/Core/Model/Resource/HelperPool.php b/app/code/Magento/Core/Model/Resource/HelperPool.php deleted file mode 100644 index 7c7ce864d3f46e144d64ff81727cfd0df79d676c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Resource/HelperPool.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Resource helper pool - */ -namespace Magento\Core\Model\Resource; - -class HelperPool -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @var array - */ - protected $_resourceHelpers = array(); - - /** - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Get resource helper singleton - * - * @param string $moduleName - * @throws \InvalidArgumentException - * @return \Magento\Core\Model\Resource\Helper\AbstractHelper - */ - public function get($moduleName) - { - $module = str_replace('_', \Magento\Autoload\IncludePath::NS_SEPARATOR, $moduleName); - $helperClassName = $module . '\Model\Resource\Helper'; - $connection = strtolower($moduleName); - if (substr($moduleName, 0, 8) == 'Magento_') { - $connection = substr($connection, 8); - } - - if (!isset($this->_resourceHelpers[$connection])) { - $helper = $this->_objectManager->create($helperClassName, array('modulePrefix' => $connection)); - if (false === $helper instanceof \Magento\Core\Model\Resource\Helper\AbstractHelper) { - throw new \InvalidArgumentException( - $helperClassName . ' doesn\'t extend \Magento\Core\Model\Resource\Helper\AbstractHelper' - ); - } - $this->_resourceHelpers[$connection] = $helper; - } - - return $this->_resourceHelpers[$connection]; - } -} diff --git a/app/code/Magento/Core/Model/Resource/Layout/Link.php b/app/code/Magento/Core/Model/Resource/Layout/Link.php index 1cb3b1b5a5e144766c2e047a6a627c99748458d0..8d681952635d532c450355152fd474be8707d948 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Link.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Link.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout; /** * Layout Link resource model */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php index 1ad359d8960baeaf6d19299e71fe44337b105364..a6c6b18ffabb6ba65e8ad310b65e6e29ce7895b4 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Link/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout\Link; /** * Layout update collection model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Stdlib\DateTime @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update.php b/app/code/Magento/Core/Model/Resource/Layout/Update.php index 993a5b39fa89525ecc4b6c386db8e495db5a5725..7fb8c32062f15013643fde51c2c6014557fe1fcb 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout; /** * Layout update resource model */ -class Update extends \Magento\Core\Model\Resource\Db\AbstractDb +class Update extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Cache\FrontendInterface @@ -117,10 +117,10 @@ class Update extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update a "layout update link" if relevant data is provided * - * @param \Magento\Core\Model\Layout\Update|\Magento\Core\Model\AbstractModel $object + * @param \Magento\Core\Model\Layout\Update|\Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $data = $object->getData(); if (isset($data['store_id']) && isset($data['theme_id'])) { diff --git a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php index ab2271b4c46f3a0d32297e6483d5b21ed400f749..a066dbe207e72e235f6a08b1cdf0afae756e1ca5 100644 --- a/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Layout/Update/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Layout\Update; /** * Layout update collection model */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Name prefix of events that are dispatched by model @@ -56,7 +56,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime $dateTime * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -65,7 +65,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime $dateTime, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->dateTime = $dateTime; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Core/Model/Resource/Resource.php b/app/code/Magento/Core/Model/Resource/Resource.php index 0c490b648f786bf3aae66ff76ae9f86a078d5f1e..8ce9180fda1d8f0c38ae6404b055ab77a9629efc 100644 --- a/app/code/Magento/Core/Model/Resource/Resource.php +++ b/app/code/Magento/Core/Model/Resource/Resource.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Resource extends \Magento\Core\Model\Resource\Db\AbstractDb +class Resource extends \Magento\Model\Resource\Db\AbstractDb { /** * Database versions diff --git a/app/code/Magento/Core/Model/Resource/Setup.php b/app/code/Magento/Core/Model/Resource/Setup.php index 48b105b9c731f49262d03be04495689b5d31b582..81e942c86d421256d78177e2969352c9832d7985 100644 --- a/app/code/Magento/Core/Model/Resource/Setup.php +++ b/app/code/Magento/Core/Model/Resource/Setup.php @@ -540,14 +540,17 @@ class Setup implements \Magento\Module\Updater\SetupInterface */ protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) { - $arrRes = array(); + $arrRes = []; switch ($actionType) { case self::TYPE_DB_INSTALL: case self::TYPE_DATA_INSTALL: uksort($arrFiles, 'version_compare'); foreach ($arrFiles as $version => $file) { if (version_compare($version, $toVersion) !== self::VERSION_COMPARE_GREATER) { - $arrRes[0] = array('toVersion' => $version, 'fileName' => $file); + $arrRes[0] = [ + 'toVersion' => $version, + 'fileName' => $file + ]; } } break; @@ -563,16 +566,16 @@ class Setup implements \Magento\Module\Updater\SetupInterface break; } $infoFrom = $versionInfo[0]; - $infoTo = $versionInfo[1]; - if (version_compare( - $infoFrom, - $fromVersion - ) !== self::VERSION_COMPARE_LOWER && version_compare( - $infoTo, - $toVersion - ) !== self::VERSION_COMPARE_GREATER + $infoTo = $versionInfo[1]; + if (version_compare($infoFrom, $fromVersion, '>=') + && version_compare($infoTo, $fromVersion, '>') + && version_compare($infoTo, $toVersion, '<=') + && version_compare($infoFrom, $toVersion, '<') ) { - $arrRes[] = array('toVersion' => $infoTo, 'fileName' => $file); + $arrRes[] = [ + 'toVersion' => $infoTo, + 'fileName' => $file + ]; } } break; diff --git a/app/code/Magento/Core/Model/Resource/Store.php b/app/code/Magento/Core/Model/Resource/Store.php index bc2b2b468104d03e44eab7192a6807f9636b1816..4249f66164db992a3453bbccf62d890e1c42cbd4 100644 --- a/app/code/Magento/Core/Model/Resource/Store.php +++ b/app/code/Magento/Core/Model/Resource/Store.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\Resource\Db\AbstractDb +class Store extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table and primary key @@ -76,10 +76,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update Store Group data after save store * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); $this->_updateGroupDefaultStore($object->getGroupId(), $object->getId()); @@ -91,10 +91,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Remove core configuration data after delete store * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $model) + protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_STORES, @@ -137,10 +137,10 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Change store group for store * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _changeGroup(\Magento\Core\Model\AbstractModel $model) + protected function _changeGroup(\Magento\Model\AbstractModel $model) { if ($model->getOriginalGroupId() && $model->getGroupId() != $model->getOriginalGroupId()) { $adapter = $this->_getReadAdapter(); @@ -166,7 +166,7 @@ class Store extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Core/Model/Resource/Store/Collection.php b/app/code/Magento/Core/Model/Resource/Store/Collection.php index e4fcbfcf2286e5f066c16d2c20aa48573abf8313..121e9d16b4e8b87637e99dedeb0d219d2f4e7631 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Store/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Name prefix of events that are dispatched by model diff --git a/app/code/Magento/Core/Model/Resource/Store/Group.php b/app/code/Magento/Core/Model/Resource/Store/Group.php index 91f7ecd1676b2a078ad72bdd34d5fba0c72b6b5e..2cf865d2b843daee08f1b35c5d95a1b10112ee3c 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group.php +++ b/app/code/Magento/Core/Model/Resource/Store/Group.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -47,10 +47,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Update default store group for website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $model) + protected function _afterSave(\Magento\Model\AbstractModel $model) { $this->_updateStoreWebsite($model->getId(), $model->getWebsiteId()); $this->_updateWebsiteDefaultGroup($model->getWebsiteId(), $model->getId()); @@ -87,10 +87,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Change store group website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _changeWebsite(\Magento\Core\Model\AbstractModel $model) + protected function _changeWebsite(\Magento\Model\AbstractModel $model) { if ($model->getOriginalWebsiteId() && $model->getWebsiteId() != $model->getOriginalWebsiteId()) { $select = $this->_getWriteAdapter()->select()->from( diff --git a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php b/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php index d579c698c66631c94538c54a063c46c73120937d..cda1e15bf3b40595a0ab26c0db50c0dfb9d7a8b9 100644 --- a/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Store/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Store\Group; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/Core/Model/Resource/Theme.php b/app/code/Magento/Core/Model/Resource/Theme.php index 40e59163cde0088ea033d66ecd5207ced761bd85..4729e4311ed484e6613a1a5e67c4b898d0d371d0 100644 --- a/app/code/Magento/Core/Model/Resource/Theme.php +++ b/app/code/Magento/Core/Model/Resource/Theme.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource; /** * Theme resource model */ -class Theme extends \Magento\Core\Model\Resource\Db\AbstractDb +class Theme extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Theme/Collection.php b/app/code/Magento/Core/Model/Resource/Theme/Collection.php index 5e8312c2f7e01d4732dc17785090e76b6cce1580..1fc3025bb418e0114ba632bc785a238959506a47 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme; /** * Theme collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\View\Design\Theme\Label\ListInterface, \Magento\View\Design\Theme\ListInterface { diff --git a/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php b/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php index d65b1bfdf660118e8a01249b65d613ac046584e7..15d4b1c815c81e59eb9b26bcd236e02a52b33880 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Customization/Update.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme\Customization; /** * Theme customization link resource model */ -class Update extends \Magento\Core\Model\Resource\Db\AbstractDb +class Update extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Backend/Model/Resource/Translate.php b/app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php similarity index 70% rename from app/code/Magento/Backend/Model/Resource/Translate.php rename to app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php index 1defebb13dad3286bb3b33028b0f96bcb8da1d99..312a3cb04a878b8427fb2620f225a75b3306bac7 100644 --- a/app/code/Magento/Backend/Model/Resource/Translate.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Data/Collection.php @@ -18,26 +18,23 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Resource; +namespace Magento\Core\Model\Resource\Theme\Data; /** - * Backend translate resource model + * Theme data collection */ -class Translate extends \Magento\Core\Model\Resource\Translate +class Collection extends \Magento\Core\Model\Resource\Theme\Collection implements + \Magento\View\Design\Theme\Label\ListInterface, + \Magento\View\Design\Theme\ListInterface { /** - * Get current store id - * Use always default scope for store id - * - * @return int + * @inheritdoc */ - protected function _getStoreId() + protected function _construct() { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; + $this->_init('Magento\Core\Model\Theme\Data', 'Magento\Core\Model\Resource\Theme'); } } diff --git a/app/code/Magento/Core/Model/Resource/Theme/File.php b/app/code/Magento/Core/Model/Resource/Theme/File.php index 51c821861d282294ca0ddb65e931e9a36ad2f8c6..c28aa571fc1551267d478e83386bfd4cea8c4af7 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/File.php +++ b/app/code/Magento/Core/Model/Resource/Theme/File.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme; /** * Theme files resource model */ -class File extends \Magento\Core\Model\Resource\Db\AbstractDb +class File extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php b/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php index da3c2d43a1191456d6c623f4ba158836ed866099..4b3130c65f6135c7b67bd3af6552d3455158adfb 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Theme/File/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Core\Model\Resource\Theme\File; /** * Theme files collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\View\Design\Theme\File\CollectionInterface { /** diff --git a/app/code/Magento/Core/Model/Resource/Url/Rewrite.php b/app/code/Magento/Core/Model/Resource/Url/Rewrite.php index 5aeb8d2073e357058cda9de29971d0004e9e70db..11d17a1f2d57ae8034dbf51d74c2db5b5ff603f0 100644 --- a/app/code/Magento/Core/Model/Resource/Url/Rewrite.php +++ b/app/code/Magento/Core/Model/Resource/Url/Rewrite.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Url; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Rewrite extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rewrite extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php index c8e7ebb4e7ec723c647c128bfc845c58c0056092..dbce2f608f3ab2bd8f541f602d439a30dea18733 100644 --- a/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Url/Rewrite/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Core\Model\Resource\Url\Rewrite; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Manager Model @@ -50,7 +50,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -59,7 +59,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Core/Model/Resource/Variable.php b/app/code/Magento/Core/Model/Resource/Variable.php index 183f142c751b7178dc51ab2bd97a8de391fa85d6..fc0b783e6b1967988baec25bb6db2e784b6ac3a7 100644 --- a/app/code/Magento/Core/Model/Resource/Variable.php +++ b/app/code/Magento/Core/Model/Resource/Variable.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb +class Variable extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor @@ -84,10 +84,10 @@ class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); if ($object->getUseDefaultValue()) { @@ -120,7 +120,7 @@ class Variable extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Core/Model/Resource/Variable/Collection.php b/app/code/Magento/Core/Model/Resource/Variable/Collection.php index 122ce77ac3b57aa084df2d4ceb491a45151bf7ff..ae2e7b73e5531ee8eb67d3f71c303db45dc6c290 100644 --- a/app/code/Magento/Core/Model/Resource/Variable/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Variable/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Variable; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Id diff --git a/app/code/Magento/Core/Model/Resource/Website.php b/app/code/Magento/Core/Model/Resource/Website.php index bd40cc8c9e96afbe279d420bacd33a8cdf11fcff..1a7565e0355d723b7f27f58d350e96c78bde05b0 100644 --- a/app/code/Magento/Core/Model/Resource/Website.php +++ b/app/code/Magento/Core/Model/Resource/Website.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Website extends \Magento\Core\Model\Resource\Db\AbstractDb +class Website extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table @@ -58,14 +58,14 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Validate website code before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $object->getCode())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Website code may only contain letters (a-z), numbers (0-9) or underscore(_), the first character must be a letter' ) @@ -78,10 +78,10 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getIsDefault()) { $this->_getWriteAdapter()->update($this->getMainTable(), array('is_default' => 0)); @@ -94,10 +94,10 @@ class Website extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Remove core configuration data after delete website * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $model) + protected function _afterDelete(\Magento\Model\AbstractModel $model) { $where = array( 'scope = ?' => \Magento\Core\Model\ScopeInterface::SCOPE_WEBSITES, diff --git a/app/code/Magento/Core/Model/Resource/Website/Collection.php b/app/code/Magento/Core/Model/Resource/Website/Collection.php index f4211a7e704851ca099b1094e9f8ed02e13dae10..708a67d690d386886606bb85f9123f1d38647fa5 100644 --- a/app/code/Magento/Core/Model/Resource/Website/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Website/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model\Resource\Website; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Map field to alias diff --git a/app/code/Magento/Core/Model/Store.php b/app/code/Magento/Core/Model/Store.php index 5f1c36bd5c2c503f3dfa0e92611630ccdadaa709..628de84ddcdccdd749b1568df9e013a305688047 100644 --- a/app/code/Magento/Core/Model/Store.php +++ b/app/code/Magento/Core/Model/Store.php @@ -26,6 +26,7 @@ namespace Magento\Core\Model; use Magento\Directory\Model\Currency\Filter; +use Magento\Model\AbstractModel; /** * Store model @@ -328,6 +329,11 @@ class Store extends AbstractModel implements */ protected $_httpContext; + /** + * @var \Magento\App\ConfigInterface + */ + protected $_appConfig; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry @@ -344,6 +350,7 @@ class Store extends AbstractModel implements * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\App\Http\Context $httpContext + * @param \Magento\App\ConfigInterface $appConfig * @param \Magento\Data\Collection\Db $resourceCollection * @param bool $isCustomEntryPoint * @param array $data @@ -364,6 +371,7 @@ class Store extends AbstractModel implements \Magento\Session\SidResolverInterface $sidResolver, \Magento\Stdlib\Cookie $cookie, \Magento\App\Http\Context $httpContext, + \Magento\App\ConfigInterface $appConfig, \Magento\Data\Collection\Db $resourceCollection = null, $isCustomEntryPoint = false, array $data = array() @@ -381,6 +389,7 @@ class Store extends AbstractModel implements $this->_sidResolver = $sidResolver; $this->_cookie = $cookie; $this->_httpContext = $httpContext; + $this->_appConfig = $appConfig; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -826,7 +835,10 @@ class Store extends AbstractModel implements { $configValue = $this->getConfig(self::XML_PATH_PRICE_SCOPE); if ($configValue == self::PRICE_SCOPE_GLOBAL) { - return \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\App')->getBaseCurrencyCode(); + return $this->_appConfig->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } else { return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } @@ -1248,7 +1260,6 @@ class Store extends AbstractModel implements */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); \Magento\App\ObjectManager::getInstance()->get( 'Magento\Index\Model\Indexer' )->logEvent( diff --git a/app/code/Magento/Core/Model/Store/Exception.php b/app/code/Magento/Core/Model/Store/Exception.php index a131b1ef246f2001d30454d6b075866a6584af05..232d1ab6352c0e539c12cd73475af09d040a6146 100644 --- a/app/code/Magento/Core/Model/Store/Exception.php +++ b/app/code/Magento/Core/Model/Store/Exception.php @@ -34,6 +34,7 @@ */ namespace Magento\Core\Model\Store; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { + } diff --git a/app/code/Magento/Core/Model/Store/Group.php b/app/code/Magento/Core/Model/Store/Group.php index b15d7b7d13eb745fbbc76a008465db39063633d6..39925dc331271aef05e1935d86ea8b4610b401c4 100644 --- a/app/code/Magento/Core/Model/Store/Group.php +++ b/app/code/Magento/Core/Model/Store/Group.php @@ -40,7 +40,7 @@ namespace Magento\Core\Model\Store; use Magento\Core\Model\Website; -class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Group extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { const ENTITY = 'store_group'; @@ -122,7 +122,7 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object * @param \Magento\Core\Model\Resource\Config\Data $configDataResource * @param \Magento\Core\Model\Store $store * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -132,7 +132,7 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object \Magento\Core\Model\Resource\Config\Data $configDataResource, \Magento\Core\Model\Store $store, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -376,7 +376,6 @@ class Group extends \Magento\Core\Model\AbstractModel implements \Magento\Object */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->_configDataResource->clearStoreData($this->getStoreIds()); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Core/Model/Store/ListInterface.php b/app/code/Magento/Core/Model/Store/ListInterface.php index 27692aebffdf91757322ca325a2f9fd7842814d9..aa21e58c39dfc536642bf85ae4d3e40ecf67debf 100644 --- a/app/code/Magento/Core/Model/Store/ListInterface.php +++ b/app/code/Magento/Core/Model/Store/ListInterface.php @@ -63,7 +63,7 @@ interface ListInterface * * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId * @return \Magento\Core\Model\Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null); @@ -95,7 +95,7 @@ interface ListInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null); diff --git a/app/code/Magento/Core/Model/Store/Storage/Db.php b/app/code/Magento/Core/Model/Store/Storage/Db.php index a9a84685763e13445921297a59c858d34f82b7aa..fbca3a5bad7d5772a786258f7ae3bf1b29d56180 100644 --- a/app/code/Magento/Core/Model/Store/Storage/Db.php +++ b/app/code/Magento/Core/Model/Store/Storage/Db.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Store\Storage; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\App\State; use Magento\Core\Model\Store; use Magento\Core\Model\Store\StorageInterface; diff --git a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php b/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php index ec7a190e3493da5deac1e5171c194332f5706149..0f42a1801305144ca933b974c6be562abb19449a 100644 --- a/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php +++ b/app/code/Magento/Core/Model/Store/Storage/DefaultStorage.php @@ -125,7 +125,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param null|bool|int|string|\Magento\Core\Model\Website $websiteId * @return \Magento\Core\Model\Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null) { @@ -160,7 +160,7 @@ class DefaultStorage implements \Magento\Core\Model\Store\StorageInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) { diff --git a/app/code/Magento/Core/Model/StoreManager.php b/app/code/Magento/Core/Model/StoreManager.php index 1f2c3d85eda660fc13c96294e83d26cfcbabfd84..28a898e562fca613a91703fa2e85dbca82c54c59 100644 --- a/app/code/Magento/Core/Model/StoreManager.php +++ b/app/code/Magento/Core/Model/StoreManager.php @@ -25,6 +25,14 @@ namespace Magento\Core\Model; class StoreManager implements \Magento\Core\Model\StoreManagerInterface { + /** + * Application run code + */ + const PARAM_RUN_CODE = 'MAGE_RUN_CODE'; + /** + * Application run type (store|website) + */ + const PARAM_RUN_TYPE = 'MAGE_RUN_TYPE'; /** * Store storage factory model * @@ -120,7 +128,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * Retrieve application store object without Store_Exception * * @param string|int|Store $storeId - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return Store */ public function getSafeStore($storeId = null) @@ -133,7 +141,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface return new \Magento\Object(); } - throw new \Magento\Core\Exception(__('Requested invalid store "%1"', $storeId)); + throw new \Magento\Model\Exception(__('Requested invalid store "%1"', $storeId)); } } @@ -219,7 +227,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param null|bool|int|string|Website $websiteId * @return Website - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWebsite($websiteId = null) { @@ -263,7 +271,7 @@ class StoreManager implements \Magento\Core\Model\StoreManagerInterface * * @param null|\Magento\Core\Model\Store\Group|string $groupId * @return \Magento\Core\Model\Store\Group - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getGroup($groupId = null) { diff --git a/app/code/Magento/Core/Model/Template.php b/app/code/Magento/Core/Model/Template.php index fbdf59a8491f866b44b611c99008d021c0b21ade..d350ffc83bb4a2ee0eb98efd6bbcd7511c92ba59 100644 --- a/app/code/Magento/Core/Model/Template.php +++ b/app/code/Magento/Core/Model/Template.php @@ -32,7 +32,7 @@ namespace Magento\Core\Model; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -abstract class Template extends \Magento\Core\Model\AbstractModel implements \Magento\App\TemplateTypesInterface +abstract class Template extends \Magento\Model\AbstractModel implements \Magento\App\TemplateTypesInterface { /** * Default design area for emulation diff --git a/app/code/Magento/Core/Model/Theme.php b/app/code/Magento/Core/Model/Theme.php index ebae55b422ea559d89c5452422512e3328267dc8..79d175b6b063898b152289ee3214f1049c8ab4cf 100644 --- a/app/code/Magento/Core/Model/Theme.php +++ b/app/code/Magento/Core/Model/Theme.php @@ -26,6 +26,7 @@ namespace Magento\Core\Model; use Magento\View\Design\ThemeInterface; +use Magento\Model\AbstractModel; /** * Theme model class @@ -343,13 +344,13 @@ class Theme extends AbstractModel implements ThemeInterface * Validate theme data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { if (!$this->_validator->validate($this)) { $messages = $this->_validator->getErrorMessages(); - throw new \Magento\Core\Exception(implode(PHP_EOL, reset($messages))); + throw new \Magento\Model\Exception(implode(PHP_EOL, reset($messages))); } return $this; } diff --git a/app/code/Magento/Backup/Model/Resource/HelperFactory.php b/app/code/Magento/Core/Model/Theme/Data/Collection.php similarity index 76% rename from app/code/Magento/Backup/Model/Resource/HelperFactory.php rename to app/code/Magento/Core/Model/Theme/Data/Collection.php index cdd97781a96a6550c1a9432b125c7fcc71ea4581..1cc81121ff37417e0bc9f6e1c3b92931a5969d64 100644 --- a/app/code/Magento/Backup/Model/Resource/HelperFactory.php +++ b/app/code/Magento/Core/Model/Theme/Data/Collection.php @@ -1,7 +1,5 @@ <?php /** - * Resource helper factory - * * Magento * * NOTICE OF LICENSE @@ -23,14 +21,17 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backup\Model\Resource; +namespace Magento\Core\Model\Theme\Data; -class HelperFactory extends \Magento\Core\Model\Resource\HelperFactory +/** + * Theme filesystem data collection + */ +class Collection extends \Magento\Core\Model\Theme\Collection implements \Magento\View\Design\Theme\ListInterface { /** - * Module Name + * Model of collection item * * @var string */ - protected $_moduleName = 'Magento_Backup'; + protected $_itemObjectClass = 'Magento\Core\Model\Theme\Data'; } diff --git a/app/code/Magento/Core/Model/Theme/File.php b/app/code/Magento/Core/Model/Theme/File.php index 53d699879f8a70094490af74f7b92199a795ac29..ef08a5c74d6d18c1966e458f2e3aa662050c1b2b 100644 --- a/app/code/Magento/Core/Model/Theme/File.php +++ b/app/code/Magento/Core/Model/Theme/File.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Theme; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\View\Design\Theme\FileInterface; use Magento\View\Design\Theme\Customization\FileInterface as CustomizationFileInterface; @@ -73,7 +73,7 @@ class File extends AbstractModel implements FileInterface * @param \Magento\Registry $registry * @param \Magento\View\Design\Theme\FlyweightFactory $themeFactory * @param \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class File extends AbstractModel implements FileInterface \Magento\Registry $registry, \Magento\View\Design\Theme\FlyweightFactory $themeFactory, \Magento\View\Design\Theme\Customization\FileServiceFactory $fileServiceFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Theme/Observer.php b/app/code/Magento/Core/Model/Theme/Observer.php index 85e6677bc275c887c8d5ec5dbac0a636e1c45068..d0897ddd14c8ccfa068cdf96d16b6d81b608d514 100644 --- a/app/code/Magento/Core/Model/Theme/Observer.php +++ b/app/code/Magento/Core/Model/Theme/Observer.php @@ -25,7 +25,7 @@ */ namespace Magento\Core\Model\Theme; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Event\Observer as EventObserver; /** diff --git a/app/code/Magento/Core/Model/Theme/Registration.php b/app/code/Magento/Core/Model/Theme/Registration.php index 79eadde87f07995740fb3984ecb64c630f8d68f7..1694638d5cc760152dee7c89fdec908f6e8bf252 100644 --- a/app/code/Magento/Core/Model/Theme/Registration.php +++ b/app/code/Magento/Core/Model/Theme/Registration.php @@ -26,7 +26,7 @@ namespace Magento\Core\Model\Theme; use Magento\App\Filesystem; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\View\Design\ThemeInterface; /** @@ -35,7 +35,7 @@ use Magento\View\Design\ThemeInterface; class Registration { /** - * @var \Magento\Core\Model\Resource\Theme\CollectionFactory + * @var \Magento\Core\Model\Resource\Theme\Data\CollectionFactory */ protected $_collectionFactory; @@ -74,13 +74,13 @@ class Registration /** * Initialize dependencies * - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory - * @param Collection $filesystemCollection + * @param \Magento\Core\Model\Resource\Theme\Data\CollectionFactory $collectionFactory + * @param \Magento\Core\Model\Theme\Data\Collection $filesystemCollection * @param Filesystem $filesystem */ public function __construct( - \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory, - Collection $filesystemCollection, + \Magento\Core\Model\Resource\Theme\Data\CollectionFactory $collectionFactory, + \Magento\Core\Model\Theme\Data\Collection $filesystemCollection, Filesystem $filesystem ) { $this->_collectionFactory = $collectionFactory; @@ -161,7 +161,7 @@ class Registration if (!$theme->getPreviewImage() || !$themeDirectory) { return $this; } - $imagePath = $this->directoryRead->getAbsolutePath($themeDirectory . '/' . $theme->getPreviewImage()); + $imagePath = $themeDirectory . '/' . $theme->getPreviewImage(); if (0 === strpos($imagePath, $themeDirectory)) { $theme->getThemeImage()->createPreviewImage($imagePath); } diff --git a/app/code/Magento/Core/Model/Url/Rewrite.php b/app/code/Magento/Core/Model/Url/Rewrite.php index 64712657ff1e6a945e7492bf8d19b9b6d45091d5..1dbf71fbce773b26f0ef76a73eecad5ca072dfc2 100644 --- a/app/code/Magento/Core/Model/Url/Rewrite.php +++ b/app/code/Magento/Core/Model/Url/Rewrite.php @@ -54,7 +54,7 @@ */ namespace Magento\Core\Model\Url; -class Rewrite extends \Magento\Core\Model\AbstractModel +class Rewrite extends \Magento\Model\AbstractModel { const TYPE_CATEGORY = 1; @@ -77,9 +77,9 @@ class Rewrite extends \Magento\Core\Model\AbstractModel protected $_coreStoreConfig; /** - * @var \Magento\Core\Model\App + * @var \Magento\Stdlib\Cookie */ - protected $_app; + protected $_cookie; /** * @var \Magento\Core\Model\StoreManagerInterface @@ -95,10 +95,10 @@ class Rewrite extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\App $app + * @param \Magento\Stdlib\Cookie $cookie * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\Http\Context $httpContext - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -106,15 +106,15 @@ class Rewrite extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\App $app, + \Magento\Stdlib\Cookie $cookie, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\Http\Context $httpContext, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_app = $app; + $this->_cookie = $cookie; $this->_storeManager = $storeManager; $this->_httpContext = $httpContext; parent::__construct($context, $registry, $resource, $resourceCollection, $data); @@ -323,7 +323,7 @@ class Rewrite extends \Magento\Core\Model\AbstractModel $currentStore = $this->_storeManager->getStore(); $this->setStoreId($currentStore->getId())->loadByIdPath($this->getIdPath()); - $this->_app->getCookie()->set(\Magento\Core\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); + $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $currentStore->getCode(), true); $targetUrl = $request->getBaseUrl(). '/' . $this->getRequestPath(); $this->_sendRedirectHeaders($targetUrl, true); @@ -339,8 +339,7 @@ class Rewrite extends \Magento\Core\Model\AbstractModel $isPermanentRedirectOption = $this->hasOption('RP'); if ($external === 'http:/' || $external === 'https:') { $destinationStoreCode = $this->_storeManager->getStore($this->getStoreId())->getCode(); - $this->_app->getCookie()->set(\Magento\Core\Model\Store::COOKIE_NAME, $destinationStoreCode, true); - + $this->_cookie->set(\Magento\Core\Model\Store::COOKIE_NAME, $destinationStoreCode, true); $this->_sendRedirectHeaders($this->getTargetPath(), $isPermanentRedirectOption); } else { $targetUrl = $request->getBaseUrl() . '/' . $this->getTargetPath(); diff --git a/app/code/Magento/Core/Model/Validator/Factory.php b/app/code/Magento/Core/Model/Validator/Factory.php index d637298bb1d701d0174458e6ffd34f951eb55fe1..37954bba67195ae079bc8facdc6935a79220832a 100644 --- a/app/code/Magento/Core/Model/Validator/Factory.php +++ b/app/code/Magento/Core/Model/Validator/Factory.php @@ -32,11 +32,6 @@ class Factory */ protected $_objectManager; - /** - * @var \Magento\TranslateInterface - */ - protected $_translator; - /** * Validator config files * @@ -49,16 +44,12 @@ class Factory * * @param \Magento\ObjectManager $objectManager * @param \Magento\Module\Dir\Reader $moduleReader - * @param \Magento\TranslateInterface $translator */ public function __construct( \Magento\ObjectManager $objectManager, - \Magento\Module\Dir\Reader $moduleReader, - \Magento\TranslateInterface $translator + \Magento\Module\Dir\Reader $moduleReader ) { $this->_objectManager = $objectManager; - $this->_translator = $translator; - $this->_configFiles = $moduleReader->getConfigurationFiles('validation.xml'); $this->_initializeDefaultTranslator(); } @@ -70,12 +61,10 @@ class Factory */ protected function _initializeDefaultTranslator() { - $translateAdapter = $this->_translator; - $objectManager = $this->_objectManager; // Pass translations to \Magento\TranslateInterface from validators - $translatorCallback = function () use ($translateAdapter, $objectManager) { - /** @var \Magento\TranslateInterface $translateAdapter */ - return $translateAdapter->translate(func_get_args()); + $translatorCallback = function () { + $argc = func_get_args(); + return (string)new \Magento\Phrase(array_shift($argc), $argc); }; /** @var \Magento\Translate\Adapter $translator */ $translator = $this->_objectManager->create('Magento\Translate\Adapter'); diff --git a/app/code/Magento/Core/Model/Variable.php b/app/code/Magento/Core/Model/Variable.php index 79dd3e745de77d141e1bd839bb132e81ee59c05f..643ee7d791c2b4beeedda8324d569389ebf4fda8 100644 --- a/app/code/Magento/Core/Model/Variable.php +++ b/app/code/Magento/Core/Model/Variable.php @@ -39,7 +39,7 @@ namespace Magento\Core\Model; * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -class Variable extends \Magento\Core\Model\AbstractModel +class Variable extends \Magento\Model\AbstractModel { const TYPE_TEXT = 'text'; diff --git a/app/code/Magento/Core/Model/Website.php b/app/code/Magento/Core/Model/Website.php index 9c250b09f8922443f74fbc83813860c68a596859..051e7b9947d150fe9f734128aa771012a182da24 100644 --- a/app/code/Magento/Core/Model/Website.php +++ b/app/code/Magento/Core/Model/Website.php @@ -45,7 +45,7 @@ namespace Magento\Core\Model; * @method int getIsDefault() * @method \Magento\Core\Model\Website setIsDefault(int $value) */ -class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Website extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { const ENTITY = 'core_website'; @@ -173,11 +173,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje */ protected $_storeManager; - /** - * @var App - */ - protected $_app; - /** * @var \Magento\Directory\Model\CurrencyFactory */ @@ -186,15 +181,14 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\Config\Data $configDataResource + * @param Resource\Config\Data $configDataResource * @param \Magento\App\ConfigInterface $coreConfig - * @param \Magento\Core\Model\StoreFactory $storeFactory - * @param \Magento\Core\Model\Store\GroupFactory $storeGroupFactory - * @param \Magento\Core\Model\WebsiteFactory $websiteFactory - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\App $app + * @param StoreFactory $storeFactory + * @param Store\GroupFactory $storeGroupFactory + * @param WebsiteFactory $websiteFactory + * @param StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -207,9 +201,8 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje \Magento\Core\Model\Store\GroupFactory $storeGroupFactory, \Magento\Core\Model\WebsiteFactory $websiteFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\App $app, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -220,7 +213,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje $this->_storeGroupFactory = $storeGroupFactory; $this->_websiteFactory = $websiteFactory; $this->_storeManager = $storeManager; - $this->_app = $app; $this->_currencyFactory = $currencyFactory; } @@ -525,7 +517,6 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); $this->_configDataResource->clearWebsiteData($this); return parent::_beforeDelete(); } @@ -553,10 +544,14 @@ class Website extends \Magento\Core\Model\AbstractModel implements \Magento\Obje \Magento\Core\Model\Store::XML_PATH_PRICE_SCOPE ) == \Magento\Core\Model\Store::PRICE_SCOPE_GLOBAL ) { - return $this->_app->getBaseCurrencyCode(); + $currencyCode = $this->_coreConfig + ->getValue(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, 'default'); + } else { - return $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); + $currencyCode = $this->getConfig(\Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE); } + + return $currencyCode; } /** diff --git a/app/code/Magento/Core/etc/cache.xml b/app/code/Magento/Core/etc/cache.xml index 12ace8c612cf6d9cbbfee5f00253de9fc75061c5..33231b882fb842bf951874464e57051f108a7f03 100644 --- a/app/code/Magento/Core/etc/cache.xml +++ b/app/code/Magento/Core/etc/cache.xml @@ -36,10 +36,6 @@ <label>Blocks HTML output</label> <description>Page blocks HTML.</description> </type> - <type name="translate" translate="label,description" instance="Magento\App\Cache\Type\Translate"> - <label>Translations</label> - <description>Translation files.</description> - </type> <type name="collections" translate="label,description" instance="Magento\App\Cache\Type\Collection"> <label>Collections Data</label> <description>Collection data files.</description> diff --git a/app/code/Magento/Core/etc/config.xml b/app/code/Magento/Core/etc/config.xml index d824ed91c6881207513742a1298c15943f01c4ee..11793f11b492a11679acc75cf33208e26a8b3f2c 100644 --- a/app/code/Magento/Core/etc/config.xml +++ b/app/code/Magento/Core/etc/config.xml @@ -40,13 +40,6 @@ <debug> <profiler>0</profiler> </debug> - <translate_inline> - <active>0</active> - <active_admin>0</active_admin> - <invalid_caches> - <block_html /> - </invalid_caches> - </translate_inline> <log> <active>0</active> <file>system.log</file> diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index 8364d687284fbdd7c979dd4ea1aa8ca20a2382f0..5bc0bd73fdca1ce07987dfd129bb5437998d24da 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -25,6 +25,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <preference for="Magento\Acl\CacheInterface" type="Magento\Acl\Cache" /> + <preference for="Magento\App\AreaInterface" type="Magento\Core\Model\App\Area" /> <preference for="Magento\Module\Updater\SetupInterface" type="Magento\Core\Model\Resource\Setup" /> <preference for="Magento\Module\ResourceResolverInterface" type="Magento\Module\ResourceResolver" /> <preference for="Magento\AuthorizationInterface" type="Magento\Authorization" /> @@ -36,12 +37,8 @@ <preference for="Magento\App\ReinitableConfigInterface" type="Magento\App\ReinitableConfig" /> <preference for="Magento\App\Config\Scope\ReaderPoolInterface" type="Magento\Core\Model\Config\Scope\ReaderPool" /> <preference for="Magento\App\Config\Storage\WriterInterface" type="Magento\Core\Model\Config\Storage\Db" /> - <preference for="Magento\PubSub\Event\QueueWriterInterface" type="Magento\PubSub\Event\QueueWriter" /> - <preference for="Magento\PubSub\Event\FactoryInterface" type="Magento\PubSub\Event\Factory" /> <preference for="Magento\View\Design\Theme\FileInterface" type="Magento\Core\Model\Theme\File" /> - <preference for="Magento\PubSub\Message\DispatcherAsyncInterface" type="Magento\PubSub\Message\DispatcherAsync" /> <preference for="Magento\Config\ConverterInterface" type="Magento\Config\Converter\Dom"/> - <preference for="Magento\Phrase\RendererInterface" type="Magento\Phrase\Renderer\Composite" /> <preference for="Magento\Core\Model\Url\SecurityInfoInterface" type="Magento\Core\Model\Url\SecurityInfo\Proxy" /> <preference for="Magento\App\DefaultPathInterface" type="Magento\App\DefaultPath\DefaultPath" /> <preference for="Magento\Encryption\EncryptorInterface" type="Magento\Encryption\Encryptor" /> @@ -53,12 +50,8 @@ <preference for="Magento\View\Asset\ConfigInterface" type="Magento\Core\Model\Asset\Config" /> <preference for="Magento\View\Asset\MergeStrategyInterface" type="Magento\View\Asset\MergeStrategy\Direct" /> <preference for="Magento\App\ViewInterface" type="Magento\App\View" /> - <preference for="Magento\TranslateInterface" type="Magento\Translate" /> <preference for="Magento\App\Response\RedirectInterface" type="Magento\Core\App\Response\Redirect" /> <preference for="Magento\Data\Collection\EntityFactoryInterface" type="Magento\Core\Model\EntityFactory" /> - <preference for="Magento\Translate\InlineInterface" type="Magento\Translate\Inline" /> - <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Core\Model\Translate\Inline\Config" /> - <preference for="Magento\Translate\Inline\ParserInterface" type="Magento\Core\Model\Translate\Inline\Parser" /> <preference for="Magento\Session\ValidatorInterface" type="Magento\Core\Model\Session\Validator" /> <preference for="Magento\Session\StorageInterface" type="Magento\Session\Storage" /> <preference for="Magento\Url\RouteParamsResolverInterface" type="Magento\Core\Model\Url\RouteParamsResolver" /> @@ -68,13 +61,10 @@ <preference for="Magento\Mview\ConfigInterface" type="Magento\Mview\Config" /> <preference for="Magento\Mview\ViewInterface" type="Magento\Mview\View" /> <preference for="Magento\Mview\ProcessorInterface" type="Magento\Mview\Processor" /> - <preference for="Magento\Mview\View\StateInterface" type="Magento\Core\Model\Mview\View\State" /> - <preference for="Magento\Mview\View\State\CollectionInterface" type="Magento\Core\Model\Resource\Mview\View\State\Collection" /> <preference for="Magento\Mview\View\CollectionInterface" type="Magento\Mview\View\Collection" /> <preference for="Magento\Mview\View\SubscriptionInterface" type="Magento\Mview\View\Subscription" /> <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> <preference for="Magento\Css\PreProcessor\AdapterInterface" type="Magento\Css\PreProcessor\Adapter\Oyejorge" /> - <preference for="Magento\Translate\ResourceInterface" type="Magento\Core\Model\Resource\Translate" /> <preference for="Magento\BaseScopeResolverInterface" type="Magento\Core\Model\BaseScopeResolver" /> <preference for="Magento\LocaleInterface" type="Magento\Locale" /> <preference for="Magento\Locale\CurrencyInterface" type="Magento\Locale\Currency" /> @@ -85,13 +75,6 @@ <preference for="Magento\Stdlib\DateTime\DateInterface" type="Magento\Stdlib\DateTime\Date" /> <preference for="Magento\Locale\ScopeConfigInterface" type="Magento\Core\Model\Store\Config" /> <preference for="Magento\Less\PreProcessor\ErrorHandlerInterface" type="Magento\Less\PreProcessor\ErrorHandler" /> - <type name="Magento\Translate\Inline"> - <arguments> - <argument name="templateFileName" xsi:type="string">Magento_Core::translate_inline.phtml</argument> - <argument name="translatorRoute" xsi:type="string">core/ajax/translate</argument> - <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> - </arguments> - </type> <type name="Magento\App\DefaultPath\DefaultPath"> <arguments> <argument name="parts" xsi:type="array"> @@ -242,23 +225,6 @@ <argument name="uploader" xsi:type="object">Magento\View\Design\Theme\Image\Uploader\Proxy</argument> </arguments> </type> - <type name="Magento\Phrase\Renderer\Composite"> - <arguments> - <argument name="renderers" xsi:type="array"> - <item name="translation" xsi:type="object">Magento\Phrase\Renderer\Translate</item> - </argument> - </arguments> - </type> - <type name="Magento\Phrase\Renderer\Translate"> - <arguments> - <argument name="translator" xsi:type="object">Magento\Translate</argument> - </arguments> - </type> - <type name="Magento\Core\Model\Translate\Inline\Parser"> - <arguments> - <argument name="inputFilter" xsi:type="object">Magento\Filter\Input\MaliciousCode</argument> - </arguments> - </type> <type name="Magento\App\Config\ScopePool"> <arguments> <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Config</argument> @@ -379,7 +345,7 @@ <argument name="reader" xsi:type="object">Magento\Locale\Hierarchy\Config\Reader</argument> </arguments> </type> - <type name="Magento\Core\Model\Resource\Helper"> + <type name="Magento\DB\Helper"> <arguments> <argument name="modulePrefix" xsi:type="string">core</argument> </arguments> @@ -564,6 +530,15 @@ <argument name="defaultLocalePath" xsi:type="string">general/locale/code</argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="store" xsi:type="string">Magento\Core\Model\Store</item> + <item name="website" xsi:type="string">Magento\Core\Model\Website</item> + <item name="storeGroup" xsi:type="string">Magento\Core\Model\Store\Group</item> + </argument> + </arguments> + </type> <type name="Magento\App\PageCache\Identifier"> <plugin name="core-app-area-design-exception-plugin" type="Magento\Core\Model\App\Area\CacheIdentifierPlugin" sortOrder="10"/> diff --git a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php b/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php deleted file mode 100644 index 0de15057781a47bc624b0503543375fbd392f2b9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/sql/core_setup/upgrade-1.6.0.15-1.6.0.16.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/* @var $installer \Magento\Core\Model\Resource\Setup */ -$installer = $this; - -$installer->startSetup(); - -/** - * Create table 'mview_state' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('mview_state') -)->addColumn( - 'state_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'View State Id' -)->addColumn( - 'view_id', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'View Id' -)->addColumn( - 'mode', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 16, - array('default' => \Magento\Mview\View\StateInterface::MODE_DISABLED), - 'View Mode' -)->addColumn( - 'status', - \Magento\DB\Ddl\Table::TYPE_TEXT, - 16, - array('default' => \Magento\Mview\View\StateInterface::STATUS_IDLE), - 'View Status' -)->addColumn( - 'updated', - \Magento\DB\Ddl\Table::TYPE_DATETIME, - null, - array(), - 'View updated time' -)->addColumn( - 'version_id', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'View Version Id' -)->addIndex( - $installer->getIdxName('mview_state', array('view_id')), - array('view_id') -)->addIndex( - $installer->getIdxName('mview_state', array('mode')), - array('mode') -)->setComment( - 'View State' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Core/view/frontend/js/require-cookie.js b/app/code/Magento/Core/view/frontend/js/require-cookie.js index bc1fa19f288df16460a5c61cd9ec25a2e84ae194..3b50cae5410a277b45c74dff829d1554ca632031 100644 --- a/app/code/Magento/Core/view/frontend/js/require-cookie.js +++ b/app/code/Magento/Core/view/frontend/js/require-cookie.js @@ -56,13 +56,11 @@ * @private */ _checkCookie: function(event) { - $.cookie("test", 1); - if ($.cookie("test")) { - $.cookie("test", null); - } else { - event.preventDefault(); - window.location = this.options.noCookieUrl; + if (navigator.cookieEnabled) { + return; } + event.preventDefault(); + window.location = this.options.noCookieUrl; } }); })(jQuery); diff --git a/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php index 8b3e19d942a8cedb0ae8e7865d1e1b8f95eeb59f..5e4b8665cd17591ea730c0d0a2ba24866c83d30f 100644 --- a/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php +++ b/app/code/Magento/Cron/App/Cron/Plugin/ApplicationInitializer.php @@ -25,14 +25,14 @@ */ namespace Magento\Cron\App\Cron\Plugin; -use Magento\AppInterface; +use \Magento\App\State; class ApplicationInitializer { /** - * @var \Magento\AppInterface + * @var State */ - protected $_application; + protected $_appState; /** * @var \Magento\Session\SidResolverInterface @@ -40,12 +40,12 @@ class ApplicationInitializer protected $_sidResolver; /** - * @param AppInterface $application + * @param State $appState * @param \Magento\Session\SidResolverInterface $sidResolver */ - public function __construct(AppInterface $application, \Magento\Session\SidResolverInterface $sidResolver) + public function __construct(State $appState, \Magento\Session\SidResolverInterface $sidResolver) { - $this->_application = $application; + $this->_appState = $appState; $this->_sidResolver = $sidResolver; } @@ -56,10 +56,13 @@ class ApplicationInitializer * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws \Magento\Exception */ public function beforeLaunch(\Magento\App\Cron $subject) { $this->_sidResolver->setUseSessionInUrl(false); - $this->_application->requireInstalledInstance(); + if (false == $this->_appState->isInstalled()) { + throw new \Magento\Exception('Application is not installed yet, please complete the installation first.'); + } } } diff --git a/app/code/Magento/Cron/Exception.php b/app/code/Magento/Cron/Exception.php index c2a848f5037d33c54ef8c2e6f5463cdb61abc211..3bc47b481b1148669d5e49278722112efabd57cf 100644 --- a/app/code/Magento/Cron/Exception.php +++ b/app/code/Magento/Cron/Exception.php @@ -33,6 +33,6 @@ */ namespace Magento\Cron; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php index 204ec1d7fd6a44420a31cbd82e7e0973f71fa13e..316e7ffc89178d45ed9503b20c12cd1f3b4a428c 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Product/Alert.php @@ -61,7 +61,7 @@ class Alert extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -72,7 +72,7 @@ class Alert extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php index d8ed8bc0c5502a5f31913143e784fe467a1f22ec..ffed40eed62d3033ced46c6ae39b38edfe9b5f16 100644 --- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php +++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php @@ -61,7 +61,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string $runModelPath * @param array $data @@ -72,7 +72,7 @@ class Sitemap extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, $runModelPath = '', array $data = array() diff --git a/app/code/Magento/Cron/Model/Observer.php b/app/code/Magento/Cron/Model/Observer.php index 53e75916dc0e894703927f9780351c224444a038..e19a27fcafb2173ae1ef2027faeaed48806dcca9 100644 --- a/app/code/Magento/Cron/Model/Observer.php +++ b/app/code/Magento/Cron/Model/Observer.php @@ -78,9 +78,9 @@ class Observer protected $_objectManager; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * @var \Magento\Core\Model\Store\Config @@ -105,7 +105,7 @@ class Observer /** * @param \Magento\ObjectManager $objectManager * @param ScheduleFactory $scheduleFactory - * @param \Magento\AppInterface $app + * @param \Magento\App\CacheInterface $cache * @param ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\Console\Request $request @@ -114,7 +114,7 @@ class Observer public function __construct( \Magento\ObjectManager $objectManager, \Magento\Cron\Model\ScheduleFactory $scheduleFactory, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\Cron\Model\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\Console\Request $request, @@ -122,7 +122,7 @@ class Observer ) { $this->_objectManager = $objectManager; $this->_scheduleFactory = $scheduleFactory; - $this->_app = $app; + $this->_cache = $cache; $this->_config = $config; $this->_coreStoreConfig = $coreStoreConfig; $this->_request = $request; @@ -264,7 +264,7 @@ class Observer /** * check if schedule generation is needed */ - $lastRun = (int)$this->_app->loadCache(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT); + $lastRun = (int)$this->_cache->load(self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT); $rawSchedulePeriod = (int)$this->_coreStoreConfig->getConfig( 'system/cron/' . $groupId . '/' . self::XML_PATH_SCHEDULE_GENERATE_EVERY ); @@ -289,7 +289,7 @@ class Observer /** * save time schedules generation was ran with no expiration */ - $this->_app->saveCache(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null); + $this->_cache->save(time(), self::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT, array('crontab'), null); return $this; } @@ -354,7 +354,7 @@ class Observer protected function _cleanup($groupId) { // check if history cleanup is needed - $lastCleanup = (int)$this->_app->loadCache(self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT); + $lastCleanup = (int)$this->_cache->load(self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT); $historyCleanUp = (int)$this->_coreStoreConfig->getConfig( 'system/cron/' . $groupId . '/' . self::XML_PATH_HISTORY_CLEANUP_EVERY ); @@ -391,7 +391,7 @@ class Observer } // save time history cleanup was ran with no expiration - $this->_app->saveCache(time(), self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT, array('crontab'), null); + $this->_cache->save(time(), self::CACHE_KEY_LAST_HISTORY_CLEANUP_AT, array('crontab'), null); return $this; } diff --git a/app/code/Magento/Cron/Model/Resource/Schedule.php b/app/code/Magento/Cron/Model/Resource/Schedule.php index 62a4b0bab39ad8804db65a1ed91d1da1dadc6276..671919a16dd7426bd3edacc6cc26a1428828df24 100644 --- a/app/code/Magento/Cron/Model/Resource/Schedule.php +++ b/app/code/Magento/Cron/Model/Resource/Schedule.php @@ -32,7 +32,7 @@ namespace Magento\Cron\Model\Resource; * @package Magento_Cron * @author Magento Core Team <core@magentocommerce.com> */ -class Schedule extends \Magento\Core\Model\Resource\Db\AbstractDb +class Schedule extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource diff --git a/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php b/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php index 5096e7540e548c0dba417b309f083463efb227fe..361212c921dbceabe8b7b4d81fcf9c4cec43e2f3 100644 --- a/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php +++ b/app/code/Magento/Cron/Model/Resource/Schedule/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Cron\Model\Resource\Schedule; * @package Magento_Cron * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource collection diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php index 3276cb83686ec5e2927ebaf8787412cd93e4f10d..bc1e280b7716b1e05e9c61ba00dd4229b57d9d7d 100644 --- a/app/code/Magento/Cron/Model/Schedule.php +++ b/app/code/Magento/Cron/Model/Schedule.php @@ -52,7 +52,7 @@ namespace Magento\Cron\Model; use Magento\Cron\Exception; -class Schedule extends \Magento\Core\Model\AbstractModel +class Schedule extends \Magento\Model\AbstractModel { const STATUS_PENDING = 'pending'; @@ -73,7 +73,7 @@ class Schedule extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTime $date - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -81,7 +81,7 @@ class Schedule extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTime $date, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php index aa3d13cd6a43941c620a2747f1d792af32f7ae00..ad6dc4c273d9eddd09a31a7cb7b84db5fb4f889b 100644 --- a/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php +++ b/app/code/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency.php @@ -87,7 +87,7 @@ class Currency extends \Magento\Backend\App\Action * Fetch rates action * * @return void - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function fetchRatesAction() { @@ -107,7 +107,7 @@ class Currency extends \Magento\Backend\App\Action $service ); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We can\'t initialize the import model.')); + throw new \Magento\Model\Exception(__('We can\'t initialize the import model.')); } $rates = $importModel->fetchRates(); $errors = $importModel->getMessages(); diff --git a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php index f04ae5c22d90c8fcc62355a24fed2685366cdc05..31ab041353170b48fbe00d43ec59d251ffeaf00f 100644 --- a/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php +++ b/app/code/Magento/Customer/Block/Account/Dashboard/Sidebar.php @@ -136,7 +136,7 @@ class Sidebar extends \Magento\View\Element\Template public function getWishlist() { if (!$this->_wishlist) { - $this->_wishlist = $this->_createWishList()->loadByCustomer($this->_customerSession->getCustomer()); + $this->_wishlist = $this->_createWishList()->loadByCustomerId($this->_customerSession->getId()); $this->_wishlist->getItemCollection()->addAttributeToSelect( 'name' )->addAttributeToSelect( diff --git a/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php index 7abfe300ead7a69a09b9f0818d0374afabf7fac6..f1a4c93bdfefc4f98a67f89cd6e2069084ec8a3a 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Grid/Filter/Country.php @@ -41,13 +41,13 @@ class Country extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Directory\Model\Resource\Country\CollectionFactory $collectionFactory, array $data = array() ) { diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php index b3a0dad9f7557c5638659cbf0fbaae0fed560e82..843982e380cae1b620f15ab412ef79159618fa0d 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Cart/Product/Composite/Cart.php @@ -25,7 +25,7 @@ */ namespace Magento\Customer\Controller\Adminhtml\Cart\Product\Composite; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Catalog composite product configuration controller @@ -61,13 +61,13 @@ class Cart extends \Magento\Backend\App\Action * Loads customer, quote and quote item by request params * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initData() { $this->_customerId = (int)$this->getRequest()->getParam('customer_id'); if (!$this->_customerId) { - throw new \Magento\Core\Exception(__('No customer ID defined.')); + throw new \Magento\Model\Exception(__('No customer ID defined.')); } $quoteItemId = (int)$this->getRequest()->getParam('id'); @@ -113,7 +113,7 @@ class Cart extends \Magento\Backend\App\Action $configureResult->setProductId($quoteItem->getProductId()); $configureResult->setBuyRequest($quoteItem->getBuyRequest()); $configureResult->setCurrentStoreId($quoteItem->getStoreId()); - $configureResult->setCustomerId($this->_customerId); + $configureResult->setCurrentCustomerId($this->_customerId); } catch (\Exception $e) { $configureResult->setError(true); $configureResult->setMessage($e->getMessage()); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index.php b/app/code/Magento/Customer/Controller/Adminhtml/Index.php index dd3988132d15b01bc398042ad0c9a8ca028e3390..9e1337b3c2c50b6183decc4bcbd289bb65e3bfbb 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Index.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Index.php @@ -447,7 +447,7 @@ class Index extends \Magento\Backend\App\Action $this->_addSessionErrorMessages($exception->getMessages()); $this->_getSession()->setCustomerData($originalRequestData); $returnToEdit = true; - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); @@ -499,7 +499,7 @@ class Index extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('Customer will receive an email with a link to reset password.')); } catch (NoSuchEntityException $exception) { return $this->_redirect('customer/index'); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $messages = $exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR); if (!count($messages)) { $messages = $exception->getMessage(); @@ -866,7 +866,7 @@ class Index extends \Magento\Backend\App\Action $customer = $this->_customerBuilder->populateWithArray($data)->create(); $errors = $this->_customerAccountService->validateCustomerData($customer); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { /* @var $error Error */ foreach ($exception->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $error) { $errors[] = $error->getText(); diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php index 2fbc9f05d51a129fbfde7aed99d5022fc8cde41e..b9cfe4b20846122d724f6daf8963b9adf34f8f08 100644 --- a/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php +++ b/app/code/Magento/Customer/Controller/Adminhtml/Wishlist/Product/Composite/Wishlist.php @@ -26,7 +26,7 @@ namespace Magento\Customer\Controller\Adminhtml\Wishlist\Product\Composite; use Exception; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Catalog composite product configuration controller diff --git a/app/code/Magento/Customer/Exception.php b/app/code/Magento/Customer/Exception.php index 8b84e3a5f56fc7a9c56a0f4a78b0a9620869a168..ed41bcbe793ead408f0a16856d7e155b2b5d998f 100644 --- a/app/code/Magento/Customer/Exception.php +++ b/app/code/Magento/Customer/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Customer; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Customer/Helper/Data.php b/app/code/Magento/Customer/Helper/Data.php index 69d2be5b4785c0c1c5dd50f6ff91236b061bf5c2..a02b517057a4758b165ffc8eb39683364b63bee9 100644 --- a/app/code/Magento/Customer/Helper/Data.php +++ b/app/code/Magento/Customer/Helper/Data.php @@ -625,7 +625,7 @@ class Data extends \Magento\App\Helper\AbstractHelper ); if (!extension_loaded('soap')) { - $this->_logger->logException(new \Magento\Core\Exception(__('PHP SOAP extension is required.'))); + $this->_logger->logException(new \Magento\Model\Exception(__('PHP SOAP extension is required.'))); return $gatewayResponse; } diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index d7da6853e8beba5290744a9eb3726944c95b95dc..35393abbabf307a0e1068388e7bbd4c14397881b 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -54,7 +54,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param CustomerFactory $customerFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -67,7 +67,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, CustomerFactory $customerFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php index 7494dd43864b812be149c8fc313cabaa6e2e2080..89b932e87bf8916190d035ad17d5dde3b5b51f11 100644 --- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php +++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php @@ -39,7 +39,7 @@ namespace Magento\Customer\Model\Address; * @method string getPostcode() * @method bool getShouldIgnoreValidation() */ -class AbstractAddress extends \Magento\Core\Model\AbstractModel +class AbstractAddress extends \Magento\Model\AbstractModel { /** * Possible customer address types @@ -111,7 +111,7 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel * @param Config $addressConfig * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -123,7 +123,7 @@ class AbstractAddress extends \Magento\Core\Model\AbstractModel Config $addressConfig, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php index 61a2a5e8a9cc8157d9c497362a8bda36609ed332..45ceee4f1c16ae315fa37163f4ce6ce623ef81d0 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Address/Street.php @@ -43,7 +43,7 @@ class Street extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Street extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -91,7 +91,7 @@ class Street extends \Magento\Core\Model\Config\Value /** * Processing object after delete data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDelete() { diff --git a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php index 04e72ebb6f6151387af8b38ebbe485219926795c..7c10a970c40ae4061ef05398fbd520fdf45c92c9 100644 --- a/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php +++ b/app/code/Magento/Customer/Model/Config/Backend/Show/Customer.php @@ -47,7 +47,7 @@ class Customer extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -57,7 +57,7 @@ class Customer extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -132,7 +132,7 @@ class Customer extends \Magento\Core\Model\Config\Value /** * Processing object after delete data * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDelete() { diff --git a/app/code/Magento/Customer/Model/Config/Share.php b/app/code/Magento/Customer/Model/Config/Share.php index 97027cef124682a6d06f6a196fee8be00a303b04..8b87015f59d02f1e5850af1fe93d0e31087ff5cf 100644 --- a/app/code/Magento/Customer/Model/Config/Share.php +++ b/app/code/Magento/Customer/Model/Config/Share.php @@ -69,7 +69,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Customer\Model\Resource\Customer $customerResource - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -80,7 +80,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ \Magento\App\ConfigInterface $config, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Customer\Model\Resource\Customer $customerResource, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -123,7 +123,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ * Check for email duplicates before saving customers sharing options * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _beforeSave() { @@ -131,7 +131,7 @@ class Share extends \Magento\Core\Model\Config\Value implements \Magento\Option\ if ($value == self::SHARE_GLOBAL) { if ($this->_customerResource->findEmailDuplicates()) { //@codingStandardsIgnoreStart - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Cannot share customer accounts globally because some customer accounts with the same emails exist on multiple websites and cannot be merged.' ) diff --git a/app/code/Magento/Customer/Model/Converter.php b/app/code/Magento/Customer/Model/Converter.php index f767f012c43b35720bb8b61b19d79a6e344f9f7a..cf1650eddec17a01b5b3e8e4897782bdb440c3e4 100644 --- a/app/code/Magento/Customer/Model/Converter.php +++ b/app/code/Magento/Customer/Model/Converter.php @@ -90,6 +90,17 @@ class Converter } } + /** + * Retrieve customer model by his ID if possible, or return an empty model otherwise. + * + * @param int $customerId + * @return Customer + */ + public function loadCustomerModel($customerId) + { + return $this->_customerFactory->create()->load($customerId); + } + /** * Retrieve customer model by his email. * diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 67280ec72f7d5254e4fc3f8d7cf73efc4fa28edf..390288b6ab8b5a7822c99d5f03662d89d2deef2d 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -44,7 +44,7 @@ use Magento\Customer\Service\V1\Data\CustomerBuilder; * @method \Magento\Customer\Model\Customer setDefaultBilling($value) * @method \Magento\Customer\Model\Customer setDefaultShipping($value) */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * Configuration paths for email templates and identities @@ -292,19 +292,19 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param string $login * @param string $password * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authenticate($login, $password) { $this->loadByEmail($login); if ($this->getConfirmation() && $this->isConfirmationRequired()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('This account is not confirmed.'), self::EXCEPTION_EMAIL_NOT_CONFIRMED ); } if (!$this->validatePassword($password)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid login or password.'), self::EXCEPTION_INVALID_EMAIL_OR_PASSWORD ); @@ -710,7 +710,7 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param string $backUrl * @param string $storeId * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function sendNewAccountEmail($type = 'registered', $backUrl = '', $storeId = '0') { @@ -725,7 +725,7 @@ class Customer extends \Magento\Core\Model\AbstractModel 'confirmation' => self::XML_PATH_CONFIRM_EMAIL_TEMPLATE ); if (!isset($types[$type])) { - throw new \Magento\Core\Exception(__('Wrong transactional account email type')); + throw new \Magento\Model\Exception(__('Wrong transactional account email type')); } if (!$storeId) { @@ -1072,7 +1072,6 @@ class Customer extends \Magento\Core\Model\AbstractModel protected function _beforeDelete() { //TODO : Revisit and figure handling permissions in MAGETWO-11084 Implementation: Service Context Provider - //$this->_protectFromNonAdmin(); return parent::_beforeDelete(); } @@ -1162,7 +1161,7 @@ class Customer extends \Magento\Core\Model\AbstractModel /* If an email was used to start the registration process and it is the same email as the one used to register, then this can skip confirmation. */ - $skipConfirmationIfEmail = $this->_coreRegistry->registry("skip_confirmation_if_email"); + $skipConfirmationIfEmail = $this->_registry->registry("skip_confirmation_if_email"); if (!$skipConfirmationIfEmail) { return false; } @@ -1235,12 +1234,12 @@ class Customer extends \Magento\Core\Model\AbstractModel * * @param string $passwordLinkToken * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function changeResetPasswordLinkToken($passwordLinkToken) { if (!is_string($passwordLinkToken) || empty($passwordLinkToken)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid password reset token.'), self::EXCEPTION_INVALID_RESET_PASSWORD_LINK_TOKEN ); diff --git a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php index 0fd7f93accf739928fc78297c18593947f749e6e..dd3ed177a3004e7af324791db38ea4e52f8ff7a2 100644 --- a/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php +++ b/app/code/Magento/Customer/Model/Customer/Attribute/Backend/Password.php @@ -25,7 +25,7 @@ */ namespace Magento\Customer\Model\Customer\Attribute\Backend; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Customer password attribute backend diff --git a/app/code/Magento/Customer/Model/Group.php b/app/code/Magento/Customer/Model/Group.php index 07ef668833e8a4752aaaf8b356e8bc3565cfb811..dff1b59c1ef3d250aca6223d8cc921c07afa0232 100644 --- a/app/code/Magento/Customer/Model/Group.php +++ b/app/code/Magento/Customer/Model/Group.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Customer * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -33,12 +31,8 @@ namespace Magento\Customer\Model; * @method string getCustomerGroupCode() * @method \Magento\Customer\Model\Group setCustomerGroupCode(string $value) * @method \Magento\Customer\Model\Group setTaxClassId(int $value) - * - * @category Magento - * @package Magento_Customer - * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\AbstractModel +class Group extends \Magento\Model\AbstractModel { /** * Xml config path for create account default group @@ -91,7 +85,7 @@ class Group extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Index\Model\Indexer $indexer - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -100,7 +94,7 @@ class Group extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\Store\Config $storeConfig, \Magento\Index\Model\Indexer $indexer, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -139,7 +133,9 @@ class Group extends \Magento\Core\Model\AbstractModel } /** - * @param int|null $groupId + * Get the tax class id for the specified group or this group if the groupId is null + * + * @param int|null $groupId The id of the group whose tax class id is being sought * @return int */ public function getTaxClassId($groupId = null) @@ -155,6 +151,8 @@ class Group extends \Magento\Core\Model\AbstractModel } /** + * Determine if this group is used as the create account default group + * * @return bool */ public function usesAsDefault() diff --git a/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php b/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php index 85f3d3fc2bfb218e7d5cdfaba174f22d1fdb66da..34b773df49e0b9efd728ab8e82ccd6135a4db512 100644 --- a/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php +++ b/app/code/Magento/Customer/Model/Metadata/Form/AbstractData.php @@ -124,12 +124,12 @@ abstract class AbstractData * Return Attribute instance * * @return \Magento\Customer\Service\V1\Data\Eav\AttributeMetadata - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAttribute() { if (!$this->_attribute) { - throw new \Magento\Core\Exception(__('Attribute object is undefined')); + throw new \Magento\Model\Exception(__('Attribute object is undefined')); } return $this->_attribute; } @@ -506,7 +506,7 @@ abstract class AbstractData * * @param array|string|null $value * @return array|bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ abstract public function validateValue($value); diff --git a/app/code/Magento/Customer/Model/Observer.php b/app/code/Magento/Customer/Model/Observer.php index 98d07664f5e929af6ae70fe6a298a2f8a73227dc..ee00bb5fc3bc19740fa68c4cfd46d0bfb875199b 100644 --- a/app/code/Magento/Customer/Model/Observer.php +++ b/app/code/Magento/Customer/Model/Observer.php @@ -218,27 +218,4 @@ class Observer $this->_coreRegistry->register(self::VIV_PROCESSED_FLAG, false, true); } } - - /** - * Revert emulated customer group_id - * - * @param \Magento\Event\Observer $observer - * @return void - */ - public function quoteSubmitAfter($observer) - { - /** @var $customer Customer */ - $customer = $observer->getQuote()->getCustomer(); - - if (!$this->_customerAddress->isVatValidationEnabled($customer->getStore())) { - return; - } - - if (!$customer->getId()) { - return; - } - - $customer->setGroupId((int)$customer->getOrigData('group_id')); - $customer->save(); - } } diff --git a/app/code/Magento/Customer/Model/Resource/Customer.php b/app/code/Magento/Customer/Model/Resource/Customer.php index 0c7068515f2b6a341a920d1902adfa95ea9aa656..d904f9b976b1cff64c1d2dee60a675e73344dc90 100644 --- a/app/code/Magento/Customer/Model/Resource/Customer.php +++ b/app/code/Magento/Customer/Model/Resource/Customer.php @@ -109,7 +109,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Object $customer * @return $this * @throws \Magento\Customer\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave(\Magento\Object $customer) { @@ -266,7 +266,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity * @param \Magento\Customer\Model\Customer $customer * @param string $email * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadByEmail(\Magento\Customer\Model\Customer $customer, $email) { @@ -281,7 +281,7 @@ class Customer extends \Magento\Eav\Model\Entity\AbstractEntity if ($customer->getSharingConfig()->isWebsiteScope()) { if (!$customer->hasData('website_id')) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Customer website ID must be specified when using the website scope') ); } diff --git a/app/code/Magento/Customer/Model/Resource/Group.php b/app/code/Magento/Customer/Model/Resource/Group.php index 7d21b16af77759ca6480e5f87928f85110788702..61e6fe27b0cf9ac559fc56a7b7473dd7cd235d7c 100644 --- a/app/code/Magento/Customer/Model/Resource/Group.php +++ b/app/code/Magento/Customer/Model/Resource/Group.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Resource; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Customer data @@ -86,14 +86,14 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if group uses as default * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $group) + protected function _beforeDelete(\Magento\Model\AbstractModel $group) { if ($group->usesAsDefault()) { - throw new \Magento\Core\Exception(__('The group "%1" cannot be deleted', $group->getCode())); + throw new \Magento\Model\Exception(__('The group "%1" cannot be deleted', $group->getCode())); } return parent::_beforeDelete($group); } @@ -101,10 +101,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Method set default group id to the customers collection * - * @param \Magento\Core\Model\AbstractModel $group + * @param \Magento\Model\AbstractModel $group * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $group) + protected function _afterDelete(\Magento\Model\AbstractModel $group) { $customerCollection = $this->_createCustomersCollection()->addAttributeToFilter( 'group_id', diff --git a/app/code/Magento/Customer/Model/Resource/Group/Collection.php b/app/code/Magento/Customer/Model/Resource/Group/Collection.php index 57dbc29bd6ce8e407ece1b94de815d37313b9311..811859079be693ef1935593f50363dc7c38b9bd4 100644 --- a/app/code/Magento/Customer/Model/Resource/Group/Collection.php +++ b/app/code/Magento/Customer/Model/Resource/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Customer\Model\Resource\Group; * @package Magento_Customer * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php index 3046433d139f69d0ce6badbe424bfc3d3c954e81..ff23fc03068b75760722f2aa91857b65831891d4 100644 --- a/app/code/Magento/Customer/Service/V1/CustomerAccountService.php +++ b/app/code/Magento/Customer/Service/V1/CustomerAccountService.php @@ -34,8 +34,10 @@ use Magento\Exception\InputException; use Magento\Exception\AuthenticationException; use Magento\Exception\NoSuchEntityException; use Magento\Exception\StateException; +use Magento\Mail\Exception as MailException; use Magento\Math\Random; use Magento\UrlInterface; +use Magento\Logger; /** * Handle various customer account actions @@ -100,6 +102,11 @@ class CustomerAccountService implements CustomerAccountServiceInterface */ private $_url; + /** + * @var Logger + */ + protected $_logger; + /** * Constructor * @@ -115,6 +122,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface * @param CustomerAddressServiceInterface $customerAddressService * @param CustomerMetadataServiceInterface $customerMetadataService * @param UrlInterface $url + * @param Logger $logger * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -130,7 +138,8 @@ class CustomerAccountService implements CustomerAccountServiceInterface Data\SearchResultsBuilder $searchResultsBuilder, CustomerAddressServiceInterface $customerAddressService, CustomerMetadataServiceInterface $customerMetadataService, - UrlInterface $url + UrlInterface $url, + Logger $logger ) { $this->_customerFactory = $customerFactory; $this->_eventManager = $eventManager; @@ -144,6 +153,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface $this->_customerAddressService = $customerAddressService; $this->_customerMetadataService = $customerMetadataService; $this->_url = $url; + $this->_logger = $logger; } /** @@ -157,11 +167,16 @@ class CustomerAccountService implements CustomerAccountServiceInterface throw (new NoSuchEntityException('email', $email))->addField('websiteId', $websiteId); } if ($customer->getConfirmation()) { - $customer->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_CONFIRMATION, - $redirectUrl, - $this->_storeManager->getStore()->getId() - ); + try { + $customer->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_CONFIRMATION, + $redirectUrl, + $this->_storeManager->getStore()->getId() + ); + } catch (MailException $e) { + // If we are not able to send a new account email, this should be ignored + $this->_logger->logException($e); + } } else { throw new StateException('No confirmation needed.', StateException::INVALID_STATE); } @@ -200,7 +215,7 @@ class CustomerAccountService implements CustomerAccountServiceInterface $customerModel->setWebsiteId($this->_storeManager->getStore()->getWebsiteId()); try { $customerModel->authenticate($username, $password); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { switch ($e->getCode()) { case CustomerModel::EXCEPTION_EMAIL_NOT_CONFIRMED: $code = AuthenticationException::EMAIL_NOT_CONFIRMED; @@ -248,15 +263,20 @@ class CustomerAccountService implements CustomerAccountServiceInterface ); $customer->setResetPasswordUrl($resetUrl); - switch ($template) { - case CustomerAccountServiceInterface::EMAIL_REMINDER: - $customer->sendPasswordReminderEmail(); - break; - case CustomerAccountServiceInterface::EMAIL_RESET: - $customer->sendPasswordResetConfirmationEmail(); - break; - default: - throw new InputException(__('Invalid email type.'), InputException::INVALID_FIELD_VALUE); + try { + switch ($template) { + case CustomerAccountServiceInterface::EMAIL_REMINDER: + $customer->sendPasswordReminderEmail(); + break; + case CustomerAccountServiceInterface::EMAIL_RESET: + $customer->sendPasswordResetConfirmationEmail(); + break; + default: + throw new InputException(__('Invalid email type.'), InputException::INVALID_FIELD_VALUE); + } + } catch (MailException $e) { + // If we are not able to send a reset password email, this should be ignored + $this->_logger->logException($e); } } @@ -331,18 +351,23 @@ class CustomerAccountService implements CustomerAccountServiceInterface $newLinkToken = $this->_mathRandom->getUniqueHash(); $customerModel->changeResetPasswordLinkToken($newLinkToken); - if ($customerModel->isConfirmationRequired()) { - $customerModel->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_CONFIRMATION, - $redirectUrl, - $customer->getStoreId() - ); - } else { - $customerModel->sendNewAccountEmail( - self::NEW_ACCOUNT_EMAIL_REGISTERED, - $redirectUrl, - $customer->getStoreId() - ); + try { + if ($customerModel->isConfirmationRequired()) { + $customerModel->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_CONFIRMATION, + $redirectUrl, + $customer->getStoreId() + ); + } else { + $customerModel->sendNewAccountEmail( + self::NEW_ACCOUNT_EMAIL_REGISTERED, + $redirectUrl, + $customer->getStoreId() + ); + } + } catch (MailException $e) { + // If we are not able to send a new account email, this should be ignored + $this->_logger->logException($e); } return $this->_converter->createCustomerFromModel($customerModel); } diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index 3f0e19c184d6a0cf67fa9cb1ab2e57633b038abe..06620c2e64fcf23b0d76a77792cb8aadaa3e6502 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -89,4 +89,11 @@ <argument name="url" xsi:type="object">Magento\Url</argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="customer" xsi:type="string">Magento\Customer\Model\Customer</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php index 94c5fc6addc7c59a81224488f011f3c8e4d489f2..17c9ffe23c47b5aeefac6966f5ece458dd357bf5 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/BackgroundUploader.php @@ -99,7 +99,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo * Get component of 'checkbox' type (actually 'tile') * * @return \Magento\Data\Form\Element\Checkbox - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCheckboxElement() { @@ -112,7 +112,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo } } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Element "%1" is not found in "%2".', $checkboxId, $this->getData('name')) ); } @@ -121,7 +121,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo * Get component of 'image-uploader' type * * @return \Magento\DesignEditor\Block\Adminhtml\Editor\Form\Element\ImageUploader - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getImageUploaderElement() { @@ -132,7 +132,7 @@ class BackgroundUploader extends \Magento\DesignEditor\Block\Adminhtml\Editor\Fo return $e; } } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Element "%1" is not found in "%2".', $imageUploaderId, $this->getData('name')) ); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php index f938aec0b0ca600225669d0f1e068789e5cb7333..0aeaf326b9f54632c8d5b2ce34e2fdf70f7d1162 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Column.php @@ -100,12 +100,12 @@ class Column extends \Magento\Data\Form\Element\Fieldset implements /** * @return \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getRendererFactory() { if (!$this->_rendererFactory) { - throw new \Magento\Core\Exception('Renderer factory was not set'); + throw new \Magento\Model\Exception('Renderer factory was not set'); } return $this->_rendererFactory; } @@ -122,12 +122,12 @@ class Column extends \Magento\Data\Form\Element\Fieldset implements /** * @return \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getElementsFactory() { if (!$this->_elementsFactory) { - throw new \Magento\Core\Exception('Form elements factory was not set'); + throw new \Magento\Model\Exception('Form elements factory was not set'); } return $this->_elementsFactory; } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php index c5239097b1ca03816e8cfe34320faeceff4ca94d..c8c83faf1dd556fdc3360a1803c5adfe5138231e 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php @@ -129,7 +129,7 @@ abstract class AbstractComposite extends \Magento\Data\Form\Element\Fieldset imp $layoutName = $element->getId() . '-renderer'; try { $renderer = $this->_rendererFactory->create($className, $layoutName); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $renderer = null; } if ($renderer) { @@ -145,14 +145,14 @@ abstract class AbstractComposite extends \Magento\Data\Form\Element\Fieldset imp * @param string $type * @param string|null $subtype * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getComponent($type, $subtype = null) { $components = $this->getComponents(); $componentId = $this->getComponentId($type); if (!isset($components[$componentId])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Component of the type "%1" is not found between elements of "%2"', $type, $this->getData('name')) ); } diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php index 29d46acd263d6a1da36b320eaf544d6d80328c29..034fa038f3a513a537820405684031fcf5b6cd7c 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/QuickStyles/AbstractTab.php @@ -81,12 +81,12 @@ abstract class AbstractTab extends \Magento\Backend\Block\Widget\Form * Create a form element with necessary controls * * @return \Magento\DesignEditor\Block\Adminhtml\Editor\Tools\QuickStyles\Header - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _prepareForm() { if (!$this->_formId || !$this->_tab) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid block of class "%1". Please define the required properties.', get_class($this)) ); } diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php index 40f0e44042cc246e1dab47c006b903f360db249e..10db01f3f2a73b2512a3f3c0c04dcb98baa5cdfe 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -26,7 +26,7 @@ namespace Magento\DesignEditor\Controller\Adminhtml\System\Design; use Magento\Core\Model\Store; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\View\Design\ThemeInterface; /** diff --git a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php index a6b4ec621478d077f50983d6e0c357f1dee4de4f..de1b8b348bda31455f41e91d268ae694725b127c 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor/Tools.php @@ -25,7 +25,7 @@ */ namespace Magento\DesignEditor\Controller\Adminhtml\System\Design\Editor; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Backend controller for the design editor diff --git a/app/code/Magento/DesignEditor/Helper/Data.php b/app/code/Magento/DesignEditor/Helper/Data.php index 7c48ab4b000f4f0f8a8781a82b1f1668822110f6..6443819f42766201431af083f318514565474726 100644 --- a/app/code/Magento/DesignEditor/Helper/Data.php +++ b/app/code/Magento/DesignEditor/Helper/Data.php @@ -33,6 +33,11 @@ use Magento\App\RequestInterface; */ class Data extends \Magento\App\Helper\AbstractHelper { + /** + * Parameter to indicate the translation mode (null, text, script, or alt). + */ + const TRANSLATION_MODE = "translation_mode"; + /** * XML path to VDE front name setting * @@ -47,16 +52,6 @@ class Data extends \Magento\App\Helper\AbstractHelper */ protected $_disabledCacheTypes; - /** - * Parameter to indicate the translation mode (null, text, script, or alt). - */ - const TRANSLATION_MODE = "translation_mode"; - - /** - * @var bool - */ - protected $_isVdeRequest = false; - /** * @var string */ @@ -94,41 +89,6 @@ class Data extends \Magento\App\Helper\AbstractHelper return $this->_disabledCacheTypes; } - /** - * This method returns an indicator of whether or not the current request is for vde - * - * @param RequestInterface $request - * @return bool - */ - public function isVdeRequest(RequestInterface $request = null) - { - if (null !== $request) { - $result = false; - $splitPath = explode('/', trim($request->getOriginalPathInfo(), '/')); - if (count($splitPath) >= 3) { - list($frontName, $currentMode, $themeId) = $splitPath; - $result = $frontName === $this->getFrontName() && in_array( - $currentMode, - $this->getAvailableModes() - ) && is_numeric( - $themeId - ); - } - $this->_isVdeRequest = $result; - } - return $this->_isVdeRequest; - } - - /** - * Get available modes for Design Editor - * - * @return string[] - */ - public function getAvailableModes() - { - return array(\Magento\DesignEditor\Model\State::MODE_NAVIGATION); - } - /** * Returns the translation mode the current request is in (null, text, script, or alt). * @@ -160,4 +120,28 @@ class Data extends \Magento\App\Helper\AbstractHelper { return $this->_translationMode !== null; } + + /** + * This method returns an indicator of whether or not the current request is for vde + * + * @param RequestInterface $request + * @return bool + */ + public function isVdeRequest(RequestInterface $request = null) + { + $result = false; + if (null !== $request) { + $splitPath = explode('/', trim($request->getOriginalPathInfo(), '/')); + if (count($splitPath) >= 3) { + list($frontName, $currentMode, $themeId) = $splitPath; + $result = $frontName === $this->_frontName && in_array( + $currentMode, + [\Magento\DesignEditor\Model\State::MODE_NAVIGATION] + ) && is_numeric( + $themeId + ); + } + } + return $result; + } } diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php index b21ebe955ee6197bc5c6a6b56da3e952343c16bf..82cc86befef5bd47310a06d7bf6d34247962cbe6 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/Controls/Configuration.php @@ -207,12 +207,12 @@ class Configuration * * @param string $controlName * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getControlData($controlName) { if (!isset($this->_controlList[$controlName])) { - throw new \Magento\Core\Exception("Unknown control: \"{$controlName}\""); + throw new \Magento\Model\Exception("Unknown control: \"{$controlName}\""); } return $this->_controlList[$controlName]; } diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php index 48f5a09792714ecf92f0b73a61d73f104c5e2441..b0e2a24ba578e41946df201966a48e2880076b50 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Renderer/Factory.php @@ -83,12 +83,12 @@ class Factory * @param string $elementClassName * @param string $rendererName * @return RendererInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($elementClassName, $rendererName) { if (!isset($this->_rendererByElement[$elementClassName])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( sprintf('No renderer registered for elements of class "%s"', $elementClassName) ); } diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php index cc0eb21173654e0fc59a30071d02a3861b4dfca8..34d0068a7abbcc47732d445c1bfac88cfbcb934c 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/ImageUploader.php @@ -136,7 +136,7 @@ class ImageUploader extends \Magento\Object if (!$uploader->save($this->getStoragePath())) { /** @todo add translator */ - throw new \Magento\Core\Exception('Cannot upload file.'); + throw new \Magento\Model\Exception('Cannot upload file.'); } $result['css_path'] = implode( '/', diff --git a/app/code/Magento/DesignEditor/Model/Observer.php b/app/code/Magento/DesignEditor/Model/Observer.php index c829aa4224113687c2232bc4a15b7b4982e5cfac..8bd15c177820b9932617c3bef196f4ece5506658 100644 --- a/app/code/Magento/DesignEditor/Model/Observer.php +++ b/app/code/Magento/DesignEditor/Model/Observer.php @@ -135,19 +135,4 @@ class Observer $change->save(); } } - - /** - * Determine if the vde specific translation class should be used. - * - * @param EventObserver $observer - * @return $this - */ - public function initializeTranslation(EventObserver $observer) - { - if ($this->_helper->isVdeRequest()) { - // Request is for vde. Override the translation class. - $observer->getResult()->setInlineType('Magento\DesignEditor\Model\Translate\InlineVde'); - } - return $this; - } } diff --git a/app/code/Magento/DesignEditor/Model/State.php b/app/code/Magento/DesignEditor/Model/State.php index 9d30e30183c6032f44ee622e848d1a750cee8fde..f7c6f503ae7daa18cd81f27c5e3353f0bf0b06ad 100644 --- a/app/code/Magento/DesignEditor/Model/State.php +++ b/app/code/Magento/DesignEditor/Model/State.php @@ -82,9 +82,9 @@ class State protected $_objectManager; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_application; + protected $_configuration; /** * Store list manager @@ -96,12 +96,12 @@ class State /** * @param \Magento\Backend\Model\Session $backendSession * @param AreaEmulator $areaEmulator - * @param \Magento\DesignEditor\Model\Url\Factory $urlModelFactory + * @param Url\Factory $urlModelFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\DesignEditor\Helper\Data $dataHelper * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\App $application - * @param \Magento\DesignEditor\Model\Theme\Context $themeContext + * @param \Magento\App\ConfigInterface $configuration + * @param Theme\Context $themeContext * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( @@ -111,7 +111,7 @@ class State \Magento\App\Cache\StateInterface $cacheState, \Magento\DesignEditor\Helper\Data $dataHelper, \Magento\ObjectManager $objectManager, - \Magento\Core\Model\App $application, + \Magento\App\ConfigInterface $configuration, \Magento\DesignEditor\Model\Theme\Context $themeContext, \Magento\Core\Model\StoreManagerInterface $storeManager ) { @@ -121,7 +121,7 @@ class State $this->_cacheState = $cacheState; $this->_dataHelper = $dataHelper; $this->_objectManager = $objectManager; - $this->_application = $application; + $this->_configuration = $configuration; $this->_themeContext = $themeContext; $this->_storeManager = $storeManager; } @@ -203,7 +203,7 @@ class State if ($this->_themeContext->getEditableTheme()) { $themeId = $this->_themeContext->getVisibleTheme()->getId(); $this->_storeManager->getStore()->setConfig(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); - $this->_application->getConfig()->setValue(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); + $this->_configuration->setValue(\Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId); } } diff --git a/app/code/Magento/DesignEditor/Model/Theme/Change.php b/app/code/Magento/DesignEditor/Model/Theme/Change.php index 030e5e6fda4fe542fd86e2d402e3da58ba6283c5..616cffd7d22085d3997dfb99c68e1450fe0119c6 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Change.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Change.php @@ -28,7 +28,7 @@ namespace Magento\DesignEditor\Model\Theme; /** * Design editor theme change */ -class Change extends \Magento\Core\Model\AbstractModel +class Change extends \Magento\Model\AbstractModel { /** * Theme model initialization diff --git a/app/code/Magento/DesignEditor/Model/Theme/Context.php b/app/code/Magento/DesignEditor/Model/Theme/Context.php index 8d8732671f1d181dbaed5ad468edac9cfd3c27d7..2e41b1971aa885f43f9329cd5a6b8926185c4d5e 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Context.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Context.php @@ -25,7 +25,7 @@ */ namespace Magento\DesignEditor\Model\Theme; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Design editor theme context diff --git a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php index 06244e7dd1d7c2c786563132fa38cb3c0b9728c0..2b325ac2e3307d26b40a712769a6f77f730f220d 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Resource/Change.php @@ -28,7 +28,7 @@ namespace Magento\DesignEditor\Model\Theme\Resource; /** * Theme change resource model */ -class Change extends \Magento\Core\Model\Resource\Db\AbstractDb +class Change extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -59,10 +59,10 @@ class Change extends \Magento\Core\Model\Resource\Db\AbstractDb /** * {@inheritdoc} * - * @param \Magento\Core\Model\AbstractModel $change + * @param \Magento\Model\AbstractModel $change * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $change) + protected function _beforeSave(\Magento\Model\AbstractModel $change) { if (!$change->getChangeTime()) { $change->setChangeTime($this->dateTime->formatDate(true)); diff --git a/app/code/Magento/DesignEditor/Model/Translate/InlineVde.php b/app/code/Magento/DesignEditor/Model/Translate/Inline.php similarity index 68% rename from app/code/Magento/DesignEditor/Model/Translate/InlineVde.php rename to app/code/Magento/DesignEditor/Model/Translate/Inline.php index c1b4381e1f81f734e3b056f535f10dfcd4858169..0ff98a882a028179a2611f489b39fc9b9d891b2c 100644 --- a/app/code/Magento/DesignEditor/Model/Translate/InlineVde.php +++ b/app/code/Magento/DesignEditor/Model/Translate/Inline.php @@ -28,37 +28,27 @@ namespace Magento\DesignEditor\Model\Translate; /** * Inline translation specific to Vde. */ -class InlineVde implements \Magento\Translate\InlineInterface +class Inline implements \Magento\Translate\InlineInterface { /** * data-translate-mode attribute name */ const TRANSLATE_MODE = 'data-translate-mode'; - /** - * text translate mode + /**#@+ + * Translate modes */ const MODE_TEXT = 'text'; - - /** - * img element name - */ - const ELEMENT_IMG = 'img'; - - /** - * alt translate mode - */ const MODE_ALT = 'alt'; - - /** - * script translate mode - */ const MODE_SCRIPT = 'script'; + /**#@-*/ - /** - * script element name + /**#@+ + * Html tags */ - const ELEMENT_SCRIPT = self::MODE_SCRIPT; + const TAG_IMG = 'img'; + const TAG_SCRIPT = 'script'; + /**#@-*/ /** * @var \Magento\DesignEditor\Helper\Data @@ -70,6 +60,11 @@ class InlineVde implements \Magento\Translate\InlineInterface */ protected $_parser; + /** + * @var \Magento\Translate\Inline\ParserFactory + */ + protected $parserFactory; + /** * @var \Magento\UrlInterface */ @@ -117,13 +112,15 @@ class InlineVde implements \Magento\Translate\InlineInterface ) { $this->_design = $design; $this->_scopeResolver = $scopeResolver; - $this->_parser = $parserFactory->create(array('translateInline' => $this)); + $this->parserFactory = $parserFactory; $this->_helper = $helper; $this->_url = $url; $this->_objectManager = $objectManager; } /** + * Check if Inline Translates is allowed + * * Translation within the vde will be enabled by the client when the 'Edit' button is enabled. * * @return bool @@ -133,6 +130,19 @@ class InlineVde implements \Magento\Translate\InlineInterface return $this->_helper->isAllowed(); } + /** + * Retrieve Inline Parser instance + * + * @return \Magento\Translate\Inline\ParserInterface + */ + public function getParser() + { + if (!$this->_parser) { + $this->_parser = $this->parserFactory->create(['translateInline' => $this]); + } + return $this->_parser; + } + /** * Replace VDE specific translation templates with HTML fragments * @@ -142,15 +152,24 @@ class InlineVde implements \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false) { + if (!$this->isAllowed()) { + return $this; + } + + $this->getParser()->setIsJson($isJson); + if (is_array($body)) { foreach ($body as &$part) { $this->processResponseBody($part, $isJson); } } elseif (is_string($body)) { - $content = $this->_parser->processResponseBodyString($body, $this); - $this->_insertInlineScriptsHtml($content); - $body = $this->_parser->getContent(); + $this->getParser()->processResponseBodyString($body); + $this->addInlineScript(); + $body = $this->getParser()->getContent(); } + + $this->getParser()->setIsJson(false); + return $this; } @@ -167,41 +186,63 @@ class InlineVde implements \Magento\Translate\InlineInterface } /** - * Create block to render script and html with added inline translation content specific for vde. + * Add inline script code + * + * Insert script and html with + * added inline translation content specific for vde. * - * @param string $content * @return void */ - private function _insertInlineScriptsHtml($content) + protected function addInlineScript() { - if ($this->_isScriptInserted || stripos($content, '</body>') === false) { + $content = $this->getParser()->getContent(); + if (stripos($content, '</body>') === false) { return; } + if (!$this->_isScriptInserted) { + $this->getParser()->setContent(str_ireplace('</body>', $this->getInlineScript() . '</body>', $content)); + $this->_isScriptInserted = true; + } + } - $scope = $this->_scopeResolver->getScope(); - $ajaxUrl = $this->_url->getUrl( - 'core/ajax/translate', - array( - '_secure' => $scope->isCurrentlySecure(), - \Magento\DesignEditor\Helper\Data::TRANSLATION_MODE => $this->_helper->getTranslationMode() - ) - ); - + /** + * Retrieve inline script code + * + * Create block to render script and html with + * added inline translation content specific for vde. + * + * @return string + */ + protected function getInlineScript() + { /** @var $block \Magento\View\Element\Template */ $block = $this->_objectManager->create('Magento\View\Element\Template'); $block->setArea($this->_design->getArea()); - $block->setAjaxUrl($ajaxUrl); - + $block->setAjaxUrl($this->_getAjaxUrl()); $block->setFrameUrl($this->_getFrameUrl()); $block->setRefreshCanvas($this->isAllowed()); $block->setTemplate('Magento_DesignEditor::translate_inline.phtml'); $block->setTranslateMode($this->_helper->getTranslationMode()); - $this->_parser->setContent(str_ireplace('</body>', $block->toHtml() . '</body>', $content)); + return $block->toHtml(); + } - $this->_isScriptInserted = true; + /** + * Return URL for ajax requests + * + * @return string + */ + protected function _getAjaxUrl() + { + return $this->_url->getUrl( + 'translation/ajax/index', + [ + '_secure' => $this->_scopeResolver->getScope()->isCurrentlySecure(), + \Magento\DesignEditor\Helper\Data::TRANSLATION_MODE => $this->_helper->getTranslationMode() + ] + ); } /** @@ -224,17 +265,21 @@ class InlineVde implements \Magento\Translate\InlineInterface /** * Get inline vde translate mode * - * @param string $tagName + * @param string $tagName * @return string */ private function _getTranslateMode($tagName) { - $mode = self::MODE_TEXT; - if (self::ELEMENT_SCRIPT == $tagName) { - $mode = self::MODE_SCRIPT; - } elseif (self::ELEMENT_IMG == $tagName) { - $mode = self::MODE_ALT; + switch ($tagName) { + case self::TAG_SCRIPT: + $result = self::MODE_SCRIPT; + break; + case self::TAG_IMG: + $result = self::MODE_ALT; + break; + default: + $result = self::MODE_TEXT; } - return $mode; + return $result; } } diff --git a/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php b/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php new file mode 100644 index 0000000000000000000000000000000000000000..c1f91d58c96bd7631d03e40e66529b11dbe6d57b --- /dev/null +++ b/app/code/Magento/DesignEditor/Model/Translate/Inline/Provider.php @@ -0,0 +1,78 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\DesignEditor\Model\Translate\Inline; + +class Provider extends \Magento\Translate\Inline\Provider +{ + /** + * @var \Magento\Translate\InlineInterface + */ + protected $vdeInlineTranslate; + + /** + * @var \Magento\Translate\InlineInterface + */ + protected $inlineTranslate; + + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + /** + * @var \Magento\DesignEditor\Helper\Data + */ + protected $helper; + + /** + * @param \Magento\Translate\InlineInterface $vdeInlineTranslate + * @param \Magento\Translate\InlineInterface $inlineTranslate + * @param \Magento\DesignEditor\Helper\Data $helper + * @param \Magento\App\RequestInterface $request + */ + public function __construct( + \Magento\Translate\InlineInterface $vdeInlineTranslate, + \Magento\Translate\InlineInterface $inlineTranslate, + \Magento\DesignEditor\Helper\Data $helper, + \Magento\App\RequestInterface $request + ) { + $this->vdeInlineTranslate = $vdeInlineTranslate; + $this->inlineTranslate = $inlineTranslate; + $this->request = $request; + $this->helper = $helper; + } + + /** + * Return instance of inline translate class + * + * @return \Magento\Translate\InlineInterface + */ + public function get() + { + return $this->helper->isVdeRequest($this->request) + ? $this->vdeInlineTranslate + : $this->inlineTranslate; + } +} diff --git a/app/code/Magento/DesignEditor/etc/di.xml b/app/code/Magento/DesignEditor/etc/di.xml index a236388a029526f7e7ba92409a127e7144861984..5814b1421a914919f0cd29e55da861de89debdab 100644 --- a/app/code/Magento/DesignEditor/etc/di.xml +++ b/app/code/Magento/DesignEditor/etc/di.xml @@ -41,4 +41,15 @@ </argument> </arguments> </type> + <type name="Magento\DesignEditor\Model\Translate\Inline\Provider"> + <arguments> + <argument name="vdeInlineTranslate" xsi:type="object">Magento\DesignEditor\Model\Translate\Inline\Proxy</argument> + <argument name="inlineTranslate" xsi:type="object">\Magento\Translate\Inline\Proxy</argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Inline"> + <arguments> + <argument name="inlineProvider" xsi:type="object">Magento\DesignEditor\Model\Translate\Inline\Provider</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/DesignEditor/etc/vde/events.xml b/app/code/Magento/DesignEditor/etc/vde/events.xml index 66e41c5a70306fa7cf3378012e5d8e09bdecc802..b047255c2ceddc56d2c3c160c01183684241d2e6 100644 --- a/app/code/Magento/DesignEditor/etc/vde/events.xml +++ b/app/code/Magento/DesignEditor/etc/vde/events.xml @@ -27,7 +27,4 @@ <event name="controller_action_layout_generate_blocks_after"> <observer name="vde_editor" instance="Magento\DesignEditor\Model\Observer" method="clearJs" /> </event> - <event name="translate_initialization_before"> - <observer name="initialize_translation" instance="Magento\DesignEditor\Model\Observer" method="initializeTranslation" /> - </event> </config> diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php index 1e9246217d9c8b4967e5c4bd921d4c61926859d1..24643cd1709e720e7444291f6ad122c35fdd714d 100644 --- a/app/code/Magento/Dhl/Model/Carrier.php +++ b/app/code/Magento/Dhl/Model/Carrier.php @@ -515,7 +515,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Get allowed shipping methods * * @return string[] - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getAllowedMethods() { @@ -535,7 +535,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $allowedMethods = explode(',', $this->getConfigData('nondoc_methods')); break; default: - throw new \Magento\Core\Exception(__('Wrong Content Type')); + throw new \Magento\Model\Exception(__('Wrong Content Type')); } } $methods = array(); @@ -913,7 +913,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin /** * Get shipping quotes * - * @return \Magento\Core\Model\AbstractModel|Result + * @return \Magento\Model\AbstractModel|Result */ protected function _getQuotes() { @@ -1047,7 +1047,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param string $response * @return bool|\Magento\Object|Result|Error - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _parseResponse($response) { @@ -1080,7 +1080,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin break; } } - throw new \Magento\Core\Exception(__('Error #%1 : %2', trim($code), trim($data))); + throw new \Magento\Model\Exception(__('Error #%1 : %2', trim($code), trim($data))); } $code = isset($nodeCondition->ConditionCode) ? (string)$nodeCondition->ConditionCode : 0; @@ -1123,7 +1123,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin } } else if (!empty($this->_errors)) { if ($this->_isShippingLabelFlag) { - throw new \Magento\Core\Exception($responseError); + throw new \Magento\Model\Exception($responseError); } return $this->_showError(); } @@ -1215,14 +1215,14 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Returns dimension unit (cm or inch) * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getDimensionUnit() { $countryId = $this->_rawRequest->getOrigCountryId(); $measureUnit = $this->getCountryParams($countryId)->getMeasureUnit(); if (empty($measureUnit)) { - throw new \Magento\Core\Exception(__("Cannot identify measure unit for %1", $countryId)); + throw new \Magento\Model\Exception(__("Cannot identify measure unit for %1", $countryId)); } return $measureUnit; } @@ -1231,14 +1231,14 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Returns weight unit (kg or pound) * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getWeightUnit() { $countryId = $this->_rawRequest->getOrigCountryId(); $weightUnit = $this->getCountryParams($countryId)->getWeightUnit(); if (empty($weightUnit)) { - throw new \Magento\Core\Exception(__("Cannot identify weight unit for %1", $countryId)); + throw new \Magento\Model\Exception(__("Cannot identify weight unit for %1", $countryId)); } return $weightUnit; } @@ -1348,7 +1348,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \Magento\Object $request * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _mapRequestToShipment(\Magento\Object $request) { @@ -1363,7 +1363,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin $minValue = $this->_getMinDimension($params['dimension_units']); if ($params['width'] < $minValue || $params['length'] < $minValue || $params['height'] < $minValue) { $message = __('Height, width and length should be equal or greater than %1', $minValue); - throw new \Magento\Core\Exception($message); + throw new \Magento\Model\Exception($message); } } @@ -1409,7 +1409,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * Do rate request and handle errors * * @return Result|\Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _doRequest() { @@ -1420,7 +1420,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin )->getRegion(); if (!$originRegion) { - throw new \Magento\Core\Exception(__('Wrong Region')); + throw new \Magento\Model\Exception(__('Wrong Region')); } if ($originRegion == 'AM') { @@ -1902,13 +1902,13 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \Magento\Shipping\Model\Shipment\Request $request * @return array|\Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function requestToShipment($request) { $packages = $request->getPackages(); if (!is_array($packages) || !$packages) { - throw new \Magento\Core\Exception(__('No packages for request')); + throw new \Magento\Model\Exception(__('No packages for request')); } $result = $this->_doShipmentRequest($request); @@ -1955,20 +1955,20 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin * * @param \SimpleXMLElement $xml * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _prepareShippingLabelContent(\SimpleXMLElement $xml) { $result = new \Magento\Object(); try { if (!isset($xml->AirwayBillNumber) || !isset($xml->LabelImage->OutputImage)) { - throw new \Magento\Core\Exception('Unable to retrieve shipping label'); + throw new \Magento\Model\Exception('Unable to retrieve shipping label'); } $result->setTrackingNumber((string)$xml->AirwayBillNumber); $labelContent = (string)$xml->LabelImage->OutputImage; $result->setShippingLabelContent(base64_decode($labelContent)); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__($e->getMessage())); + throw new \Magento\Model\Exception(__($e->getMessage())); } return $result; } diff --git a/app/code/Magento/Directory/Exception.php b/app/code/Magento/Directory/Exception.php index 3e2e94309bace17ca4884394451c43d9ca83884c..8bb1b304b1e3aef03c137eb5714661367ba9aad4 100644 --- a/app/code/Magento/Directory/Exception.php +++ b/app/code/Magento/Directory/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Directory; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Directory/Model/Country.php b/app/code/Magento/Directory/Model/Country.php index dde57c633c3f1333eb1cc4d60e71375eba8a89eb..0f1f6fbaa7124f6b968ba8e75ae9d95aff42d0f0 100644 --- a/app/code/Magento/Directory/Model/Country.php +++ b/app/code/Magento/Directory/Model/Country.php @@ -38,7 +38,7 @@ */ namespace Magento\Directory\Model; -class Country extends \Magento\Core\Model\AbstractModel +class Country extends \Magento\Model\AbstractModel { /** * @var array @@ -66,7 +66,7 @@ class Country extends \Magento\Core\Model\AbstractModel * @param \Magento\Locale\ListsInterface $localeLists * @param Country\FormatFactory $formatFactory * @param Resource\Region\CollectionFactory $regionCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -76,7 +76,7 @@ class Country extends \Magento\Core\Model\AbstractModel \Magento\Locale\ListsInterface $localeLists, \Magento\Directory\Model\Country\FormatFactory $formatFactory, \Magento\Directory\Model\Resource\Region\CollectionFactory $regionCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Directory/Model/Country/Format.php b/app/code/Magento/Directory/Model/Country/Format.php index a9568368e26d8463727be6111cf1fff678b8d65f..6fe18d3d7efec42d14526d18278d45a4142f938b 100644 --- a/app/code/Magento/Directory/Model/Country/Format.php +++ b/app/code/Magento/Directory/Model/Country/Format.php @@ -41,7 +41,7 @@ namespace Magento\Directory\Model\Country; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Format extends \Magento\Core\Model\AbstractModel +class Format extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Directory/Model/Currency.php b/app/code/Magento/Directory/Model/Currency.php index ab7a40dbf707cd025b217228baef30f92b6389ff..11ef48b227bc2055e5832d343b1034e0d7a2287f 100644 --- a/app/code/Magento/Directory/Model/Currency.php +++ b/app/code/Magento/Directory/Model/Currency.php @@ -36,7 +36,7 @@ namespace Magento\Directory\Model; use Magento\Directory\Exception; use Magento\Directory\Model\Currency\Filter; -class Currency extends \Magento\Core\Model\AbstractModel +class Currency extends \Magento\Model\AbstractModel { /** * CONFIG path constants @@ -92,7 +92,7 @@ class Currency extends \Magento\Core\Model\AbstractModel * @param \Magento\Directory\Helper\Data $directoryHelper * @param Currency\FilterFactory $currencyFilterFactory * @param \Magento\Locale\CurrencyInterface $localeCurrency - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -104,7 +104,7 @@ class Currency extends \Magento\Core\Model\AbstractModel \Magento\Directory\Helper\Data $directoryHelper, \Magento\Directory\Model\Currency\FilterFactory $currencyFilterFactory, \Magento\Locale\CurrencyInterface $localeCurrency, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php index 56c770f1e281f90843793a712fd2006f7c3f0181..2bdb02440fb11cc235679d0d8d7a856f7706d68f 100644 --- a/app/code/Magento/Directory/Model/Currency/DefaultLocator.php +++ b/app/code/Magento/Directory/Model/Currency/DefaultLocator.php @@ -28,11 +28,11 @@ namespace Magento\Directory\Model\Currency; class DefaultLocator { /** - * Application object + * Config object * - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * Store manager @@ -42,14 +42,14 @@ class DefaultLocator protected $_storeManager; /** - * Constructor - * - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ - public function __construct(\Magento\Core\Model\App $app, \Magento\Core\Model\StoreManagerInterface $storeManager) - { - $this->_app = $app; + public function __construct( + \Magento\App\ConfigInterface $configuration, + \Magento\Core\Model\StoreManagerInterface $storeManager + ) { + $this->_configuration = $configuration; $this->_storeManager = $storeManager; } @@ -71,7 +71,10 @@ class DefaultLocator $group = $request->getParam('group'); $currencyCode = $this->_storeManager->getGroup($group)->getWebsite()->getBaseCurrencyCode(); } else { - $currencyCode = $this->_app->getBaseCurrencyCode(); + $currencyCode = $this->_configuration->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); } return $currencyCode; diff --git a/app/code/Magento/Directory/Model/Observer.php b/app/code/Magento/Directory/Model/Observer.php index a98f388014fb0423e33cc88fd77b7f406e07588b..2218d73c6230243111b848204e4ff7b6f6a744e7 100644 --- a/app/code/Magento/Directory/Model/Observer.php +++ b/app/code/Magento/Directory/Model/Observer.php @@ -57,11 +57,6 @@ class Observer */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Mail\Template\TransportBuilder */ @@ -77,28 +72,33 @@ class Observer */ protected $_currencyFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Directory\Model\Currency\Import\Factory $importFactory * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Directory\Model\Currency\Import\Factory $importFactory, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Directory\Model\CurrencyFactory $currencyFactory + \Magento\Directory\Model\CurrencyFactory $currencyFactory, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_importFactory = $importFactory; $this->_coreStoreConfig = $coreStoreConfig; - $this->_translate = $translate; $this->_transportBuilder = $transportBuilder; $this->_storeManager = $storeManager; $this->_currencyFactory = $currencyFactory; + $this->inlineTranslation = $inlineTranslation; } /** @@ -141,8 +141,7 @@ class Observer if (sizeof($importWarnings) == 0) { $this->_currencyFactory->create()->saveRates($rates); } else { - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -161,7 +160,7 @@ class Observer $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); } } } diff --git a/app/code/Magento/Directory/Model/Region.php b/app/code/Magento/Directory/Model/Region.php index e02e1b0ea0cb6aa6a3da0f9da9653a5d8ba491f9..ecd63e3090b7cdbcecf06f4a3280e07df9ac5759 100644 --- a/app/code/Magento/Directory/Model/Region.php +++ b/app/code/Magento/Directory/Model/Region.php @@ -43,7 +43,7 @@ */ namespace Magento\Directory\Model; -class Region extends \Magento\Core\Model\AbstractModel +class Region extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Directory/Model/Resource/Country.php b/app/code/Magento/Directory/Model/Resource/Country.php index a7a1d94c49b56f1e787f848b02f6990a922fed87..4f41606069df618b628b4324d7e3413ac8d17a2f 100644 --- a/app/code/Magento/Directory/Model/Resource/Country.php +++ b/app/code/Magento/Directory/Model/Resource/Country.php @@ -28,7 +28,7 @@ namespace Magento\Directory\Model\Resource; /** * Directory Country Resource Model */ -class Country extends \Magento\Core\Model\Resource\Db\AbstractDb +class Country extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization @@ -46,7 +46,7 @@ class Country extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Directory\Model\Country $country * @param string $code * @return \Magento\Directory\Model\Resource\Country - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadByCode(\Magento\Directory\Model\Country $country, $code) { @@ -60,7 +60,7 @@ class Country extends \Magento\Core\Model\Resource\Db\AbstractDb break; default: - throw new \Magento\Core\Exception(__('Please correct the country code: %1.', $code)); + throw new \Magento\Model\Exception(__('Please correct the country code: %1.', $code)); } return $this->load($country, $code, $field); diff --git a/app/code/Magento/Directory/Model/Resource/Country/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Collection.php index cb0f3cca3c8b2d014bf0af661584c8856e3ffc45..f096afc3f55c57c7b1d701981b73bb4a745bed15 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Collection.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource\Country; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Locale model @@ -73,7 +73,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Locale\ResolverInterface $localeResolver * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -86,7 +86,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Locale\ResolverInterface $localeResolver, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_coreStoreConfig = $coreStoreConfig; diff --git a/app/code/Magento/Directory/Model/Resource/Country/Format.php b/app/code/Magento/Directory/Model/Resource/Country/Format.php index d093b93042e491f7495b076876f710c7e0088ebe..4e07fadbe3ffd184ec76c7ff54459ed7237947ea 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Format.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Format.php @@ -32,7 +32,7 @@ namespace Magento\Directory\Model\Resource\Country; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Format extends \Magento\Core\Model\Resource\Db\AbstractDb +class Format extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php b/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php index d7a5d88b98c74aa407fa2eebd2676a3127e6503d..cd466f263eba2f0a5dd2425ca4cc762956e334b5 100644 --- a/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Country/Format/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Directory\Model\Resource\Country\Format; * @package Magento_Directory * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define main table diff --git a/app/code/Magento/Directory/Model/Resource/Currency.php b/app/code/Magento/Directory/Model/Resource/Currency.php index 098ef5fd3dc8c573c143d2326d8d20d8bc0e4143..4c8eb49d6b3d4a298c75beca94414eef63fc8339 100644 --- a/app/code/Magento/Directory/Model/Resource/Currency.php +++ b/app/code/Magento/Directory/Model/Resource/Currency.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource; -class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb +class Currency extends \Magento\Model\Resource\Db\AbstractDb { /** * Currency rate table @@ -151,7 +151,7 @@ class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param array $rates * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRates($rates) { @@ -171,7 +171,7 @@ class Currency extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->insertOnDuplicate($this->_currencyRateTable, $data, array('rate')); } } else { - throw new \Magento\Core\Exception(__('Please correct the rates received')); + throw new \Magento\Model\Exception(__('Please correct the rates received')); } } diff --git a/app/code/Magento/Directory/Model/Resource/Region.php b/app/code/Magento/Directory/Model/Resource/Region.php index d8a6ffb53a846ef7b9b21123b85e7d2eb17ea204..22c131b6df08bd86998167c8bd3215ebd31b4893 100644 --- a/app/code/Magento/Directory/Model/Resource/Region.php +++ b/app/code/Magento/Directory/Model/Resource/Region.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource; -class Region extends \Magento\Core\Model\Resource\Db\AbstractDb +class Region extends \Magento\Model\Resource\Db\AbstractDb { /** * Table with localized region names @@ -69,7 +69,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) @@ -78,7 +78,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter = $this->_getReadAdapter(); $locale = $this->_localeResolver->getLocaleCode(); - $systemLocale = \Magento\Core\Model\App::DISTRO_LOCALE_CODE; + $systemLocale = \Magento\AppInterface::DISTRO_LOCALE_CODE; $regionField = $adapter->quoteIdentifier($this->getMainTable() . '.' . $this->getIdFieldName()); @@ -107,7 +107,7 @@ class Region extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load object by country id and code or default name * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int $countryId * @param string $value * @param string $field diff --git a/app/code/Magento/Directory/Model/Resource/Region/Collection.php b/app/code/Magento/Directory/Model/Resource/Region/Collection.php index 34f0e55a8a9ed48b261a07f9735674c7d1769a8d..4177bc8b0855a552ba95e1e7190173d51fb9caf0 100644 --- a/app/code/Magento/Directory/Model/Resource/Region/Collection.php +++ b/app/code/Magento/Directory/Model/Resource/Region/Collection.php @@ -29,7 +29,7 @@ */ namespace Magento\Directory\Model\Resource\Region; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Locale region name table name @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -66,7 +66,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Locale\ResolverInterface $localeResolver, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_localeResolver = $localeResolver; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php index 2687716f6cc7fde80793d9f20a2bf5288ec82b48..704c036245db5e117f84e969b36a51b6f0fb27c0 100644 --- a/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php +++ b/app/code/Magento/Downloadable/Block/Catalog/Product/Links.php @@ -26,20 +26,18 @@ namespace Magento\Downloadable\Block\Catalog\Product; use Magento\Downloadable\Model\Link; +use Magento\Customer\Controller\RegistryConstants; /** * Downloadable Product Links part block * - * @category Magento - * @package Magento_Downloadable - * @author Magento Core Team <core@magentocommerce.com> */ class Links extends \Magento\Catalog\Block\Product\AbstractProduct { /** * @var \Magento\Tax\Model\Calculation */ - protected $_calculationModel; + protected $calculationModel; /** * @var \Magento\Json\EncoderInterface @@ -52,58 +50,34 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct protected $coreData; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + */ + protected $accountService; + + /** + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Tax\Model\Calculation $calculationModel * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Tax\Model\Calculation $calculationModel, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Core\Helper\Data $coreData, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $accountService, array $data = array(), array $priceBlockTypes = array() ) { - $this->_calculationModel = $calculationModel; + $this->calculationModel = $calculationModel; $this->jsonEncoder = $jsonEncoder; $this->coreData = $coreData; + $this->accountService = $accountService; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -157,9 +131,11 @@ class Links extends \Magento\Catalog\Block\Product\AbstractProduct return ''; } - $taxCalculation = $this->_calculationModel; - if (!$taxCalculation->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $taxCalculation->setCustomer($this->_coreRegistry->registry('current_customer')); + if (!$this->calculationModel->getCustomerData()->getId() + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)) { + $customer = $this->accountService + ->getCustomer($this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID)); + $this->calculationModel->setCustomerData($customer); } $taxHelper = $this->_taxData; diff --git a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php index 500a46fb0cb33e74b787b8bb88c3cc851c84b531..1aac56c5aa6e335f12a4e4b9b81daf95b9e7bd57 100644 --- a/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php +++ b/app/code/Magento/Downloadable/Controller/Adminhtml/Downloadable/Product/Edit.php @@ -122,7 +122,7 @@ class Edit extends \Magento\Catalog\Controller\Adminhtml\Product } try { $this->_processDownload($resource, $resourceType); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError(__('Something went wrong while getting the requested content.')); } } diff --git a/app/code/Magento/Downloadable/Controller/Download.php b/app/code/Magento/Downloadable/Controller/Download.php index 816415cb07139adaa99c7880713fc8b5d0a6e937..2cf998fe9fd1a144902036f3c761a2998e139d97 100644 --- a/app/code/Magento/Downloadable/Controller/Download.php +++ b/app/code/Magento/Downloadable/Controller/Download.php @@ -25,7 +25,7 @@ namespace Magento\Downloadable\Controller; use Magento\App\ResponseInterface; use Magento\Downloadable\Helper\Download as DownloadHelper; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\Downloadable\Model\Link\Purchased\Item as PurchasedLink; /** diff --git a/app/code/Magento/Downloadable/Helper/Download.php b/app/code/Magento/Downloadable/Helper/Download.php index 95860aa67ff862e6ddf493123e67107761b36fba..aef39f99912dc130ee6147d8b0b2bb2de1a25e69 100644 --- a/app/code/Magento/Downloadable/Helper/Download.php +++ b/app/code/Magento/Downloadable/Helper/Download.php @@ -24,7 +24,7 @@ namespace Magento\Downloadable\Helper; use Magento\App\Filesystem; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * Downloadable Products Download Helper diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php index f032af149330c8d30f856523c6b6b7d763784280..b1f1a6cdc96a04f20e2ced8423a1ef0cdf1efc8f 100644 --- a/app/code/Magento/Downloadable/Helper/File.php +++ b/app/code/Magento/Downloadable/Helper/File.php @@ -100,7 +100,7 @@ class File extends \Magento\App\Helper\AbstractHelper * @param string $basePath * @param string $file * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function moveFileFromTmp($baseTmpPath, $basePath, $file) { @@ -110,7 +110,7 @@ class File extends \Magento\App\Helper\AbstractHelper try { $fileName = $this->_moveFileFromTmp($baseTmpPath, $basePath, $file[0]['file']); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('Something went wrong while saving the file(s).')); + throw new \Magento\Model\Exception(__('Something went wrong while saving the file(s).')); } } return $fileName; diff --git a/app/code/Magento/Downloadable/Model/Link.php b/app/code/Magento/Downloadable/Model/Link.php index 6028733757310d1bdda0c4f633e9f3d0346e9506..1c7b27236b1554e15745c4ff586abd0d83b9bf29 100644 --- a/app/code/Magento/Downloadable/Model/Link.php +++ b/app/code/Magento/Downloadable/Model/Link.php @@ -55,7 +55,7 @@ use Magento\Downloadable\Model\Resource\Link as Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\AbstractModel +class Link extends \Magento\Model\AbstractModel { const XML_PATH_LINKS_TITLE = 'catalog/downloadable/links_title'; @@ -74,14 +74,14 @@ class Link extends \Magento\Core\Model\AbstractModel /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Link/Purchased.php b/app/code/Magento/Downloadable/Model/Link/Purchased.php index 45e981f4e8b703fd2b196ab44f07de61dd06ab96..09fb4f69e1ad8279bf7b86d2a9cb110884cfd298 100644 --- a/app/code/Magento/Downloadable/Model/Link/Purchased.php +++ b/app/code/Magento/Downloadable/Model/Link/Purchased.php @@ -53,7 +53,7 @@ namespace Magento\Downloadable\Model\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Purchased extends \Magento\Core\Model\AbstractModel +class Purchased extends \Magento\Model\AbstractModel { /** * Enter description here... diff --git a/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php b/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php index e1a989bd505033c83560a3462c6bc26f1469c6cd..ca4d40f9ebd5a05834a1348916ea581abbf0ba55 100644 --- a/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php +++ b/app/code/Magento/Downloadable/Model/Link/Purchased/Item.php @@ -65,7 +65,7 @@ use Magento\Downloadable\Model\Resource\Link\Purchased\Item as Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const XML_PATH_ORDER_ITEM_STATUS = 'catalog/downloadable/order_item_status'; diff --git a/app/code/Magento/Downloadable/Model/Product/Type.php b/app/code/Magento/Downloadable/Model/Product/Type.php index 789ff373c406467d7dd28b754bb064e210db0400..bb8e5216ed5af06644f47f50b21c2d09cc7ca0c2 100644 --- a/app/code/Magento/Downloadable/Model/Product/Type.php +++ b/app/code/Magento/Downloadable/Model/Product/Type.php @@ -389,7 +389,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual * * @param \Magento\Catalog\Model\Product $product * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkProductBuyState($product) { @@ -403,7 +403,7 @@ class Type extends \Magento\Catalog\Model\Product\Type\Virtual $buyRequest->setLinks($allLinksIds); $product->addCustomOption('info_buyRequest', serialize($buyRequest->getData())); } else { - throw new \Magento\Core\Exception(__('Please specify product link(s).')); + throw new \Magento\Model\Exception(__('Please specify product link(s).')); } } } diff --git a/app/code/Magento/Downloadable/Model/Resource/Link.php b/app/code/Magento/Downloadable/Model/Resource/Link.php index 35751abdee032d45a7598fe31e6789f62d1a6c77..c68d1d544b7975715a7467f3cfe9edc109928240 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Link extends \Magento\Core\Model\Resource\Db\AbstractDb +class Link extends \Magento\Model\Resource\Db\AbstractDb { /** * Catalog data @@ -42,9 +42,9 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_catalogData; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\ConfigInterface */ - protected $_app; + protected $_configuration; /** * @var \Magento\Directory\Model\CurrencyFactory @@ -59,19 +59,19 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb /** * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\App $app + * @param \Magento\App\ConfigInterface $configuration * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager */ public function __construct( \Magento\App\Resource $resource, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\App $app, + \Magento\App\ConfigInterface $configuration, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager ) { $this->_catalogData = $catalogData; - $this->_app = $app; + $this->_configuration = $configuration; $this->_currencyFactory = $currencyFactory; $this->_storeManager = $storeManager; parent::__construct($resource); @@ -152,7 +152,10 @@ class Link extends \Magento\Core\Model\Resource\Db\AbstractDb if ($linkObject->getWebsiteId() == 0 && $_isNew && !$this->_catalogData->isPriceGlobal()) { $websiteIds = $linkObject->getProductWebsiteIds(); foreach ($websiteIds as $websiteId) { - $baseCurrency = $this->_app->getBaseCurrencyCode(); + $baseCurrency = $this->_configuration->getValue( + \Magento\Directory\Model\Currency::XML_PATH_CURRENCY_BASE, + 'default' + ); $websiteCurrency = $this->_storeManager->getWebsite($websiteId)->getBaseCurrencyCode(); if ($websiteCurrency == $baseCurrency) { continue; diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php index 6ad42bd161a34574915f6e2c3b4c063d6bd8d9c8..ff2672fd8a03d90fe7efe9115b5f2bc7dd037690 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php index f380e5fc0969bb8db023dd2670038e45e8eda631..6a9d20e9817b6e2d6031eab7ff5963fddf1a5760 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Purchased extends \Magento\Core\Model\Resource\Db\AbstractDb +class Purchased extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento class constructor diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php index a62219e7437f4bb7e9a42797f97f434debefd916..30c91dfbd24a5c70efceb6b5fed69cee3dadd774 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php index a1853f60e01bd08f2ce5df859523defe4f79981f..4827cdb789d5b7d490ac680a1e41dbb89e7a42b4 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento class constructor diff --git a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php index 8ec08268fe5a0b878e65455583d9b89531109e6a..b59ab4e70063a61fa7a7795b6a84ef5f81e924ba 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Link/Purchased/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Link\Purchased\Item; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Resource/Sample.php b/app/code/Magento/Downloadable/Model/Resource/Sample.php index 7e9812663f9db94d3264c1156aa1353a0dfea871..edb3a46050694dc5070444b7f02af6e859f9375e 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Sample.php +++ b/app/code/Magento/Downloadable/Model/Resource/Sample.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Sample extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sample extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection diff --git a/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php b/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php index 1da9fee74990fed56d7d7be8d3a813c1ecb2fcb8..8eec8c13f6cae61c01f056ef65417ed78d6f6f10 100644 --- a/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php +++ b/app/code/Magento/Downloadable/Model/Resource/Sample/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Downloadable\Model\Resource\Sample; * @package Magento_Downloadable * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php index c0559e7b9b5dfa1e7a7b15a818a30084109775a2..1f980c823f1c52cdb7784c05c55e25c023b54636 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/AbstractItems.php @@ -63,7 +63,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -76,7 +76,7 @@ abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\Abstra \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php index 10e2226f5f29806041847f1a1233f349458ddbe8..ac12183be2437d70171507405064a9ded99bce47 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Creditmemo.php @@ -45,7 +45,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Creditmemo extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstr \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php index 248e29b73ff719ab8ad952c5b3f00932146a8155..c8afa1865e3e116e9a7a4456d571cef610b15335 100644 --- a/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php +++ b/app/code/Magento/Downloadable/Model/Sales/Order/Pdf/Items/Invoice.php @@ -45,7 +45,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract * @param \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory * @param \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -59,7 +59,7 @@ class Invoice extends \Magento\Downloadable\Model\Sales\Order\Pdf\Items\Abstract \Magento\Downloadable\Model\Link\PurchasedFactory $purchasedFactory, \Magento\Downloadable\Model\Resource\Link\Purchased\Item\CollectionFactory $itemsFactory, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Downloadable/Model/Sample.php b/app/code/Magento/Downloadable/Model/Sample.php index 334729ccd5d93dfa27a2a0eb185d79438567f5bd..31227c51717423d5d97f47223e859feb24a6a176 100644 --- a/app/code/Magento/Downloadable/Model/Sample.php +++ b/app/code/Magento/Downloadable/Model/Sample.php @@ -43,21 +43,21 @@ namespace Magento\Downloadable\Model; * * @author Magento Core Team <core@magentocommerce.com> */ -class Sample extends \Magento\Core\Model\AbstractModel +class Sample extends \Magento\Model\AbstractModel { const XML_PATH_SAMPLES_TITLE = 'catalog/downloadable/samples_title'; /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Exception.php b/app/code/Magento/Eav/Exception.php index 0d5aeeac203ee0b37401f7063415e1a9a0b171a3..d74503dfa174bd92fa199716640a0eac6010efc8 100644 --- a/app/code/Magento/Eav/Exception.php +++ b/app/code/Magento/Eav/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Eav; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Eav/Helper/Data.php b/app/code/Magento/Eav/Helper/Data.php index a06ccabbf5ce5063aceb7c65aa2544b7896749ff..b0ecc07fb72d62eb11919bc295e1092c7ea1b218 100644 --- a/app/code/Magento/Eav/Helper/Data.php +++ b/app/code/Magento/Eav/Helper/Data.php @@ -158,6 +158,7 @@ class Data extends \Magento\App\Helper\AbstractHelper * 'entity_type_id' => $entityTypeId, * 'attribute_id' => $attributeId, * 'attribute_table' => $attributeTable + * 'backend_type' => $backendType * ]</pre> */ public function getAttributeMetadata($entityTypeCode, $attributeCode) @@ -166,7 +167,8 @@ class Data extends \Magento\App\Helper\AbstractHelper return array( 'entity_type_id' => $attribute->getEntityTypeId(), 'attribute_id' => $attribute->getAttributeId(), - 'attribute_table' => $attribute->getBackend()->getTable() + 'attribute_table' => $attribute->getBackend()->getTable(), + 'backend_type' => $attribute->getBackendType() ); } } diff --git a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php index 3658d046c287073c777d8206b4ce508c17346851..922d02a50d290f9283918fda65a07695974ef442 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/AbstractData.php @@ -26,7 +26,7 @@ namespace Magento\Eav\Model\Attribute\Data; use Magento\App\RequestInterface; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * EAV Attribute Abstract Data Model @@ -47,7 +47,7 @@ abstract class AbstractData /** * Entity instance * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -171,10 +171,10 @@ abstract class AbstractData /** * Set entity instance * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return $this */ - public function setEntity(\Magento\Core\Model\AbstractModel $entity) + public function setEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; return $this; @@ -183,7 +183,7 @@ abstract class AbstractData /** * Returns entity instance * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getEntity() { diff --git a/app/code/Magento/Eav/Model/AttributeDataFactory.php b/app/code/Magento/Eav/Model/AttributeDataFactory.php index 8215b84734a03462ef2ed5908b6aaa240cfcbdd9..c215478c18fc58b6cd8483d8b2b828b3b361ae66 100644 --- a/app/code/Magento/Eav/Model/AttributeDataFactory.php +++ b/app/code/Magento/Eav/Model/AttributeDataFactory.php @@ -80,10 +80,10 @@ class AttributeDataFactory * Set entity to data model (need for work) * * @param \Magento\Eav\Model\Attribute $attribute - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return \Magento\Eav\Model\Attribute\Data\AbstractData */ - public function create(\Magento\Eav\Model\Attribute $attribute, \Magento\Core\Model\AbstractModel $entity) + public function create(\Magento\Eav\Model\Attribute $attribute, \Magento\Model\AbstractModel $entity) { /* @var $dataModel \Magento\Eav\Model\Attribute\Data\AbstractData */ $dataModelClass = $attribute->getDataModel(); diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 5ed2a3bde425bf7cf7545866609626cfcf96070b..03c172d0dd45bc50e6e7502573c7fd11facc4e7b 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -104,9 +104,9 @@ class Config protected $_collectionAttributes = array(); /** - * @var \Magento\Core\Model\App + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * @var \Magento\Eav\Model\Entity\TypeFactory @@ -119,18 +119,18 @@ class Config protected $_universalFactory; /** - * @param \Magento\Core\Model\App $app - * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory + * @param \Magento\App\CacheInterface $cache + * @param Entity\TypeFactory $entityTypeFactory * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Validator\UniversalFactory $universalFactory */ public function __construct( - \Magento\Core\Model\App $app, + \Magento\App\CacheInterface $cache, \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory, \Magento\App\Cache\StateInterface $cacheState, \Magento\Validator\UniversalFactory $universalFactory ) { - $this->_app = $app; + $this->_cache = $cache; $this->_entityTypeFactory = $entityTypeFactory; $this->_cacheState = $cacheState; $this->_universalFactory = $universalFactory; @@ -281,8 +281,7 @@ class Config /** * try load information about entity types from cache */ - if ($this->_isCacheEnabled() && ($cache = $this->_app->loadCache(self::ENTITIES_CACHE_ID))) { - + if ($this->_isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) { $this->_entityData = unserialize($cache); foreach ($this->_entityData as $typeCode => $data) { $typeId = $data['entity_type_id']; @@ -313,10 +312,13 @@ class Config $this->_entityData = $types; if ($this->_isCacheEnabled()) { - $this->_app->saveCache( + $this->_cache->save( serialize($this->_entityData), self::ENTITIES_CACHE_ID, - array(\Magento\Eav\Model\Cache\Type::CACHE_TAG, \Magento\Eav\Model\Entity\Attribute::CACHE_TAG) + array( + \Magento\Eav\Model\Cache\Type::CACHE_TAG, + \Magento\Eav\Model\Entity\Attribute::CACHE_TAG + ) ); } \Magento\Profiler::stop('EAV: ' . __METHOD__); @@ -328,7 +330,7 @@ class Config * * @param int|string $code * @return Type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntityType($code) { @@ -363,7 +365,7 @@ class Config } if (!$entityType->getId()) { - throw new \Magento\Core\Exception(__('Invalid entity_type specified: %1', $code)); + throw new \Magento\Model\Exception(__('Invalid entity_type specified: %1', $code)); } } $this->_addEntityTypeReference($entityType->getId(), $entityType->getEntityTypeCode()); diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index 38d97534e56966d5a7029858347b4c3d01742ec1..e4b613ece117f054f1382680e025ff9845ab2194 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -27,9 +27,9 @@ namespace Magento\Eav\Model\Entity; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\Eav\Model\Entity\Type; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Core\Model\Config\Element; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend; use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; @@ -41,7 +41,7 @@ use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractEntity extends \Magento\Core\Model\Resource\AbstractResource implements EntityInterface +abstract class AbstractEntity extends \Magento\Model\Resource\AbstractResource implements EntityInterface { /** * Read connection diff --git a/app/code/Magento/Eav/Model/Entity/Attribute.php b/app/code/Magento/Eav/Model/Entity/Attribute.php index 5421b2ba08c7dd43a20b65fb5af751dd16bb774f..0e09cdf90e3852b713a998c70ef33583a1bf9350 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute.php @@ -91,7 +91,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Catalog\Model\ProductFactory $catalogProductFactory * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -107,7 +107,7 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute\AbstractAttribute im \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\ProductFactory $catalogProductFactory, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php index ae235f70717674c8b24e097e0a19589c6d499865..90f966215b61a24c17f8cd0f77e2ca0e1161c649 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/AbstractAttribute.php @@ -32,8 +32,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel implements - \Magento\Eav\Model\Entity\Attribute\AttributeInterface +abstract class AbstractAttribute extends \Magento\Model\AbstractModel implements AttributeInterface { const TYPE_STATIC = 'static'; @@ -127,7 +126,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -140,7 +139,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -439,7 +438,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * Retrieve backend instance * * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getBackend() { @@ -478,7 +477,7 @@ abstract class AbstractAttribute extends \Magento\Core\Model\AbstractModel imple * Retrieve source instance * * @return \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php index b3f4c159d507a12a96e5c3521c3eafb116f985b8..af9844b2ba5488e95224472309a543a9c41a99ab 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Group.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Group.php @@ -45,7 +45,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @method string getTabGroupCode() * @method \Magento\Eav\Model\Entity\Attribute\Group setTabGroupCode(string $value) */ -class Group extends \Magento\Core\Model\AbstractModel +class Group extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php index 4c08812c31cad4867503c0e91b1d98d8f071ef38..5379372d8a14ac9d3cbea340a67e57a669bfa439 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Option.php @@ -39,7 +39,7 @@ namespace Magento\Eav\Model\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php index 706e12377333640d132294ad91d3496e3d5aac1a..d848a31aa181d70623886c8992d1d5320bce7da0 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Set.php @@ -44,7 +44,7 @@ namespace Magento\Eav\Model\Entity\Attribute; use Magento\Eav\Model\Entity\Type; -class Set extends \Magento\Core\Model\AbstractModel +class Set extends \Magento\Model\AbstractModel { /** * Resource instance @@ -86,7 +86,7 @@ class Set extends \Magento\Core\Model\AbstractModel * @param \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory * @param \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory * @param \Magento\Eav\Model\Resource\Entity\Attribute $resourceAttribute - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -97,7 +97,7 @@ class Set extends \Magento\Core\Model\AbstractModel \Magento\Eav\Model\Entity\Attribute\GroupFactory $attrGroupFactory, \Magento\Eav\Model\Entity\AttributeFactory $attributeFactory, \Magento\Eav\Model\Resource\Entity\Attribute $resourceAttribute, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -340,7 +340,7 @@ class Set extends \Magento\Core\Model\AbstractModel /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 4f641f2f8bec599645308852abd047721f061a53..478ca1212df3f7bd5b982e2e17fee300f40630bd 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -270,7 +270,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { @@ -336,7 +336,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db * @param null|string|array $condition * @param string $joinType * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see self::_getConditionSql for $condition */ @@ -369,7 +369,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db if (!empty($conditionSql)) { $this->getSelect()->where($conditionSql, null, \Magento\DB\Select::TYPE_CONDITION); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Invalid attribute identifier for filter (%1)', get_class($attribute)) ); } diff --git a/app/code/Magento/Eav/Model/Entity/Setup.php b/app/code/Magento/Eav/Model/Entity/Setup.php index f4f08ec51c7ac76756f3211c8a93ecb3184d9c4c..7e9f01044561c9602371339e69685bdc2d0e7bf2 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup.php +++ b/app/code/Magento/Eav/Model/Entity/Setup.php @@ -796,7 +796,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup * * @param array $option * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addAttributeOption($option) { @@ -830,7 +830,7 @@ class Setup extends \Magento\Core\Model\Resource\Setup // Default value if (!isset($values[0])) { - throw new \Magento\Core\Exception(__('Default option value is not defined')); + throw new \Magento\Model\Exception(__('Default option value is not defined')); } $condition = array('option_id =?' => $intOptionId); $this->_connection->delete($optionValueTable, $condition); diff --git a/app/code/Magento/Eav/Model/Entity/Store.php b/app/code/Magento/Eav/Model/Entity/Store.php index e45bc6b4e98281c7d688f7890c85f6db641cb920..6dd21ec323cc1e1cede38706c35de9eac6bf25fd 100644 --- a/app/code/Magento/Eav/Model/Entity/Store.php +++ b/app/code/Magento/Eav/Model/Entity/Store.php @@ -41,7 +41,7 @@ namespace Magento\Eav\Model\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\AbstractModel +class Store extends \Magento\Model\AbstractModel { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php index 08e71bc4bd5ecf9fb9287202f10d04933ca85b4e..5551ebd7202e87bcb2ac5d9ecfdbdc80d1c800df 100644 --- a/app/code/Magento/Eav/Model/Entity/Type.php +++ b/app/code/Magento/Eav/Model/Entity/Type.php @@ -58,7 +58,7 @@ namespace Magento\Eav\Model\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Collection of attributes @@ -108,7 +108,7 @@ class Type extends \Magento\Core\Model\AbstractModel * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory * @param \Magento\Eav\Model\Entity\StoreFactory $storeFactory * @param \Magento\Validator\UniversalFactory $universalFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -119,7 +119,7 @@ class Type extends \Magento\Core\Model\AbstractModel \Magento\Eav\Model\Entity\Attribute\SetFactory $attSetFactory, \Magento\Eav\Model\Entity\StoreFactory $storeFactory, \Magento\Validator\UniversalFactory $universalFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -388,7 +388,7 @@ class Type extends \Magento\Core\Model\AbstractModel /** * Retrieve resource entity object * - * @return \Magento\Core\Model\Resource\AbstractResource + * @return \Magento\Model\Resource\AbstractResource */ public function getEntity() { diff --git a/app/code/Magento/Eav/Model/Form.php b/app/code/Magento/Eav/Model/Form.php index fb2913fdffbcd5196d6ac28c6dfc26f13cab5941..2ca49c90555db76ca03bf5af8fbbeb2bab434394 100644 --- a/app/code/Magento/Eav/Model/Form.php +++ b/app/code/Magento/Eav/Model/Form.php @@ -67,7 +67,7 @@ abstract class Form /** * Current entity instance * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -169,7 +169,7 @@ abstract class Form * @param RequestInterface $httpRequest * @param \Magento\Validator\ConfigFactory $validatorConfigFactory * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -181,10 +181,10 @@ abstract class Form \Magento\Validator\ConfigFactory $validatorConfigFactory ) { if (empty($this->_moduleName)) { - throw new \Magento\Core\Exception(__('Current module pathname is undefined')); + throw new \Magento\Model\Exception(__('Current module pathname is undefined')); } if (empty($this->_entityTypeCode)) { - throw new \Magento\Core\Exception(__('Current module EAV entity is undefined')); + throw new \Magento\Model\Exception(__('Current module EAV entity is undefined')); } $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; @@ -238,10 +238,10 @@ abstract class Form /** * Set entity instance * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return $this */ - public function setEntity(\Magento\Core\Model\AbstractModel $entity) + public function setEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; if ($entity->getEntityTypeId()) { @@ -290,13 +290,13 @@ abstract class Form /** * Return current form code * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getFormCode() { if (empty($this->_formCode)) { - throw new \Magento\Core\Exception(__('Form code is not defined')); + throw new \Magento\Model\Exception(__('Form code is not defined')); } return $this->_formCode; } @@ -318,13 +318,13 @@ abstract class Form /** * Return current entity instance * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ public function getEntity() { if (is_null($this->_entity)) { - throw new \Magento\Core\Exception(__('Entity instance is not defined')); + throw new \Magento\Model\Exception(__('Entity instance is not defined')); } return $this->_entity; } diff --git a/app/code/Magento/Eav/Model/Form/Element.php b/app/code/Magento/Eav/Model/Form/Element.php index ea60b5c88d6ea9f32a33ad1ef9c22eaa0cac91cb..cf86631afa1c685d50b900eb6ff4f3d5f5b1149d 100644 --- a/app/code/Magento/Eav/Model/Form/Element.php +++ b/app/code/Magento/Eav/Model/Form/Element.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Form; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Eav Form Element Model @@ -44,7 +44,7 @@ use Magento\Core\Exception; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Element extends \Magento\Core\Model\AbstractModel +class Element extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -62,7 +62,7 @@ class Element extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Config $eavConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Element extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Eav\Model\Config $eavConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Form/Fieldset.php b/app/code/Magento/Eav/Model/Form/Fieldset.php index c2577394a6dee9b714e188e046b2b700cd7afe08..61175e140c31d75352dd5fc44ba3c02988ac5824 100644 --- a/app/code/Magento/Eav/Model/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Form/Fieldset.php @@ -40,7 +40,7 @@ namespace Magento\Eav\Model\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Fieldset extends \Magento\Core\Model\AbstractModel +class Fieldset extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -58,7 +58,7 @@ class Fieldset extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -66,7 +66,7 @@ class Fieldset extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -107,13 +107,13 @@ class Fieldset extends \Magento\Core\Model\AbstractModel /** * Validate data before save data * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeSave() { if (!$this->getTypeId()) { - throw new \Magento\Core\Exception(__('Invalid form type.')); + throw new \Magento\Model\Exception(__('Invalid form type.')); } if (!$this->getStoreId() && $this->getLabel()) { $this->setStoreLabel($this->getStoreId(), $this->getLabel()); diff --git a/app/code/Magento/Eav/Model/Form/Type.php b/app/code/Magento/Eav/Model/Form/Type.php index 17e7efd5f998f020d7b45f856f4b57154ac125db..a4837028e398ad6afbae755a45bdf6d3e8746b22 100644 --- a/app/code/Magento/Eav/Model/Form/Type.php +++ b/app/code/Magento/Eav/Model/Form/Type.php @@ -44,7 +44,7 @@ namespace Magento\Eav\Model\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Prefix of model events names @@ -68,7 +68,7 @@ class Type extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory * @param \Magento\Eav\Model\Form\ElementFactory $elementFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -77,7 +77,7 @@ class Type extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Eav\Model\Form\FieldsetFactory $fieldsetFactory, \Magento\Eav\Model\Form\ElementFactory $elementFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Eav/Model/Resource/Attribute.php b/app/code/Magento/Eav/Model/Resource/Attribute.php index 2ae9f4ce9680e239ad1825af156ae313274a3e53..179fc3efc56bd3c30992bd62fd23204bb804d622 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute.php @@ -34,7 +34,7 @@ */ namespace Magento\Eav\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\DB\Select; abstract class Attribute extends \Magento\Eav\Model\Resource\Entity\Attribute diff --git a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php index ff1b6529974766408ea0f2135c5c0475c510cd61..a0c60e77ab56929ce54ade0e7cbfc9b07d695e6c 100644 --- a/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Attribute/Collection.php @@ -73,7 +73,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -83,7 +83,7 @@ abstract class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\C \Magento\Eav\Model\Config $eavConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; diff --git a/app/code/Magento/Eav/Model/Resource/Config.php b/app/code/Magento/Eav/Model/Resource/Config.php index 28f4d09b52a01fcd0205e1da3f639689d6a1e5b5..d4b5fcb27869c78084355d6cc255412860bfe748 100644 --- a/app/code/Magento/Eav/Model/Resource/Config.php +++ b/app/code/Magento/Eav/Model/Resource/Config.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Config extends \Magento\Core\Model\Resource\Db\AbstractDb +class Config extends \Magento\Model\Resource\Db\AbstractDb { /** * Array of entity types diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php index 35eb396c874ec5a4e6a01bbf07e61b1df5f60315..d78e459d12df8a06882edaf01bf2a227ea0b04ba 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Entity\Attribute as EntityAttribute; use Magento\Eav\Model\Entity\Attribute\AbstractAttribute; use Magento\DB\Select; @@ -37,7 +37,7 @@ use Magento\DB\Select; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Eav Entity attributes cache @@ -46,13 +46,6 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected static $_entityAttributes = array(); - /** - * Application instance - * - * @var \Magento\Core\Model\App - */ - protected $_application; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -201,14 +194,14 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param EntityAttribute|AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave(AbstractModel $object) { $frontendLabel = $object->getFrontendLabel(); if (is_array($frontendLabel)) { if (!isset($frontendLabel[0]) || is_null($frontendLabel[0]) || $frontendLabel[0] == '') { - throw new \Magento\Core\Exception(__('Frontend label is not defined')); + throw new \Magento\Model\Exception(__('Frontend label is not defined')); } $object->setFrontendLabel($frontendLabel[0])->setStoreLabels($frontendLabel); } @@ -389,12 +382,12 @@ class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param array $values * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _checkDefaultOptionValue($values) { if (!isset($values[0])) { - throw new \Magento\Core\Exception(__('Default option value is not defined')); + throw new \Magento\Model\Exception(__('Default option value is not defined')); } } diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php index 5ff036c4ae6d6452e185326e758f276573fb4346..a93fc9ecad916e775563ff90d2ef3a20f970dc1d 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Collection.php @@ -34,7 +34,7 @@ use Magento\Eav\Model\Entity\Type; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Add attribute set info flag @@ -379,7 +379,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * Ad information about attribute sets to collection result data * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _afterLoadData() { diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php index 76fd59d47a9dab6f8a777dbb9ab50d8adc1b474c..5821638bcf129eaf0bb2fc8e8a182c1661c105d0 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Grid/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity\Attribute\Grid; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; /** * Eav Resource Attribute Set Collection @@ -48,7 +48,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Set\Collec * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Registry $registryManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Set\Collec \Magento\Event\ManagerInterface $eventManager, \Magento\Registry $registryManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_registryManager = $registryManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php index 8fcdc767d8d6da23a40b8777b773e6708a24d1cb..8533ed7ed95fc8870b51efa7ab58c925311a0817 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Group extends \Magento\Core\Model\Resource\Db\AbstractDb +class Group extends \Magento\Model\Resource\Db\AbstractDb { /** * Constants for attribute group codes @@ -78,10 +78,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (!$object->getSortOrder()) { $object->setSortOrder($this->_getMaxSortOrder($object) + 1); @@ -92,10 +92,10 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getAttributes()) { foreach ($object->getAttributes() as $attribute) { @@ -110,7 +110,7 @@ class Group extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Retrieve max sort order * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return int */ protected function _getMaxSortOrder($object) diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php index 259dcb412f4cdd589d7f4e7cdb3b28819b1972bb..1eeeb3050d41d5445478628f84a162205280ffaa 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Group/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Group; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource model for collection diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php index d9716b5603214cefa5b01e08a3676e1cc23ea385..22777268d1b28ef7328c2901c369fcae1c6f31a5 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php index 5f1b719a759055469a7c900890204538e4ae9768..415d49834bf525121f3038b49b83e2c94dcc8643 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Option; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Option value table @@ -59,7 +59,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\App\Resource $coreResource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\App\Resource $coreResource, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_coreResource = $coreResource; diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php index f9033d9b997f4c6f24ad0fddbf0379601b6b2c23..f7c9d7608a6c75bf6410a1c32ad95aaccc6dfad8 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Set extends \Magento\Core\Model\Resource\Db\AbstractDb +class Set extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Eav\Model\Resource\Entity\Attribute\GroupFactory @@ -64,10 +64,10 @@ class Set extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->getGroups()) { /* @var $group \Magento\Eav\Model\Entity\Attribute\Group */ diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php index 8a47097f54aeb65f0d1663dd0f8634cf3c5aad7b..28156238fb60ef9f2326855076ee15f19071a5f1 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Attribute/Set/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Attribute\Set; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Store.php b/app/code/Magento/Eav/Model/Resource/Entity/Store.php index 614b9aff8d9de64808f2df45d856edd6d56d94fe..02ed7d1ebff189e896fa9fa8f648be1873ae063a 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Store.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Store.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Entity; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Object; /** @@ -35,7 +35,7 @@ use Magento\Object; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Store extends \Magento\Core\Model\Resource\Db\AbstractDb +class Store extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Type.php b/app/code/Magento/Eav/Model/Resource/Entity/Type.php index 8c2ecec698aac22ba058c74500da9b70c4938be7..543023a4ac43d9be0523e27371ed23996d5f4fdd 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Type.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Type.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization @@ -47,7 +47,7 @@ class Type extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Load Entity Type by Code * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $code * @return $this */ diff --git a/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php b/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php index 5aa5a39dad093f95abc75b9522c221ca924303af..90251c8172787cdf44a3fa4705ad489b06317079 100644 --- a/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Entity/Type/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Entity\Type; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute.php index 86040f1807343bab64bd350e106c0022a02bcf0e..bef72498c9aa8b0565e1bda0c9a7aacdbba9ac97 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute.php @@ -34,7 +34,7 @@ */ namespace Magento\Eav\Model\Resource\Form; -abstract class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * Return form attribute IDs by form code diff --git a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php index 22d4b7660df4180e5d03e8da790c6d63530a7247..c877b8cdea0f277f08fe3811460d2778a38da45b 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Attribute/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form\Attribute; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Current module pathname @@ -80,7 +80,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -90,7 +90,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Eav\Model\Config $eavConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_eavConfig = $eavConfig; @@ -101,15 +101,15 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Resource initialization * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _construct() { if (empty($this->_moduleName)) { - throw new \Magento\Core\Exception(__('Current module pathname is undefined')); + throw new \Magento\Model\Exception(__('Current module pathname is undefined')); } if (empty($this->_entityTypeCode)) { - throw new \Magento\Core\Exception(__('Current module EAV entity is undefined')); + throw new \Magento\Model\Exception(__('Current module EAV entity is undefined')); } } diff --git a/app/code/Magento/Eav/Model/Resource/Form/Element.php b/app/code/Magento/Eav/Model/Resource/Form/Element.php index 2a60ee19e92a8058e56b95a504806a78497f1e69..5eeac8a51a7488f62171b51e307e194cd43ee002 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Element.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Element.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Element extends \Magento\Core\Model\Resource\Db\AbstractDb +class Element extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php index 139b94794ac8813bdeb4a61bf125333e1e0a411a..18d39e56eec2c345710ee481d16f70c310433eac 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Element/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource\Form\Element; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php index fe63e9e71d190d6b5ac2cc88ef15b6c18281375e..51b78898af2f79cc1bfbb2eb947487b2842e5353 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset.php @@ -25,7 +25,7 @@ */ namespace Magento\Eav\Model\Resource\Form; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Eav\Model\Form\Fieldset as FormFieldset; use Magento\DB\Select; @@ -36,7 +36,7 @@ use Magento\DB\Select; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Fieldset extends \Magento\Core\Model\Resource\Db\AbstractDb +class Fieldset extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php index a9944840ea711805d47733c7f69375d3501c7d12..192e3ebd30f89139be5dd3fa4e8830e5aef78f55 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Fieldset/Collection.php @@ -36,7 +36,7 @@ namespace Magento\Eav\Model\Resource\Form\Fieldset; use Magento\Eav\Model\Form\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store scope ID @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -66,7 +66,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Eav/Model/Resource/Form/Type.php b/app/code/Magento/Eav/Model/Resource/Form/Type.php index 9bf216d771451cf6e4366a0d04b40e38607bfb26..c7003f41c1a1b4acc39b2821663150b7ecd9ab2b 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Type.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Type.php @@ -26,7 +26,7 @@ namespace Magento\Eav\Model\Resource\Form; use Magento\Eav\Model\Form\Type as FormType; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Eav Form Type Resource Model @@ -35,7 +35,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table @@ -93,7 +93,7 @@ class Type extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save entity types after save form type * - * @see \Magento\Core\Model\Resource\Db\AbstractDb#_afterSave($object) + * @see \Magento\Model\Resource\Db\AbstractDb#_afterSave($object) * * @param FormType|AbstractModel $object * @return $this diff --git a/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php b/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php index 7190125885cc88d036922b4b0e9fd733d09a916e..024d5c18f7c41cb151f47704c76980c41da8291a 100644 --- a/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php +++ b/app/code/Magento/Eav/Model/Resource/Form/Type/Collection.php @@ -36,7 +36,7 @@ namespace Magento\Eav\Model\Resource\Form\Type; use Magento\Eav\Model\Entity\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Eav/Model/Resource/Helper.php b/app/code/Magento/Eav/Model/Resource/Helper.php index c78e87d1a962b99557f25e02a6e3928638892ac4..602fd034db695bd086985426c18590df545757a5 100644 --- a/app/code/Magento/Eav/Model/Resource/Helper.php +++ b/app/code/Magento/Eav/Model/Resource/Helper.php @@ -32,7 +32,7 @@ namespace Magento\Eav\Model\Resource; * @package Magento_Eav * @author Magento Core Team <core@magentocommerce.com> */ -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Construct diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php b/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php index 6af08c2c72107b8aab25e76cf4bc0d68c757e5a7..c0df967660720185668fca01a500d4e82642f787 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Backend.php @@ -37,15 +37,15 @@ class Backend extends \Magento\Validator\AbstractValidator /** * Returns true if and only if $value meets the validation requirements. * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return bool * @throws \InvalidArgumentException */ public function isValid($entity) { $this->_messages = array(); - if (!$entity instanceof \Magento\Core\Model\AbstractModel) { - throw new \InvalidArgumentException('Model must be extended from \Magento\Core\Model\AbstractModel'); + if (!$entity instanceof \Magento\Model\AbstractModel) { + throw new \InvalidArgumentException('Model must be extended from \Magento\Model\AbstractModel'); } /** @var \Magento\Eav\Model\Entity\AbstractEntity $resource */ $resource = $entity->getResource(); @@ -72,7 +72,7 @@ class Backend extends \Magento\Validator\AbstractValidator } elseif (is_string($result)) { $this->_messages[$attribute->getAttributeCode()][] = $result; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_messages[$attribute->getAttributeCode()][] = $e->getMessage(); } } diff --git a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php index ab6efff5c83ed3415564e968f22c0d4f1ab59568..cba4be41f43b873dac9ec89f507ac552ae319411 100644 --- a/app/code/Magento/Eav/Model/Validator/Attribute/Data.php +++ b/app/code/Magento/Eav/Model/Validator/Attribute/Data.php @@ -125,7 +125,7 @@ class Data extends \Magento\Validator\AbstractValidator /** * Validate EAV model attributes with data models * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return bool */ public function isValid($entity) @@ -174,10 +174,9 @@ class Data extends \Magento\Validator\AbstractValidator if ($this->_attributes) { $attributes = $this->_attributes; - } elseif ($entity instanceof \Magento\Core\Model\AbstractModel && + } elseif ($entity instanceof \Magento\Model\AbstractModel && $entity->getResource() instanceof \Magento\Eav\Model\Entity\AbstractEntity - ) { - // $entity is EAV-model + ) { // $entity is EAV-model $attributes = $entity->getEntityType()->getAttributeCollection()->getItems(); } diff --git a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php index 0ecef8a001aae9a97cb747b75146dea53dbe900d..77d4bb165cfd68d9243ef635a4e1c2f4b7bfacff 100644 --- a/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php +++ b/app/code/Magento/Email/Controller/Adminhtml/Email/Template.php @@ -198,7 +198,7 @@ class Template extends \Magento\Backend\App\Action // go to grid $this->_redirect('adminhtml/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError( diff --git a/app/code/Magento/Email/Model/Resource/Template.php b/app/code/Magento/Email/Model/Resource/Template.php index fc58c04f8ca00d670521f4d34668408a01a0fb95..f555bf9db92b8693cfa12eb9c7a05873b19845b7 100644 --- a/app/code/Magento/Email/Model/Resource/Template.php +++ b/app/code/Magento/Email/Model/Resource/Template.php @@ -25,7 +25,7 @@ */ namespace Magento\Email\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Template db resource @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Email * @author Magento Core Team <core@magentocommerce.com> */ -class Template extends \Magento\Core\Model\Resource\Db\AbstractDb +class Template extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Email/Model/Resource/Template/Collection.php b/app/code/Magento/Email/Model/Resource/Template/Collection.php index a8b5d5aad0a50285851b1e8a72d598f42f645b86..238e077f0335c9f92b2dc2f49c18cb88e74cfc82 100644 --- a/app/code/Magento/Email/Model/Resource/Template/Collection.php +++ b/app/code/Magento/Email/Model/Resource/Template/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Email\Model\Resource\Template; * @package Magento_Email * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Template table name diff --git a/app/code/Magento/Email/Model/Template.php b/app/code/Magento/Email/Model/Template.php index f2ed3964882e6b2215e737eceea29efe3f1ef7ad..b5ea656352fa5230a2129584719f1cc6af60673e 100644 --- a/app/code/Magento/Email/Model/Template.php +++ b/app/code/Magento/Email/Model/Template.php @@ -25,7 +25,7 @@ */ namespace Magento\Email\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Email\Model\Template\Filter; use Magento\Filter\Template as FilterTemplate; diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index f106b8ae7e4caf2c9122857138f62d657d99287b..f5c3c1dd47506c305e3afebc719c54c9955aa1f7 100644 --- a/app/code/Magento/GiftMessage/Model/Message.php +++ b/app/code/Magento/GiftMessage/Model/Message.php @@ -43,7 +43,7 @@ namespace Magento\GiftMessage\Model; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Message extends \Magento\Core\Model\AbstractModel +class Message extends \Magento\Model\AbstractModel { /** * @var \Magento\GiftMessage\Model\TypeFactory diff --git a/app/code/Magento/GiftMessage/Model/Resource/Message.php b/app/code/Magento/GiftMessage/Model/Resource/Message.php index dabebf2623b6bac54612daf55f5f0fe65d9d30e6..7d792ebb4c644244904357728c44be62ce11159d 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Message.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Message.php @@ -32,7 +32,7 @@ namespace Magento\GiftMessage\Model\Resource; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Message extends \Magento\Core\Model\Resource\Db\AbstractDb +class Message extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php b/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php index ae476f41227da39978916d0f441172126d8a1fbe..e92f31e304f6d4efb62ada45b2c126eeae450e78 100644 --- a/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php +++ b/app/code/Magento/GiftMessage/Model/Resource/Message/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GiftMessage\Model\Resource\Message; * @package Magento_GiftMessage * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/GiftMessage/Model/TypeFactory.php b/app/code/Magento/GiftMessage/Model/TypeFactory.php index 3dd95710ca5ec53d63da894499b2f696f232286e..8ef8d20bf8b2581cc52e931f395c5adb69275c89 100644 --- a/app/code/Magento/GiftMessage/Model/TypeFactory.php +++ b/app/code/Magento/GiftMessage/Model/TypeFactory.php @@ -65,13 +65,13 @@ class TypeFactory * * @param string $eavType * @return mixed - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createType($eavType) { $types = $this->_allowedEntityTypes; if (!isset($types[$eavType])) { - throw new \Magento\Core\Exception(__('Unknown entity type')); + throw new \Magento\Model\Exception(__('Unknown entity type')); } return $this->_objectManager->create($types[$eavType]); } diff --git a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php index b49e659952780602a87b9bd8bdc84a3b2922c1cc..6d4c08c95fe833316e7feaeb2f78336ad7e7dc9d 100644 --- a/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php +++ b/app/code/Magento/GoogleAdwords/Model/Config/Backend/AbstractConversion.php @@ -47,7 +47,7 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value * @param \Magento\App\ConfigInterface $config * @param \Magento\Validator\ObjectFactory $validatorCompositeFactory * @param \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -58,7 +58,7 @@ abstract class AbstractConversion extends \Magento\Core\Model\Config\Value \Magento\App\ConfigInterface $config, \Magento\Validator\ObjectFactory $validatorCompositeFactory, \Magento\GoogleAdwords\Model\Validator\Factory $validatorFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/GoogleOptimizer/Helper/Code.php b/app/code/Magento/GoogleOptimizer/Helper/Code.php index bdc1b5e8ade781d44f2502572020fe7b8ce4fb3a..96a311a268734dae834c8386f0ad2022fab42f41 100644 --- a/app/code/Magento/GoogleOptimizer/Helper/Code.php +++ b/app/code/Magento/GoogleOptimizer/Helper/Code.php @@ -33,7 +33,7 @@ class Code protected $_codeModel; /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_entity; @@ -48,10 +48,10 @@ class Code /** * Get loaded Code object by Entity * - * @param \Magento\Core\Model\AbstractModel $entity + * @param \Magento\Model\AbstractModel $entity * @return \Magento\GoogleOptimizer\Model\Code */ - public function getCodeObjectByEntity(\Magento\Core\Model\AbstractModel $entity) + public function getCodeObjectByEntity(\Magento\Model\AbstractModel $entity) { $this->_entity = $entity; diff --git a/app/code/Magento/GoogleOptimizer/Model/Code.php b/app/code/Magento/GoogleOptimizer/Model/Code.php index 4ce03f74624b5a5f819ee31807846eec1200cbf1..6da6a135d29b0b54b1720e62700598db7a341ec2 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Code.php +++ b/app/code/Magento/GoogleOptimizer/Model/Code.php @@ -35,7 +35,7 @@ namespace Magento\GoogleOptimizer\Model; * @method \Magento\GoogleOptimizer\Model\Code setExperimentScript(int $value) * @method string getExperimentScript() */ -class Code extends \Magento\Core\Model\AbstractModel +class Code extends \Magento\Model\AbstractModel { /**#@+ * Entity types diff --git a/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php b/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php index fa49252f88ddef81b1687f933fc41ca33a6ea2a6..ccac9852e1023471a57647ba5bda2185e1f95852 100644 --- a/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php +++ b/app/code/Magento/GoogleOptimizer/Model/Resource/Code.php @@ -25,7 +25,7 @@ */ namespace Magento\GoogleOptimizer\Model\Resource; -class Code extends \Magento\Core\Model\Resource\Db\AbstractDb +class Code extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php index 52417f9252b8d9dc7ca80aa5c384d8b382ab2f57..44dd4de0209e8b9bd42b0675e4f98cba25ea3976 100644 --- a/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php +++ b/app/code/Magento/GoogleShopping/Controller/Adminhtml/Googleshopping/Items.php @@ -396,7 +396,7 @@ class Items extends \Magento\Backend\App\Action * Get store object, basing on request * * @return \Magento\Core\Model\Store - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function _getStore() { @@ -406,7 +406,7 @@ class Items extends \Magento\Backend\App\Action (int)$this->getRequest()->getParam('store', 0) ); if (!$store || 0 == $store->getId()) { - throw new \Magento\Core\Exception(__('Unable to select a Store View')); + throw new \Magento\Model\Exception(__('Unable to select a Store View')); } return $store; } diff --git a/app/code/Magento/GoogleShopping/Model/Attribute.php b/app/code/Magento/GoogleShopping/Model/Attribute.php index 122ffae96ddc637f7c8215b20834b444eb95fb19..4cfbf952a262334eb1312a352ae7c88a6cc981ed 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Attribute extends \Magento\Core\Model\AbstractModel +class Attribute extends \Magento\Model\AbstractModel { /** * Default ignored attribute codes diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php b/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php index 7440c490440bd30fac1ea0b9d6b833114b5b20ef..1668b45c271d702928125acd7a351d47bd268c18 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/DefaultAttribute.php @@ -131,7 +131,7 @@ class DefaultAttribute extends \Magento\GoogleShopping\Model\Attribute protected function _setAttribute($entry, $name, $type = self::ATTRIBUTE_TYPE_TEXT, $value = '', $unit = null) { if (is_object($value) || (string)$value != $value) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please correct the attribute "%1" type for Google Shopping. The product with this attribute hasn\'t been updated in Google Content.', $name diff --git a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php index 1f18aefa16661482bfacf01ba89828b3e98fcb66..61b1657f2fb3f44059fb6db2c7cd774670b13583 100644 --- a/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php +++ b/app/code/Magento/GoogleShopping/Model/Attribute/Tax.php @@ -116,7 +116,7 @@ class Tax extends \Magento\GoogleShopping\Model\Attribute\DefaultAttribute $regions = $this->_parseRegions($rate['state'], $rate['postcode']); $ratesTotal += count($regions); if ($ratesTotal > self::RATES_MAX) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __("Google shopping only supports %1 tax rates per product", self::RATES_MAX) ); } diff --git a/app/code/Magento/GoogleShopping/Model/Flag.php b/app/code/Magento/GoogleShopping/Model/Flag.php index 6fd3f467ef92145f4a29661029cee72a21509ab8..bf04d912d714ada38f220379895b049de831ab33 100644 --- a/app/code/Magento/GoogleShopping/Model/Flag.php +++ b/app/code/Magento/GoogleShopping/Model/Flag.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { /** * Flag time to live in seconds diff --git a/app/code/Magento/GoogleShopping/Model/Item.php b/app/code/Magento/GoogleShopping/Model/Item.php index 9e84bf4fd3411a09a371357ce0bcea68d3e7524d..592d56705b72711978111919bff1dd85f65baaaf 100644 --- a/app/code/Magento/GoogleShopping/Model/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Item.php @@ -34,7 +34,7 @@ use Magento\Catalog\Model\Product as CatalogModelProduct; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * Registry keys for caching attributes and types @@ -213,7 +213,7 @@ class Item extends \Magento\Core\Model\AbstractModel $attributeSetId = $this->getProduct()->getAttributeSetId(); $targetCountry = $this->getTargetCountry(); - $registry = $this->_coreRegistry->registry(self::TYPES_REGISTRY_KEY); + $registry = $this->_registry->registry(self::TYPES_REGISTRY_KEY); if (is_array($registry) && isset($registry[$attributeSetId][$targetCountry])) { return $registry[$attributeSetId][$targetCountry]; } @@ -221,8 +221,8 @@ class Item extends \Magento\Core\Model\AbstractModel $type = $this->_typeFactory->create()->loadByAttributeSetId($attributeSetId, $targetCountry); $registry[$attributeSetId][$targetCountry] = $type; - $this->_coreRegistry->unregister(self::TYPES_REGISTRY_KEY); - $this->_coreRegistry->register(self::TYPES_REGISTRY_KEY, $registry); + $this->_registry->unregister(self::TYPES_REGISTRY_KEY); + $this->_registry->register(self::TYPES_REGISTRY_KEY, $registry); return $type; } diff --git a/app/code/Magento/GoogleShopping/Model/MassOperations.php b/app/code/Magento/GoogleShopping/Model/MassOperations.php index ba530fe7364352da08b5bb3a94e9307064099288..e51919f471b2802cc4fe7f940c31a5f291fea707 100644 --- a/app/code/Magento/GoogleShopping/Model/MassOperations.php +++ b/app/code/Magento/GoogleShopping/Model/MassOperations.php @@ -25,7 +25,7 @@ */ namespace Magento\GoogleShopping\Model; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\GoogleShopping\Model\Resource\Item\Collection as ItemCollection; /** diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php b/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php index 777744e3f13a36d378dcae771094285045c7e3f5..08332663a55cd31b4189a6818876f61e59ce9377 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Attribute.php @@ -33,7 +33,7 @@ */ namespace Magento\GoogleShopping\Model\Resource; -class Attribute extends \Magento\Core\Model\Resource\Db\AbstractDb +class Attribute extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php index 3f31195f4c6a6170504299f3b0f478473ec7e050..d1b59f391d21f3b3a94b28d488de8bbf897a5a5f 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Attribute/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Attribute; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Whether to join attribute_set_id to attributes or not diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Item.php b/app/code/Magento/GoogleShopping/Model/Resource/Item.php index bd9dc1ec8e07280b32310a15640407f34bf9530a..b9574ee0bdf5f22fa28254641947554b5cfa6b11 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Item.php @@ -33,7 +33,7 @@ */ namespace Magento\GoogleShopping\Model\Resource; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php index 2aecfe06a7c1cbc521c6ef7da4be42467b59935d..3cc5fb12e2187e3b96bf4b8bd9a0b144a2efeef5 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Item; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Config @@ -44,7 +44,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * Resource helper * - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_resourceHelper; @@ -53,20 +53,20 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Eav\Model\Config $config * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Eav\Model\Config $config, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_resourceHelper = $resourceHelper; $this->_eavConfig = $config; diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Type.php b/app/code/Magento/GoogleShopping/Model/Resource/Type.php index 96390f919cb1174a7c3096f00b8adf4f1ef5cf32..9d9c327ba8bdbfb111ff8f539173bb90f9c90275 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Type.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Type.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php b/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php index 86fb1fd529b339ae2764c469236061af09c959e3..16289de6bebbf6ce35bcf0e94da2437b25d13e54 100644 --- a/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php +++ b/app/code/Magento/GoogleShopping/Model/Resource/Type/Collection.php @@ -32,7 +32,7 @@ namespace Magento\GoogleShopping\Model\Resource\Type; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @return void diff --git a/app/code/Magento/GoogleShopping/Model/Service.php b/app/code/Magento/GoogleShopping/Model/Service.php index e7aad0225a7ea198a24fad3db362a53f21f58931..5c1c1f88c3b4743095f32a2a55effbbc6b1aaa75 100644 --- a/app/code/Magento/GoogleShopping/Model/Service.php +++ b/app/code/Magento/GoogleShopping/Model/Service.php @@ -106,7 +106,7 @@ class Service extends \Magento\Object * @param int $storeId * @param string $loginToken * @param string $loginCaptcha - * @throws \Magento\Core\Exception On http connection failure + * @throws \Magento\Model\Exception On http connection failure * @return \Zend_Http_Client */ public function getClient($storeId = null, $loginToken = null, $loginCaptcha = null) @@ -139,9 +139,9 @@ class Service extends \Magento\Object } catch (\Zend_Gdata_App_CaptchaRequiredException $e) { throw $e; } catch (\Zend_Gdata_App_HttpException $e) { - throw new \Magento\Core\Exception($errorMsg . __('Error: %1', $e->getMessage())); + throw new \Magento\Model\Exception($errorMsg . __('Error: %1', $e->getMessage())); } catch (\Zend_Gdata_App_AuthException $e) { - throw new \Magento\Core\Exception($errorMsg . __('Error: %1', $e->getMessage())); + throw new \Magento\Model\Exception($errorMsg . __('Error: %1', $e->getMessage())); } return $this->_coreRegistry->registry($this->_clientRegistryId); diff --git a/app/code/Magento/GoogleShopping/Model/Type.php b/app/code/Magento/GoogleShopping/Model/Type.php index 5e99728b64b6435ea8954516a43dfbc0e1e086fd..0600c79307b6b7c5bafb6556dbee546e9ca34270 100644 --- a/app/code/Magento/GoogleShopping/Model/Type.php +++ b/app/code/Magento/GoogleShopping/Model/Type.php @@ -35,7 +35,7 @@ use Magento\Gdata\Gshopping\Entry; * @package Magento_GoogleShopping * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * Mapping attributes collection diff --git a/app/code/Magento/GoogleShopping/etc/di.xml b/app/code/Magento/GoogleShopping/etc/di.xml index 2489566795b47c67bd5595aec2f5be18c16bc04f..2f8482ad857c2edfe123cc8e3b56902b3f9d4709 100644 --- a/app/code/Magento/GoogleShopping/etc/di.xml +++ b/app/code/Magento/GoogleShopping/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <virtualType name="Magento\GoogleShopping\Model\Resource\Helper" type="Magento\Core\Model\Resource\Helper"> + <virtualType name="Magento\GoogleShopping\Model\Resource\Helper" type="Magento\DB\Helper"> <arguments> <argument name="modulePrefix" xsi:type="string">Core</argument> </arguments> diff --git a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php index 5ccf7b3182904b0a15c767868a09602cd9f0d3eb..4d0a48ba49b7d781c31e970d288a91ade1cc68a0 100644 --- a/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php +++ b/app/code/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/Grouped.php @@ -29,6 +29,9 @@ */ namespace Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset; +use Magento\Customer\Controller\RegistryConstants; +use Magento\Customer\Service\V1\CustomerAccountServiceInterface as CustomerAccountService; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -50,57 +53,33 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped protected $_coreHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @var CustomerAccountService + */ + protected $_customerAccountService; + + /** + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Stdlib\ArrayUtils $arrayUtils * @param \Magento\Catalog\Helper\Product\Price $priceHelper * @param \Magento\Core\Helper\Data $coreHelper + * @param CustomerAccountService $customerAccountService * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Stdlib\ArrayUtils $arrayUtils, \Magento\Catalog\Helper\Product\Price $priceHelper, \Magento\Core\Helper\Data $coreHelper, + CustomerAccountService $customerAccountService, array $data = array(), array $priceBlockTypes = array() ) { + $this->_customerAccountService = $customerAccountService; $this->_coreHelper = $coreHelper; $this->priceHelper = $priceHelper; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $arrayUtils, $data, $priceBlockTypes @@ -120,8 +99,11 @@ class Grouped extends \Magento\GroupedProduct\Block\Product\View\Type\Grouped $this->_block = 'Magento\Catalog\Block\Adminhtml\Product\Price'; $this->_useLinkForAsLowAs = false; - if (!$this->priceHelper->getCustomer() && $this->_coreRegistry->registry('current_customer')) { - $this->priceHelper->setCustomer($this->_coreRegistry->registry('current_customer')); + if (is_null($this->priceHelper->getCustomer()->getId()) + && $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID) + ) { + $customerId = $this->_coreRegistry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->priceHelper->setCustomer($this->_customerAccountService->getCustomer($customerId)); } } diff --git a/app/code/Magento/GroupedProduct/etc/module.xml b/app/code/Magento/GroupedProduct/etc/module.xml index bf60b8e7d9ff1e4b303541660701bcb6de8669a3..c49b99b70a4451fe297d5337d0fcf98f273dbca4 100644 --- a/app/code/Magento/GroupedProduct/etc/module.xml +++ b/app/code/Magento/GroupedProduct/etc/module.xml @@ -37,7 +37,6 @@ <module name="Magento_Core" /> <module name="Magento_Tax" /> <module name="Magento_Checkout" /> - <module name="Magento_Wishlist" /> <module name="Magento_Backend" /> <module name="Magento_Eav" /> <module name="Magento_Customer" /> diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php index 0913db1759bae1267e03666efd6f97ce398c628a..8242604f2473fb63369c5a10f0de13e3338decef 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Form/After.php @@ -53,7 +53,7 @@ class After extends \Magento\Backend\Block\Template /** * Get current operation * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ public function getOperation() { diff --git a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php index 8f003dac2e25b970b928a4338aa6483da4d003da..50fab90781264cc172d80e75ef32a282a1714543 100644 --- a/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php +++ b/app/code/Magento/ImportExport/Controller/Adminhtml/Export.php @@ -95,7 +95,7 @@ class Export extends \Magento\Backend\App\Action \Magento\App\Filesystem::VAR_DIR, $model->getContentType() ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/ImportExport/Model/Export.php b/app/code/Magento/ImportExport/Model/Export.php index 502cba40281f60fe185b8bd43294cf0f24180843..3b78be536046393354e1a4e7f444456e1b44e0d6 100644 --- a/app/code/Magento/ImportExport/Model/Export.php +++ b/app/code/Magento/ImportExport/Model/Export.php @@ -106,7 +106,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Create instance of entity adapter and return it * * @return \Magento\ImportExport\Model\Export\Entity\AbstractEntity|\Magento\ImportExport\Model\Export\AbstractEntity - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getEntityAdapter() { @@ -118,12 +118,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $this->_entityAdapter = $this->_entityFactory->create($entities[$this->getEntity()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_entityAdapter instanceof \Magento\ImportExport\Model\Export\Entity\AbstractEntity && !$this->_entityAdapter instanceof \Magento\ImportExport\Model\Export\AbstractEntity ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity adapter object must be an instance of %1 or %2', 'Magento\ImportExport\Model\Export\Entity\AbstractEntity', @@ -134,12 +134,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel // check for entity codes integrity if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The input entity code is not equal to entity adapter code.') ); } } else { - throw new \Magento\Core\Exception(__('Please enter a correct entity.')); + throw new \Magento\Model\Exception(__('Please enter a correct entity.')); } $this->_entityAdapter->setParameters($this->getData()); } @@ -150,7 +150,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Get writer object. * * @return \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getWriter() { @@ -162,10 +162,10 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $this->_writer = $this->_exportAdapterFac->create($fileFormats[$this->getFileFormat()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_writer instanceof \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Adapter object must be an instance of %1', 'Magento\ImportExport\Model\Export\Adapter\AbstractAdapter' @@ -173,7 +173,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel ); } } else { - throw new \Magento\Core\Exception(__('Please correct the file format.')); + throw new \Magento\Model\Exception(__('Please correct the file format.')); } } return $this->_writer; @@ -183,7 +183,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Export data. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function export() { @@ -192,14 +192,14 @@ class Export extends \Magento\ImportExport\Model\AbstractModel $result = $this->_getEntityAdapter()->setWriter($this->_getWriter())->export(); $countRows = substr_count(trim($result), "\n"); if (!$countRows) { - throw new \Magento\Core\Exception(__('There is no data for export')); + throw new \Magento\Model\Exception(__('There is no data for export')); } if ($result) { $this->addLogComment(array(__('Exported %1 rows.', $countRows), __('Export has been done.'))); } return $result; } else { - throw new \Magento\Core\Exception(__('Please provide filter data.')); + throw new \Magento\Model\Exception(__('Please provide filter data.')); } } @@ -220,7 +220,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * @static * @param \Magento\Eav\Model\Entity\Attribute $attribute * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public static function getAttributeFilterType(\Magento\Eav\Model\Entity\Attribute $attribute) { @@ -236,7 +236,7 @@ class Export extends \Magento\ImportExport\Model\AbstractModel ) { return self::FILTER_TYPE_INPUT; } else { - throw new \Magento\Core\Exception(__('Cannot determine attribute filter type')); + throw new \Magento\Model\Exception(__('Cannot determine attribute filter type')); } } @@ -254,12 +254,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Override standard entity getter. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntity() { if (empty($this->_data['entity'])) { - throw new \Magento\Core\Exception(__('Entity is unknown')); + throw new \Magento\Model\Exception(__('Entity is unknown')); } return $this->_data['entity']; } @@ -278,12 +278,12 @@ class Export extends \Magento\ImportExport\Model\AbstractModel * Override standard entity getter. * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getFileFormat() { if (empty($this->_data['file_format'])) { - throw new \Magento\Core\Exception(__('File format is unknown')); + throw new \Magento\Model\Exception(__('File format is unknown')); } return $this->_data['file_format']; } diff --git a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php index a8e130a3f7aad65470dcba4f64c85b49bba271d6..3acf4db71bdfbae888d36cf7d557e2ba3d6d054d 100644 --- a/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/AbstractEntity.php @@ -281,7 +281,7 @@ abstract class AbstractEntity /** * Export one item * - * @param \Magento\Core\Model\AbstractModel $item + * @param \Magento\Model\AbstractModel $item * @return void */ abstract public function exportItem($item); @@ -415,12 +415,12 @@ abstract class AbstractEntity * Inner writer object getter * * @return AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWriter() { if (!$this->_writer) { - throw new \Magento\Core\Exception(__('Please specify writer.')); + throw new \Magento\Model\Exception(__('Please specify writer.')); } return $this->_writer; diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php index 27b06401a0021464d2b61b2f43c615ac2b151273..eb636f0f1cb0efd9d9f5df2745b18b744fe19c8b 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/AbstractAdapter.php @@ -58,7 +58,7 @@ abstract class AbstractAdapter * * @param \Magento\App\Filesystem $filesystem * @param string|null $destination - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct(\Magento\App\Filesystem $filesystem, $destination = null) { @@ -68,14 +68,14 @@ abstract class AbstractAdapter $this->_directoryHandle->touch($destination); } if (!is_string($destination)) { - throw new \Magento\Core\Exception(__('Destination file path must be a string')); + throw new \Magento\Model\Exception(__('Destination file path must be a string')); } if (!$this->_directoryHandle->isWritable()) { - throw new \Magento\Core\Exception(__('Destination directory is not writable')); + throw new \Magento\Model\Exception(__('Destination directory is not writable')); } if ($this->_directoryHandle->isFile($destination) && !$this->_directoryHandle->isWritable($destination)) { - throw new \Magento\Core\Exception(__('Destination file is not writable')); + throw new \Magento\Model\Exception(__('Destination file is not writable')); } $this->_destination = $destination; diff --git a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php index ffa460a98cc0f8cd3eb631cb8571e44b5c73e184..3a87715065a960059875904b88fdcf43a5c5ae68 100644 --- a/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php +++ b/app/code/Magento/ImportExport/Model/Export/Adapter/Csv.php @@ -106,7 +106,7 @@ class Csv extends \Magento\ImportExport\Model\Export\Adapter\AbstractAdapter public function setHeaderCols(array $headerColumns) { if (null !== $this->_headerCols) { - throw new \Magento\Core\Exception(__('Header column names already set')); + throw new \Magento\Model\Exception(__('Header column names already set')); } if ($headerColumns) { foreach ($headerColumns as $columnName) { diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php index 154838a549f389f78416f6c7212c3c5776b1e710..51ea13eb7d92c5fd64bf7aac4a77b8ebd02e9436 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEav.php @@ -299,11 +299,11 @@ abstract class AbstractEav extends \Magento\ImportExport\Model\Export\AbstractEn /** * Fill row with attributes values * - * @param \Magento\Core\Model\AbstractModel $item export entity + * @param \Magento\Model\AbstractModel $item export entity * @param array $row data row * @return array */ - protected function _addAttributeValuesToRow(\Magento\Core\Model\AbstractModel $item, array $row = array()) + protected function _addAttributeValuesToRow(\Magento\Model\AbstractModel $item, array $row = array()) { $validAttributeCodes = $this->_getExportAttributeCodes(); // go through all valid attribute codes diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php index 77040a05f760f9acc09eb975e1dcb596b535388c..0f103225a7210d43165ea7993a781fba33e73026 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/AbstractEntity.php @@ -512,12 +512,12 @@ abstract class AbstractEntity * Inner writer object getter. * * @return AbstractAdapter - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getWriter() { if (!$this->_writer) { - throw new \Magento\Core\Exception(__('Please specify writer.')); + throw new \Magento\Model\Exception(__('Please specify writer.')); } return $this->_writer; } diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index 18c83105ef6353287a4e556e07d2b0dc2e72025b..da7d74da6467e18679517cad476405739ba7ec4e 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -319,7 +319,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity /** * Initialize product type models. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _initTypeModels() @@ -327,10 +327,10 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity $productTypes = $this->_exportConfig->getProductTypes(); foreach ($productTypes as $productTypeName => $productTypeConfig) { if (!($model = $this->_typeFactory->create($productTypeConfig['model']))) { - throw new \Magento\Core\Exception("Entity type model '{$productTypeConfig['model']}' is not found"); + throw new \Magento\Model\Exception("Entity type model '{$productTypeConfig['model']}' is not found"); } if (!$model instanceof \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity type model must be an instance of \Magento\ImportExport\Model\Export\Entity\Product\Type\AbstractType' ) @@ -346,7 +346,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity } } if (!$this->_productTypeModels) { - throw new \Magento\Core\Exception(__('There are no product types available for export')); + throw new \Magento\Model\Exception(__('There are no product types available for export')); } $this->_disabledAttrs = array_unique($this->_disabledAttrs); diff --git a/app/code/Magento/ImportExport/Model/Import.php b/app/code/Magento/ImportExport/Model/Import.php index c3b00de0096959748e1905bb961cb61b70bf0b09..6767d3b2bf1167218ef3be39eb5b29bc37d02b2f 100644 --- a/app/code/Magento/ImportExport/Model/Import.php +++ b/app/code/Magento/ImportExport/Model/Import.php @@ -189,7 +189,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Create instance of entity adapter and return it * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\ImportExport\Model\Import\Entity\AbstractEntity|\Magento\ImportExport\Model\Import\AbstractEntity */ protected function _getEntityAdapter() @@ -202,12 +202,12 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $this->_entityAdapter = $this->_entityFactory->create($entities[$this->getEntity()]['model']); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Please enter a correct entity model')); + throw new \Magento\Model\Exception(__('Please enter a correct entity model')); } if (!$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\Entity\AbstractEntity && !$this->_entityAdapter instanceof \Magento\ImportExport\Model\Import\AbstractEntity ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity adapter object must be an instance of %1 or %2', 'Magento\ImportExport\Model\Import\Entity\AbstractEntity', @@ -218,12 +218,12 @@ class Import extends \Magento\ImportExport\Model\AbstractModel // check for entity codes integrity if ($this->getEntity() != $this->_entityAdapter->getEntityTypeCode()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The input entity code is not equal to entity adapter code.') ); } } else { - throw new \Magento\Core\Exception(__('Please enter a correct entity.')); + throw new \Magento\Model\Exception(__('Please enter a correct entity.')); } $this->_entityAdapter->setParameters($this->getData()); } @@ -339,13 +339,13 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Override standard entity getter. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getEntity() { if (empty($this->_data['entity'])) { - throw new \Magento\Core\Exception(__('Entity is unknown')); + throw new \Magento\Model\Exception(__('Entity is unknown')); } return $this->_data['entity']; } @@ -537,7 +537,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel /** * Move uploaded file and create source adapter instance. * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string Source file path */ public function uploadSource() @@ -551,7 +551,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel } else { $errorMessage = __('File was not uploaded.'); } - throw new \Magento\Core\Exception($errorMessage); + throw new \Magento\Model\Exception($errorMessage); } $entity = $this->getEntity(); @@ -564,7 +564,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $uploadedFile = $result['path'] . $result['file']; if (!$extension) { $this->_varDirectory->delete($uploadedFile); - throw new \Magento\Core\Exception(__('Uploaded file has no extension')); + throw new \Magento\Model\Exception(__('Uploaded file has no extension')); } $sourceFile = $this->getWorkingDir() . $entity; @@ -582,7 +582,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $sourceFileRelative ); } catch (\Magento\Filesystem\FilesystemException $e) { - throw new \Magento\Core\Exception(__('Source file moving failed')); + throw new \Magento\Model\Exception(__('Source file moving failed')); } } $this->_removeBom($sourceFile); @@ -591,7 +591,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel $this->_getSourceAdapter($sourceFile); } catch (\Exception $e) { $this->_varDirectory->delete($sourceFileRelative); - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } return $sourceFile; } @@ -665,7 +665,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel * ) * * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getEntityBehaviors() { @@ -681,7 +681,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel 'code' => $behavior->getCode() . '_behavior' ); } else { - throw new \Magento\Core\Exception(__('Invalid behavior token for %1', $entityCode)); + throw new \Magento\Model\Exception(__('Invalid behavior token for %1', $entityCode)); } } return $behaviourData; diff --git a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php index 3b83d05fd6363d3bc065f56d64405bc0f2249b5d..774ec251dc3d7499ab8568776b44282827faa0b7 100644 --- a/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/AbstractEntity.php @@ -546,12 +546,12 @@ abstract class AbstractEntity * Source object getter * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Source is not set')); + throw new \Magento\Model\Exception(__('Source is not set')); } return $this->_source; } @@ -702,7 +702,7 @@ abstract class AbstractEntity * Validate data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateData() { @@ -710,7 +710,7 @@ abstract class AbstractEntity // do all permanent columns exist? $absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames()); if ($absentColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot find required columns: %1', implode(', ', $absentColumns)) ); } @@ -731,12 +731,12 @@ abstract class AbstractEntity } if ($emptyHeaderColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Columns number: "%1" have empty headers', implode('", "', $emptyHeaderColumns)) ); } if ($invalidColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Column names: "%1" are invalid', implode('", "', $invalidColumns)) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Adapter.php b/app/code/Magento/ImportExport/Model/Import/Adapter.php index 03728dd63518ce3ff674323b23a52495c09eb28b..13d9ed65a45e4f5b4c9711f4da8a73d22328d9d4 100644 --- a/app/code/Magento/ImportExport/Model/Import/Adapter.php +++ b/app/code/Magento/ImportExport/Model/Import/Adapter.php @@ -44,22 +44,22 @@ class Adapter * @param Write $directory * @param mixed $options OPTIONAL Adapter constructor options * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public static function factory($type, $directory, $options = null) { if (!is_string($type) || !$type) { - throw new \Magento\Core\Exception(__('The adapter type must be a non empty string.')); + throw new \Magento\Model\Exception(__('The adapter type must be a non empty string.')); } $adapterClass = 'Magento\ImportExport\Model\Import\Source\\' . ucfirst(strtolower($type)); if (!class_exists($adapterClass)) { - throw new \Magento\Core\Exception("'{$type}' file extension is not supported"); + throw new \Magento\Model\Exception("'{$type}' file extension is not supported"); } $adapter = new $adapterClass($options, $directory); if (!$adapter instanceof AbstractSource) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Adapter must be an instance of \Magento\ImportExport\Model\Import\AbstractSource') ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php index 8e5d3b72576039cecf77e757695ff11d48174764..fc8575ebce07aa5d2cfe9c7fb45c42ca1e5b8531 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php @@ -254,12 +254,12 @@ abstract class AbstractEntity * Inner source object getter. * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Please specify a source.')); + throw new \Magento\Model\Exception(__('Please specify a source.')); } return $this->_source; } @@ -555,12 +555,12 @@ abstract class AbstractEntity * Source object getter. * * @return AbstractSource - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getSource() { if (!$this->_source) { - throw new \Magento\Core\Exception(__('Source is not set')); + throw new \Magento\Model\Exception(__('Source is not set')); } return $this->_source; } @@ -711,14 +711,14 @@ abstract class AbstractEntity * Validate data. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validateData() { if (!$this->_dataValidated) { // do all permanent columns exist? if ($absentColumns = array_diff($this->_permanentAttributes, $this->getSource()->getColNames())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot find required columns: %1', implode(', ', $absentColumns)) ); } @@ -739,12 +739,12 @@ abstract class AbstractEntity } if ($emptyHeaderColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Columns number: "%1" have empty headers', implode('", "', $emptyHeaderColumns)) ); } if ($invalidColumns) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Column names: "%1" are invalid', implode('", "', $invalidColumns)) ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php index d254446443aa8f92fadde6ed8bdc1dad19144b95..d2b158a320356dcc1b264e936963659b08006c8c 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product.php @@ -731,7 +731,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * Initialize product type models. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initTypeModels() { @@ -740,12 +740,12 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $params = array($this, $productTypeName); if (!($model = $this->_productTypeFactory->create($productTypeConfig['model'], array('params' => $params))) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( sprintf("Entity type model '%s' is not found", $productTypeConfig['model']) ); } if (!$model instanceof \Magento\ImportExport\Model\Import\Entity\Product\Type\AbstractType) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Entity type model must be an instance of ' . 'Magento\ImportExport\Model\Import\Entity\Product\Type\AbstractType' @@ -1549,7 +1549,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * Returns an object for upload a media files * * @return \Magento\ImportExport\Model\Import\Uploader - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getUploader() { @@ -1560,14 +1560,14 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity $tmpPath = $this->_mediaDirectory->getAbsolutePath('import'); if (!$this->_fileUploader->setTmpDir($tmpPath)) { - throw new \Magento\Core\Exception(sprintf("File directory '%s' is not readable.", $tmpPath)); + throw new \Magento\Model\Exception(sprintf("File directory '%s' is not readable.", $tmpPath)); } $destinationDir = "catalog/product"; $destinationPath = $this->_mediaDirectory->getAbsolutePath($destinationDir); $this->_mediaDirectory->create($destinationDir); if (!$this->_fileUploader->setDestDir($destinationPath)) { - throw new \Magento\Core\Exception(sprintf("File directory '%s' is not writable.", $destinationPath)); + throw new \Magento\Model\Exception(sprintf("File directory '%s' is not writable.", $destinationPath)); } } return $this->_fileUploader; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php index c07e16d10820e72a050e0527e3cedfb9b97f90c1..a46cb75973f9ce4318464c9f19de56babc2bd96a 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Option.php @@ -472,7 +472,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initSourceEntities(array $data) { @@ -492,7 +492,7 @@ class Option extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity if (isset($data['product_entity'])) { $this->_productEntity = $data['product_entity']; } else { - throw new \Magento\Core\Exception(__('Option entity must have a parent product entity.')); + throw new \Magento\Model\Exception(__('Option entity must have a parent product entity.')); } if (isset($data['collection_by_pages_iterator'])) { $this->_byPagesIterator = $data['collection_by_pages_iterator']; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php index c083d3eb83f3526d2c58697ec23bbbc5edf69eb2..b279c770afa13e267e06a190eb4a79a43d227d28 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/AbstractType.php @@ -107,7 +107,7 @@ abstract class AbstractType * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac * @param array $params - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, @@ -126,7 +126,7 @@ abstract class AbstractType $params[0] ) || !$params[0] instanceof \Magento\ImportExport\Model\Import\Entity\Product ) { - throw new \Magento\Core\Exception(__('Please correct the parameters.')); + throw new \Magento\Model\Exception(__('Please correct the parameters.')); } $this->_entityModel = $params[0]; $this->_type = $params[1]; diff --git a/app/code/Magento/ImportExport/Model/Import/Uploader.php b/app/code/Magento/ImportExport/Model/Import/Uploader.php index 5263fd0b8cb4b3f5464ccaefb402dc75defe6370..a0951fa404370e22c914f7a15751d6b76b7be01d 100644 --- a/app/code/Magento/ImportExport/Model/Import/Uploader.php +++ b/app/code/Magento/ImportExport/Model/Import/Uploader.php @@ -128,12 +128,12 @@ class Uploader extends \Magento\Core\Model\File\Uploader * * @param string $filePath * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setUploadFile($filePath) { if (!$this->_directory->isReadable($filePath)) { - throw new \Magento\Core\Exception("File '{$filePath}' was not found or has read restriction."); + throw new \Magento\Model\Exception("File '{$filePath}' was not found or has read restriction."); } $this->_file = $this->_readFileInfo($filePath); diff --git a/app/code/Magento/ImportExport/Model/Resource/Helper.php b/app/code/Magento/ImportExport/Model/Resource/Helper.php index e836725cd6341da3afbcb5af316d9a4ed323ce0c..a3c804b1e68f424b06ec454ee596c2798aa64ff1 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Helper.php +++ b/app/code/Magento/ImportExport/Model/Resource/Helper.php @@ -34,7 +34,7 @@ */ namespace Magento\ImportExport\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Constants to be used for DB @@ -79,7 +79,7 @@ class Helper extends \Magento\Core\Model\Resource\Helper $entityStatus = $adapter->showTableStatus($tableName); if (empty($entityStatus['Auto_increment'])) { - throw new \Magento\Core\Exception(__('Cannot get autoincrement value')); + throw new \Magento\Model\Exception(__('Cannot get autoincrement value')); } return $entityStatus['Auto_increment']; } diff --git a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php index 2e87cbb22c8cad5e60cf05ce2b208ad7ab55495a..097552568709029a0a1da6d73b34e31bc1c06d9f 100644 --- a/app/code/Magento/ImportExport/Model/Resource/Import/Data.php +++ b/app/code/Magento/ImportExport/Model/Resource/Import/Data.php @@ -32,7 +32,7 @@ namespace Magento\ImportExport\Model\Resource\Import; * @package Magento_ImportExport * @author Magento Core Team <core@magentocommerce.com> */ -class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \IteratorAggregate +class Data extends \Magento\Model\Resource\Db\AbstractDb implements \IteratorAggregate { /** * @var \Iterator @@ -130,7 +130,7 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Iterat * * @param string $code parameter name * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getUniqueColumnData($code) { @@ -138,7 +138,7 @@ class Data extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Iterat $values = array_unique($adapter->fetchCol($adapter->select()->from($this->getMainTable(), array($code)))); if (count($values) != 1) { - throw new \Magento\Core\Exception(__('Error in data structure: %1 values are mixed', $code)); + throw new \Magento\Model\Exception(__('Error in data structure: %1 values are mixed', $code)); } return $values[0]; } diff --git a/app/code/Magento/Index/App/Indexer.php b/app/code/Magento/Index/App/Indexer.php index 3597eb70f77bee5f5324fccf31d54e50421fbf76..eba378764910db1965f0634fa13d35c2d0ee3e15 100644 --- a/app/code/Magento/Index/App/Indexer.php +++ b/app/code/Magento/Index/App/Indexer.php @@ -26,9 +26,9 @@ namespace Magento\Index\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Indexer implements LauncherInterface +class Indexer implements AppInterface { /** * Report directory diff --git a/app/code/Magento/Index/App/Shell.php b/app/code/Magento/Index/App/Shell.php index 7d0bf5960b76df2b1a36a434f842d2def2babc02..a7af2049c500e55215c6ee38b6a5951e91786f7a 100644 --- a/app/code/Magento/Index/App/Shell.php +++ b/app/code/Magento/Index/App/Shell.php @@ -26,9 +26,9 @@ namespace Magento\Index\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Shell implements LauncherInterface +class Shell implements AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Index/Controller/Adminhtml/Process.php b/app/code/Magento/Index/Controller/Adminhtml/Process.php index 1886c02cc029b665999ec972822a3d6b79105ecd..df84c78c7c5bf9a0f78baee6206a965abbe9103a 100644 --- a/app/code/Magento/Index/Controller/Adminhtml/Process.php +++ b/app/code/Magento/Index/Controller/Adminhtml/Process.php @@ -138,7 +138,7 @@ class Process extends \Magento\Backend\App\Action try { $process->save(); $this->messageManager->addSuccess(__('The index has been saved.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('There was a problem with saving process.')); @@ -166,7 +166,7 @@ class Process extends \Magento\Backend\App\Action $process->reindexEverything(); \Magento\Profiler::stop('__INDEX_PROCESS_REINDEX_ALL__'); $this->messageManager->addSuccess(__('%1 index was rebuilt.', $process->getIndexer()->getName())); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('There was a problem with reindexing process.')); @@ -218,7 +218,7 @@ class Process extends \Magento\Backend\App\Action } } $this->messageManager->addSuccess(__('Total of %1 index(es) have reindexed data.', $counter)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); @@ -251,7 +251,7 @@ class Process extends \Magento\Backend\App\Action } } $this->messageManager->addSuccess(__('Total of %1 index(es) have changed index mode.', $counter)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Cannot initialize the indexer process.')); diff --git a/app/code/Magento/Index/Model/Event.php b/app/code/Magento/Index/Model/Event.php index f41acf63b8b42e475a4c15ba027dbc7783972594..ca6b1f48aece17f462d125e03121d075a54d546a 100644 --- a/app/code/Magento/Index/Model/Event.php +++ b/app/code/Magento/Index/Model/Event.php @@ -44,7 +44,7 @@ use Magento\Index\Model\Indexer; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\AbstractModel +class Event extends \Magento\Model\AbstractModel { /** * Predefined event types @@ -92,7 +92,7 @@ class Event extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param Indexer $indexer * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -101,7 +101,7 @@ class Event extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, Indexer $indexer, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php b/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php index af64bfdda5720f9dbe60af5816a36a0ad1bf1089..9f7f40c85ec2108faffd68f4f6abbe68ee23171f 100644 --- a/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php +++ b/app/code/Magento/Index/Model/Indexer/AbstractIndexer.php @@ -33,7 +33,7 @@ namespace Magento\Index\Model\Indexer; use Magento\Index\Model\Event; use Magento\Index\Model\IndexerInterface; -abstract class AbstractIndexer extends \Magento\Core\Model\AbstractModel implements IndexerInterface +abstract class AbstractIndexer extends \Magento\Model\AbstractModel implements IndexerInterface { /** * @var array diff --git a/app/code/Magento/Index/Model/Process.php b/app/code/Magento/Index/Model/Process.php index e1e801538f2b85137eb7ad803ad31e59237825fe..cb3eeacc14ddcc78e03fd54d9af75fb7b2c056b7 100644 --- a/app/code/Magento/Index/Model/Process.php +++ b/app/code/Magento/Index/Model/Process.php @@ -45,7 +45,7 @@ use Magento\Index\Model\Resource\Event\Collection; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Process extends \Magento\Core\Model\AbstractModel +class Process extends \Magento\Model\AbstractModel { /** * Process statuses @@ -132,7 +132,7 @@ class Process extends \Magento\Core\Model\AbstractModel * @param \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig * @param \Magento\Index\Model\Lock\Storage $lockStorage * @param \Magento\Index\Model\EventRepository $eventRepository - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -145,7 +145,7 @@ class Process extends \Magento\Core\Model\AbstractModel \Magento\Index\Model\Indexer\ConfigInterface $indexerConfig, \Magento\Index\Model\Lock\Storage $lockStorage, \Magento\Index\Model\EventRepository $eventRepository, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -245,13 +245,13 @@ class Process extends \Magento\Core\Model\AbstractModel * Reindex all data what this process responsible is * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function reindexAll() { if ($this->isLocked()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( '%1 Index process is not working now. Please try running this process later.', $this->getIndexer()->getName() @@ -364,7 +364,7 @@ class Process extends \Magento\Core\Model\AbstractModel /** * Get Indexer strategy object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Index\Model\IndexerInterface */ public function getIndexer() @@ -372,17 +372,17 @@ class Process extends \Magento\Core\Model\AbstractModel if ($this->_currentIndexer === null) { $name = $this->_getData('indexer_code'); if (!$name) { - throw new \Magento\Core\Exception(__('Indexer name is not defined.')); + throw new \Magento\Model\Exception(__('Indexer name is not defined.')); } $indexerConfiguration = $this->_indexerConfig->getIndexer($name); if (!$indexerConfiguration || empty($indexerConfiguration['instance'])) { - throw new \Magento\Core\Exception(__('Indexer model is not defined.')); + throw new \Magento\Model\Exception(__('Indexer model is not defined.')); } $indexerModel = $this->_indexerFactory->create($indexerConfiguration['instance']); if ($indexerModel instanceof \Magento\Index\Model\Indexer\AbstractIndexer) { $this->_currentIndexer = $indexerModel; } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Indexer model should extend \Magento\Index\Model\Indexer\Abstract.') ); } diff --git a/app/code/Magento/Index/Model/Resource/AbstractResource.php b/app/code/Magento/Index/Model/Resource/AbstractResource.php index 79c5c0ed16e7b45f198f103557c502d7341ad570..b51c309dbe69d710d80c549cd7733c611814bf04 100644 --- a/app/code/Magento/Index/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Index/Model/Resource/AbstractResource.php @@ -36,7 +36,7 @@ namespace Magento\Index\Model\Resource; use Magento\DB\Adapter\AdapterInterface; use Magento\DB\Select; -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { const IDX_SUFFIX = '_idx'; diff --git a/app/code/Magento/Index/Model/Resource/Event.php b/app/code/Magento/Index/Model/Resource/Event.php index 4a66010141408e2ce5d24bf1d68d5b69a76a8526..76b1419196ce68a027184e8efb6f2ecfcc88ef8c 100644 --- a/app/code/Magento/Index/Model/Resource/Event.php +++ b/app/code/Magento/Index/Model/Resource/Event.php @@ -25,7 +25,7 @@ */ namespace Magento\Index\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; use Magento\Index\Model\Process as ProcessModel; /** @@ -35,7 +35,7 @@ use Magento\Index\Model\Process as ProcessModel; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\Resource\Db\AbstractDb +class Event extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/Index/Model/Resource/Event/Collection.php b/app/code/Magento/Index/Model/Resource/Event/Collection.php index 0976be726e891d4908f51eb7dd3d415d58a1b127..5beacc73851bd935f41769ff26f94f3f495f0b72 100644 --- a/app/code/Magento/Index/Model/Resource/Event/Collection.php +++ b/app/code/Magento/Index/Model/Resource/Event/Collection.php @@ -34,7 +34,7 @@ use Magento\Index\Model\Process; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Index/Model/Resource/Process.php b/app/code/Magento/Index/Model/Resource/Process.php index 3f97553e5f88a529b8a50dce4ae446b0e94f271d..d3c9033b172a71ef97db25286f9f0513a8ce43a5 100644 --- a/app/code/Magento/Index/Model/Resource/Process.php +++ b/app/code/Magento/Index/Model/Resource/Process.php @@ -34,7 +34,7 @@ use Magento\Index\Model\Process as ModelProcess; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Process extends \Magento\Core\Model\Resource\Db\AbstractDb +class Process extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Index/Model/Resource/Process/Collection.php b/app/code/Magento/Index/Model/Resource/Process/Collection.php index f75bc4e7f7c7ea922ae882c761f90256849b14db..c78e3acb31c0fcbd4fa946e24d95cd079ebac2b5 100644 --- a/app/code/Magento/Index/Model/Resource/Process/Collection.php +++ b/app/code/Magento/Index/Model/Resource/Process/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Index\Model\Resource\Process; * @package Magento_Index * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php index 6c4940e6b386a17494909d31ff6573b012b1a543..b7e42e46e1c4e9947e3fe461966aa84811e00efc 100644 --- a/app/code/Magento/Index/Model/Shell.php +++ b/app/code/Magento/Index/Model/Shell.php @@ -164,7 +164,7 @@ class Shell extends \Magento\App\AbstractShell try { $process->setMode($mode)->save(); echo $process->getIndexer()->getName() . " index was successfully changed index mode\n"; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . "\n"; $this->_hasErrors = true; } catch (\Exception $e) { @@ -194,7 +194,7 @@ class Shell extends \Magento\App\AbstractShell try { $process->reindexEverything(); echo $process->getIndexer()->getName() . " index was rebuilt successfully\n"; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . "\n"; $this->_hasErrors = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Indexer/App/Indexer.php b/app/code/Magento/Indexer/App/Indexer.php index d09eb6dac8d8b4c8806dcf5c78a2f66ee3102b05..2822af37707ef7f7ac620f874fb46c097006fc18 100644 --- a/app/code/Magento/Indexer/App/Indexer.php +++ b/app/code/Magento/Indexer/App/Indexer.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\App; -class Indexer implements \Magento\LauncherInterface +class Indexer implements \Magento\AppInterface { /** * Report directory diff --git a/app/code/Magento/Indexer/App/Shell.php b/app/code/Magento/Indexer/App/Shell.php index 6ff464fd60d9f384ca3df272a9e642ebf5e00d20..9d31630ece195fbc72494b219d36e90d97864e0c 100644 --- a/app/code/Magento/Indexer/App/Shell.php +++ b/app/code/Magento/Indexer/App/Shell.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\App; -class Shell implements \Magento\LauncherInterface +class Shell implements \Magento\AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php index 5c9c4cac45ef4c1d330d99591cf07b1ac19bb104..1d954fa9f24ad6607ef1635f823fc47137f725dc 100644 --- a/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php +++ b/app/code/Magento/Indexer/Controller/Adminhtml/Indexer.php @@ -65,7 +65,7 @@ class Indexer extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 indexer(s) have been turned Update on Save mode on.', count($indexerIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -101,7 +101,7 @@ class Indexer extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 indexer(s) have been turned Update by Schedule mode on.', count($indexerIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( diff --git a/app/code/Magento/Indexer/Model/Indexer/State.php b/app/code/Magento/Indexer/Model/Indexer/State.php index 2952ff9d1be61e436e04672ae63c29f70aab1c91..df2366e939d848a05723fce36e3d806865c818ed 100644 --- a/app/code/Magento/Indexer/Model/Indexer/State.php +++ b/app/code/Magento/Indexer/Model/Indexer/State.php @@ -30,7 +30,7 @@ namespace Magento\Indexer\Model\Indexer; * @method string getUpdated() * @method \Magento\Indexer\Model\Indexer\State setUpdated($value) */ -class State extends \Magento\Core\Model\AbstractModel +class State extends \Magento\Model\AbstractModel { /** * Indexer statuses diff --git a/app/code/Magento/Core/Model/Mview/View/State.php b/app/code/Magento/Indexer/Model/Mview/View/State.php similarity index 89% rename from app/code/Magento/Core/Model/Mview/View/State.php rename to app/code/Magento/Indexer/Model/Mview/View/State.php index 8efde77087840f7c41c51af6eadd31e0129a0b18..51504fa158e1ccb66409af79013c07054c8be9d7 100644 --- a/app/code/Magento/Core/Model/Mview/View/State.php +++ b/app/code/Magento/Indexer/Model/Mview/View/State.php @@ -21,12 +21,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Mview\View; +namespace Magento\Indexer\Model\Mview\View; /** * @method \Magento\Indexer\Model\Indexer\State setViewId(string $value) */ -class State extends \Magento\Core\Model\AbstractModel implements \Magento\Mview\View\StateInterface +class State extends \Magento\Model\AbstractModel implements \Magento\Mview\View\StateInterface { /** * Prefix of model events names @@ -45,15 +45,15 @@ class State extends \Magento\Core\Model\AbstractModel implements \Magento\Mview\ /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\Mview\View\State $resource - * @param \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection + * @param \Magento\Indexer\Model\Resource\Mview\View\State $resource + * @param \Magento\Indexer\Model\Resource\Mview\View\State\Collection $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\Mview\View\State $resource, - \Magento\Core\Model\Resource\Mview\View\State\Collection $resourceCollection, + \Magento\Indexer\Model\Resource\Mview\View\State $resource, + \Magento\Indexer\Model\Resource\Mview\View\State\Collection $resourceCollection, array $data = array() ) { if (!isset($data['mode'])) { diff --git a/app/code/Magento/Indexer/Model/Resource/Indexer/State.php b/app/code/Magento/Indexer/Model/Resource/Indexer/State.php index 301c5e5210d99e4751e58055491c656ab94cfaf5..79533f29d1c1a8084b1817059ffe09065b0e5e47 100644 --- a/app/code/Magento/Indexer/Model/Resource/Indexer/State.php +++ b/app/code/Magento/Indexer/Model/Resource/Indexer/State.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\Model\Resource\Indexer; -class State extends \Magento\Core\Model\Resource\Db\AbstractDb +class State extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php b/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php index 4783571bf5aaac43047c9d050740ee4befa2a184..fc10b1ba75f1ee21be872c4f402e9e73af3e6504 100644 --- a/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php +++ b/app/code/Magento/Indexer/Model/Resource/Indexer/State/Collection.php @@ -23,7 +23,7 @@ */ namespace Magento\Indexer\Model\Resource\Indexer\State; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection initialization diff --git a/app/code/Magento/Core/Model/Resource/Mview/View/State.php b/app/code/Magento/Indexer/Model/Resource/Mview/View/State.php similarity index 91% rename from app/code/Magento/Core/Model/Resource/Mview/View/State.php rename to app/code/Magento/Indexer/Model/Resource/Mview/View/State.php index 78ba4d6f183a837484054d97cddcc54e91b7bce1..fb915655685fa0685c7202aeac31069845a9852f 100644 --- a/app/code/Magento/Core/Model/Resource/Mview/View/State.php +++ b/app/code/Magento/Indexer/Model/Resource/Mview/View/State.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Mview\View; +namespace Magento\Indexer\Model\Resource\Mview\View; -class State extends \Magento\Core\Model\Resource\Db\AbstractDb +class State extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php b/app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php similarity index 80% rename from app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php rename to app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php index e7bbdca52cb23990aaac19f2f0170267b04952fe..da97e537f0f6121c5ecd6a56b54325b8454d3350 100644 --- a/app/code/Magento/Core/Model/Resource/Mview/View/State/Collection.php +++ b/app/code/Magento/Indexer/Model/Resource/Mview/View/State/Collection.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Mview\View\State; +namespace Magento\Indexer\Model\Resource\Mview\View\State; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection implements +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection implements \Magento\Mview\View\State\CollectionInterface { /** @@ -33,6 +33,6 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected function _construct() { - $this->_init('Magento\Core\Model\Mview\View\State', 'Magento\Core\Model\Resource\Mview\View\State'); + $this->_init('Magento\Indexer\Model\Mview\View\State', 'Magento\Indexer\Model\Resource\Mview\View\State'); } } diff --git a/app/code/Magento/Indexer/Model/Shell.php b/app/code/Magento/Indexer/Model/Shell.php index 88a58b47ceb93a46989e2a556cfd6f3efac7a5c3..fe5ee2cb764dc7fc6055c6da5c958adb12e0b35f 100644 --- a/app/code/Magento/Indexer/Model/Shell.php +++ b/app/code/Magento/Indexer/Model/Shell.php @@ -156,7 +156,7 @@ class Shell extends \Magento\App\AbstractShell try { $indexer->{$method}(); echo $indexer->getTitle() . " indexer was successfully changed index mode" . PHP_EOL; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . PHP_EOL; $this->hasErrors = true; } catch (\Exception $e) { @@ -186,7 +186,7 @@ class Shell extends \Magento\App\AbstractShell try { $indexer->reindexAll(); echo $indexer->getTitle() . " index has been rebuilt successfully" . PHP_EOL; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { echo $e->getMessage() . PHP_EOL; $this->hasErrors = true; } catch (\Exception $e) { diff --git a/app/code/Magento/Indexer/etc/di.xml b/app/code/Magento/Indexer/etc/di.xml index 691840ef43f52dbf873a7af20763215b7686a16c..94d2719dffb9ade32800cd27d081297bb8d296bd 100644 --- a/app/code/Magento/Indexer/etc/di.xml +++ b/app/code/Magento/Indexer/etc/di.xml @@ -24,6 +24,8 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Mview\View\State\CollectionInterface" type="Magento\Indexer\Model\Resource\Mview\View\State\Collection" /> + <preference for="Magento\Mview\View\StateInterface" type="Magento\Indexer\Model\Mview\View\State" /> <preference for="Magento\Indexer\Model\ConfigInterface" type="Magento\Indexer\Model\Config" /> <preference for="Magento\Indexer\Model\IndexerInterface" type="Magento\Indexer\Model\Indexer" /> <type name="Magento\Indexer\Model\Indexer"> @@ -41,6 +43,11 @@ <argument name="stateCollection" xsi:type="object" shared="false">Magento\Indexer\Model\Resource\Indexer\State\Collection</argument> </arguments> </type> + <type name="Magento\Mview\View\Subscription"> + <arguments> + <argument name="viewCollection" xsi:type="object" shared="false">Magento\Mview\View\CollectionInterface</argument> + </arguments> + </type> <type name="Magento\Indexer\Model\Processor"> <plugin name="page-cache-indexer-reindex-invalidate" type="Magento\Indexer\Model\Processor\InvalidateCache" sortOrder="10"/> diff --git a/app/code/Magento/Indexer/etc/module.xml b/app/code/Magento/Indexer/etc/module.xml index 70cd4db611f3f24fe937c7b648278eb8b115feb3..cd1fced8c23fb7b65179508ebb6b74fa2c8c84ed 100644 --- a/app/code/Magento/Indexer/etc/module.xml +++ b/app/code/Magento/Indexer/etc/module.xml @@ -25,11 +25,7 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_Indexer" version="1.0.0.0" active="true"> - <sequence> - <module name="Magento_Core"/> - </sequence> <depends> - <module name="Magento_Core"/> <module name="Magento_Backend"/> <module name="Magento_PageCache"/> </depends> diff --git a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php index bba07d6a219ef1b11f079166e8c3200c5f90f7f1..2a94037505cdaff64f1c3ed44a0f7cff40faf6b3 100644 --- a/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php +++ b/app/code/Magento/Indexer/sql/indexer_setup/install-1.0.0.0.php @@ -64,4 +64,60 @@ $table = $installer->getConnection()->newTable( ); $installer->getConnection()->createTable($table); +/** + * Create table 'mview_state' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('mview_state') + )->addColumn( + 'state_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), + 'View State Id' + )->addColumn( + 'view_id', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'View Id' + )->addColumn( + 'mode', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 16, + array('default' => \Magento\Mview\View\StateInterface::MODE_DISABLED,), + 'View Mode' + )->addColumn( + 'status', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 16, + array('default' => \Magento\Mview\View\StateInterface::STATUS_IDLE,), + 'View Status' + )->addColumn( + 'updated', + \Magento\DB\Ddl\Table::TYPE_DATETIME, + null, + array(), + 'View updated time' + )->addColumn( + 'version_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array('unsigned' => true,), + 'View Version Id' + )->addIndex( + $installer->getIdxName('mview_state', array('view_id')), + array('view_id') + )->addIndex( + $installer->getIdxName('mview_state', array('mode')), + array('mode') + )->setComment('View State'); +$installer->getConnection()->createTable($table); + $installer->endSetup(); diff --git a/app/code/Magento/Install/App/Action/Plugin/Design.php b/app/code/Magento/Install/App/Action/Plugin/Design.php index 459fb8ecba87a14d1a9af4446744e251d12bad8b..840d7a6709e38cbba52ef543e4601a087399c11c 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Design.php +++ b/app/code/Magento/Install/App/Action/Plugin/Design.php @@ -33,9 +33,9 @@ class Design protected $_request; /** - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * @var \Magento\View\LayoutInterface @@ -53,15 +53,15 @@ class Design protected $_viewDesign; /** - * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\App $app + * @param RequestInterface $request + * @param \Magento\App\AreaList $areaList * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\View\Design\Theme\ListInterface $themeList */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\View\LayoutInterface $layout, \Magento\View\DesignInterface $viewDesign, \Magento\View\Design\Theme\ListInterface $themeList @@ -69,7 +69,7 @@ class Design $this->_viewDesign = $viewDesign; $this->_themeList = $themeList; $this->_request = $request; - $this->_app = $app; + $this->_areaList = $areaList; $this->_layout = $layout; } @@ -85,7 +85,7 @@ class Design public function beforeDispatch(\Magento\Install\Controller\Action $subject, RequestInterface $request) { $areaCode = $this->_layout->getArea(); - $area = $this->_app->getArea($areaCode); + $area = $this->_areaList->getArea($areaCode); $area->load(\Magento\Core\Model\App\Area::PART_CONFIG); $themePath = $this->_viewDesign->getConfigurationDesignTheme($areaCode); diff --git a/app/code/Magento/Install/App/Console.php b/app/code/Magento/Install/App/Console.php index ab8a04f95b9787e48fe9c3eb024f59fdc8e80eb8..806e11ef9f6667d78b07e27fc7972333ec0d8059 100644 --- a/app/code/Magento/Install/App/Console.php +++ b/app/code/Magento/Install/App/Console.php @@ -27,7 +27,7 @@ namespace Magento\Install\App; use Magento\App\Console\Response; -class Console implements \Magento\LauncherInterface +class Console implements \Magento\AppInterface { /** * @var \Magento\Install\Model\Installer\ConsoleFactory diff --git a/app/code/Magento/Install/Controller/Wizard.php b/app/code/Magento/Install/Controller/Wizard.php index 1f37447a0e9f5dd82402b385d91d3b746bc8b255..27bdd680bc54ffb90c5b4f60a61d664efd2c8620 100644 --- a/app/code/Magento/Install/Controller/Wizard.php +++ b/app/code/Magento/Install/Controller/Wizard.php @@ -514,7 +514,7 @@ class Wizard extends \Magento\Install\Controller\Action $this->getResponse()->setRedirect($step->getNextUrl()); } catch (\Exception $e) { $this->_session->setAdminData($adminData); - if ($e instanceof \Magento\Core\Exception) { + if ($e instanceof \Magento\Model\Exception) { $this->messageManager->addMessages($e->getMessages()); } else { $this->messageManager->addError($e->getMessage()); diff --git a/app/code/Magento/Install/Model/Installer.php b/app/code/Magento/Install/Model/Installer.php index 12534ca06568114bbc9b85decceafbdcc4cb978a..aa80892b7a5d053f951686e7c26d0c256fc1ac44 100644 --- a/app/code/Magento/Install/Model/Installer.php +++ b/app/code/Magento/Install/Model/Installer.php @@ -95,11 +95,11 @@ class Installer extends \Magento\Object protected $_filesystem; /** - * Application + * Area list * - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * Application @@ -198,7 +198,7 @@ class Installer extends \Magento\Object * @param \Magento\App\Cache\StateInterface $cacheState * @param \Magento\Module\Updater\SetupFactory $setupFactory * @param \Magento\App\Arguments $arguments - * @param \Magento\Core\Model\App $app + * @param \Magento\App\AreaList $areaList * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\User\Model\UserFactory $userModelFactory @@ -225,7 +225,7 @@ class Installer extends \Magento\Object \Magento\App\Cache\StateInterface $cacheState, \Magento\Module\Updater\SetupFactory $setupFactory, \Magento\App\Arguments $arguments, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\App\State $appState, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\User\Model\UserFactory $userModelFactory, @@ -253,7 +253,7 @@ class Installer extends \Magento\Object $this->_encryptor = $encryptor; $this->mathRandom = $mathRandom; $this->_arguments = $arguments; - $this->_app = $app; + $this->_areaList = $areaList; $this->_appState = $appState; $this->_storeManager = $storeManager; $this->_userModelFactory = $userModelFactory; @@ -503,10 +503,9 @@ class Installer extends \Magento\Object public function createAdministrator($data) { // \Magento\User\Model\User belongs to adminhtml area - $this->_app->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + $this->_areaList + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\App\AreaInterface::PART_CONFIG); /** @var $user \Magento\User\Model\User */ $user = $this->_userModelFactory->create(); diff --git a/app/code/Magento/Install/Model/Installer/Config.php b/app/code/Magento/Install/Model/Installer/Config.php index e4d8c80c57778d84b3fa6ff22a33658ba2ec6f11..f24e7773bb41042a83fe0d81ada945cd05a6a49c 100644 --- a/app/code/Magento/Install/Model/Installer/Config.php +++ b/app/code/Magento/Install/Model/Installer/Config.php @@ -222,7 +222,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller * * @param string $baseUrl * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ protected function _checkUrl($baseUrl) @@ -240,7 +240,7 @@ class Config extends \Magento\Install\Model\Installer\AbstractInstaller } if ($response->getStatus() != 200) { $this->messageManager->addError(__('The URL "%1" is invalid.', $baseUrl)); - throw new \Magento\Core\Exception(__('Response from the server is invalid.')); + throw new \Magento\Model\Exception(__('Response from the server is invalid.')); } } diff --git a/app/code/Magento/Install/Model/Installer/Console.php b/app/code/Magento/Install/Model/Installer/Console.php index 317610602e5d59149509fe9d8b909eb43af9ef16..f4e35e4c68e008b178fd1d0332f6135d8d3341d6 100644 --- a/app/code/Magento/Install/Model/Installer/Console.php +++ b/app/code/Magento/Install/Model/Installer/Console.php @@ -388,7 +388,7 @@ class Console extends \Magento\Install\Model\Installer\AbstractInstaller return $encryptionKey; } catch (\Exception $e) { - if ($e instanceof \Magento\Core\Exception) { + if ($e instanceof \Magento\Model\Exception) { foreach ($e->getMessages(\Magento\Message\MessageInterface::TYPE_ERROR) as $errorMessage) { $this->addError($errorMessage); } diff --git a/app/code/Magento/Install/Model/Installer/Db.php b/app/code/Magento/Install/Model/Installer/Db.php index 7d478760f2fd6447ddadfbb49727588494958288..f492ec6778067aafd468f91dba5d261930846211 100644 --- a/app/code/Magento/Install/Model/Installer/Db.php +++ b/app/code/Magento/Install/Model/Installer/Db.php @@ -81,7 +81,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller * * @param array $data * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkDbConnectionData($data) { @@ -101,7 +101,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller } } if (!empty($absenteeExtensions)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('PHP Extensions "%1" must be loaded.', implode(',', $absenteeExtensions)) ); } @@ -113,7 +113,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller // check DB server version if (version_compare($version, $requiredVersion) == -1) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The database server version doesn\'t match system requirements (required: %1, actual: %2).', $requiredVersion, @@ -124,16 +124,16 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller // check InnoDB support if (!$resource->supportEngine()) { - throw new \Magento\Core\Exception(__('Database server does not support the InnoDB storage engine.')); + throw new \Magento\Model\Exception(__('Database server does not support the InnoDB storage engine.')); } // TODO: check user roles - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__($e->getMessage())); + throw new \Magento\Model\Exception(__($e->getMessage())); } catch (\Exception $e) { $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong while connecting to the database.')); + throw new \Magento\Model\Exception(__('Something went wrong while connecting to the database.')); } return $data; @@ -148,7 +148,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller protected function _getCheckedData($data) { if (!isset($data['db_name']) || empty($data['db_name'])) { - throw new \Magento\Core\Exception(__('The Database Name field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Database Name field cannot be empty.')); } //make all table prefix to lower letter if ($data['db_prefix'] != '') { @@ -157,7 +157,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller //check table prefix if ($data['db_prefix'] != '') { if (!preg_match('/^[a-z]+[a-z0-9_]*$/', $data['db_prefix'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The table prefix should contain only letters (a-z), numbers (0-9) or underscores (_); the first character should be a letter.' ) @@ -187,7 +187,7 @@ class Db extends \Magento\Install\Model\Installer\AbstractInstaller * Retrieve the database resource * * @return \Magento\Install\Model\Installer\Db\AbstractDb - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getDbResource() { diff --git a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php index 96c78dd4a233369dbc029ca3b2091cc18b9fb98e..ed42f7631206920a37018f908b536457c800c0cf 100644 --- a/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php +++ b/app/code/Magento/Install/Model/Installer/Db/AbstractDb.php @@ -38,7 +38,7 @@ abstract class AbstractDb /** * Resource connection adapter factory * - * @var \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory + * @var \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory */ protected $_adapterFactory; @@ -78,12 +78,12 @@ abstract class AbstractDb protected $_arguments; /** - * @param \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory + * @param \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory * @param \Magento\App\Arguments $arguments * @param array $dbExtensions */ public function __construct( - \Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, + \Magento\Model\Resource\Type\Db\Pdo\MysqlFactory $adapterFactory, \Magento\App\Arguments $arguments, array $dbExtensions = array() ) { diff --git a/app/code/Magento/Install/view/install/config.phtml b/app/code/Magento/Install/view/install/config.phtml index 58228d0644ac0ba28e8a474fcd65bdd800b8a4cb..fdc41575654ff3cd7be4a2c14dd1ddfb247e5ec5 100644 --- a/app/code/Magento/Install/view/install/config.phtml +++ b/app/code/Magento/Install/view/install/config.phtml @@ -90,7 +90,7 @@ <p style="margin-top:4px; line-height:1.3em; color:#666;"> <small> - <?php echo __('You could enable this option to use web server rewrites functionality for improved search engines optimization.') ?> + <?php echo __('You could enable this option to use web server rewrites functionality for improved Search Engine Optimization.') ?> <br/> <strong><?php echo __('Please make sure that <code>mod_rewrite</code> is enabled in Apache configuration.') ?></strong> </small> diff --git a/app/code/Magento/Install/view/install/page.phtml b/app/code/Magento/Install/view/install/page.phtml index 60bd43b8308e796a66a7bd5e395445dfd7d59528..cc55f4f7d62bf90e323f17d6dbcce1e1871a29e5 100644 --- a/app/code/Magento/Install/view/install/page.phtml +++ b/app/code/Magento/Install/view/install/page.phtml @@ -112,7 +112,7 @@ <p class="legality"> <?php echo __('Help Us Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" - target="varien_external"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?> + target="varien_external"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?> <br/> <?php echo $this->getChildHtml('copyright');?> </p> diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php index f4417ed1783588fc3a531e51e44f940040fb692b..cf2978003b173f55962287770e307ef86e034d01 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php @@ -268,7 +268,7 @@ class Integration extends Action $this->messageManager->addError($this->escaper->escapeHtml($e->getMessage())); $this->_getSession()->setIntegrationData($integrationData); $this->_redirectOnSaveError(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($this->escaper->escapeHtml($e->getMessage())); $this->_redirectOnSaveError(); } catch (\Exception $e) { @@ -387,7 +387,7 @@ class Integration extends Action self::REGISTRY_KEY_CURRENT_INTEGRATION, $this->_integrationService->get($integrationId)->getData() ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*'); return; @@ -434,7 +434,7 @@ class Integration extends Action 'popup_content' => $popupContent ); $this->getResponse()->setBody($this->_coreHelper->jsonEncode($result)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*'); return; diff --git a/app/code/Magento/Integration/Exception.php b/app/code/Magento/Integration/Exception.php index b2f00f950e4df0ef2b93672e9c476b0f7681c286..ecf8af15b415e6bd5c77f380d0fb6a305585bd68 100644 --- a/app/code/Magento/Integration/Exception.php +++ b/app/code/Magento/Integration/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Integration; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php index a4b43b4ec16c9f81238d98a8bf527a79a257275d..316adc6ca6c6b9651e4c9eec4fbcb764e9d55008 100644 --- a/app/code/Magento/Integration/Model/Integration.php +++ b/app/code/Magento/Integration/Model/Integration.php @@ -44,7 +44,7 @@ namespace Magento\Integration\Model; * @method \string getUpdatedAt() * @method Integration setUpdatedAt(\string $createdAt) */ -class Integration extends \Magento\Core\Model\AbstractModel +class Integration extends \Magento\Model\AbstractModel { /**#@+ * Integration Status values @@ -94,7 +94,7 @@ class Integration extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -102,7 +102,7 @@ class Integration extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Oauth/Consumer.php b/app/code/Magento/Integration/Model/Oauth/Consumer.php index 12ad275feb004ae6a0b9ab80020ff878cca0d1c0..59095603be409d61ed1001e9dd0c804b9dde80a9 100644 --- a/app/code/Magento/Integration/Model/Oauth/Consumer.php +++ b/app/code/Magento/Integration/Model/Oauth/Consumer.php @@ -44,7 +44,7 @@ use Magento\Oauth\ConsumerInterface; * @method string getRejectedCallbackUrl() * @method Consumer setRejectedCallbackUrl() setRejectedCallbackUrl(string $rejectedCallbackUrl) */ -class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInterface +class Consumer extends \Magento\Model\AbstractModel implements ConsumerInterface { /** * @var \Magento\Url\Validator @@ -61,7 +61,7 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte * @param \Magento\Registry $registry * @param \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory * @param \Magento\Url\Validator $urlValidator - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte \Magento\Registry $registry, \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLengthFactory $keyLengthFactory, \Magento\Url\Validator $urlValidator, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -115,10 +115,10 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte $this->setRejectedCallbackUrl(trim($this->getRejectedCallbackUrl())); if ($this->getCallbackUrl() && !$this->_urlValidator->isValid($this->getCallbackUrl())) { - throw new \Magento\Core\Exception(__('Invalid Callback URL')); + throw new \Magento\Model\Exception(__('Invalid Callback URL')); } if ($this->getRejectedCallbackUrl() && !$this->_urlValidator->isValid($this->getRejectedCallbackUrl())) { - throw new \Magento\Core\Exception(__('Invalid Rejected Callback URL')); + throw new \Magento\Model\Exception(__('Invalid Rejected Callback URL')); } } @@ -130,14 +130,14 @@ class Consumer extends \Magento\Core\Model\AbstractModel implements ConsumerInte $validatorLength->setName('Consumer Key'); if (!$validatorLength->isValid($this->getKey())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Core\Exception(array_shift($messages)); + throw new \Magento\Model\Exception(array_shift($messages)); } $validatorLength->setLength(\Magento\Oauth\Helper\Oauth::LENGTH_CONSUMER_SECRET); $validatorLength->setName('Consumer Secret'); if (!$validatorLength->isValid($this->getSecret())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Core\Exception(array_shift($messages)); + throw new \Magento\Model\Exception(array_shift($messages)); } return true; } diff --git a/app/code/Magento/Integration/Model/Oauth/Nonce.php b/app/code/Magento/Integration/Model/Oauth/Nonce.php index d6109360d5a9ca8e297e8cae6ccc5cbaa867f37e..14e02893a44c38b521fe2da774ac2229b8392e1c 100644 --- a/app/code/Magento/Integration/Model/Oauth/Nonce.php +++ b/app/code/Magento/Integration/Model/Oauth/Nonce.php @@ -35,7 +35,7 @@ namespace Magento\Integration\Model\Oauth; * @method \Magento\Integration\Model\Resource\Oauth\Nonce getResource() * @method \Magento\Integration\Model\Resource\Oauth\Nonce _getResource() */ -class Nonce extends \Magento\Core\Model\AbstractModel +class Nonce extends \Magento\Model\AbstractModel { /** * Oauth data @@ -48,7 +48,7 @@ class Nonce extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Integration\Helper\Oauth\Data $oauthData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -56,7 +56,7 @@ class Nonce extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Integration\Helper\Oauth\Data $oauthData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php index ce203eb2d496fe3d3dc239480ba6913d6ed87383..297c747d69b0ebb0634c11ddf09441f2cb754788 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Oauth/Token.php @@ -57,7 +57,7 @@ use Magento\Oauth\Exception as OauthException; * @method Token setAuthorized() setAuthorized(int $authorized) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Token extends \Magento\Core\Model\AbstractModel +class Token extends \Magento\Model\AbstractModel { /**#@+ * Token types @@ -120,7 +120,7 @@ class Token extends \Magento\Core\Model\AbstractModel * @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory * @param \Magento\Integration\Helper\Oauth\Data $oauthData * @param OauthHelper $oauthHelper - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -134,7 +134,7 @@ class Token extends \Magento\Core\Model\AbstractModel \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory, \Magento\Integration\Helper\Oauth\Data $oauthData, OauthHelper $oauthHelper, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Integration/Model/Resource/Integration.php b/app/code/Magento/Integration/Model/Resource/Integration.php index fdd2563ca796a2169a003bc1ca36a1b1f7fa6ccd..6a302dc675783c28a766883642f401bb19a6bdd1 100644 --- a/app/code/Magento/Integration/Model/Resource/Integration.php +++ b/app/code/Magento/Integration/Model/Resource/Integration.php @@ -26,7 +26,7 @@ namespace Magento\Integration\Model\Resource; /** * Integration resource model */ -class Integration extends \Magento\Core\Model\Resource\Db\AbstractDb +class Integration extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model diff --git a/app/code/Magento/Integration/Model/Resource/Integration/Collection.php b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php index fce8300e2f9cd66e6f31dfc4a266a78cf65f81b9..c22f6dd25fd822d02e521a18d23d54dd41e70924 100644 --- a/app/code/Magento/Integration/Model/Resource/Integration/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Integration/Collection.php @@ -26,7 +26,7 @@ namespace Magento\Integration\Model\Resource\Integration; /** * Integrations collection. */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource collection initialization. diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php index 3ea3130308d3543a59e7d78113327533658c4559..f8f12fc2a4157ce06cd2b48264eacf8fd129a3b7 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer.php @@ -23,7 +23,7 @@ */ namespace Magento\Integration\Model\Resource\Oauth; -class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Consumer extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -53,10 +53,10 @@ class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set updated_at automatically before saving * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->_dateTime->formatDate(time())); return parent::_beforeSave($object); @@ -65,10 +65,10 @@ class Consumer extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete all Nonce entries associated with the consumer * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _afterDelete(\Magento\Core\Model\AbstractModel $object) + public function _afterDelete(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $adapter->delete($this->getTable('oauth_nonce'), array('consumer_id' => $object->getId())); diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php index c1b681528671d5a3a3d7f390a49427568d9688b2..d99e21f05726b3c247d40ed2cda8c4404cee25ca 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Consumer/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Consumer; * @package Magento_Oauth * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php index 81859acc0c8509543f423ab9495bfee1dc8f0409..9f2772e216777adc2e103ed500ba19d7b396a0d0 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce.php @@ -30,7 +30,7 @@ namespace Magento\Integration\Model\Resource\Oauth; * * @author Magento Core Team <core@magentocommerce.com> */ -class Nonce extends \Magento\Core\Model\Resource\Db\AbstractDb +class Nonce extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize resource model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php index 028c66ae0517b89e423badb7cae68a086b35c7b9..a42f2c70256ff217d724636f8aa08151b6bc9d48 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Nonce/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Nonce; * @package Magento_Oauth * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php index 2a83cc4466db5a90da53844ddaf74496693e319e..97c600e34feef29ea230d97f62ab836b1d241991 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Token.php @@ -28,7 +28,7 @@ namespace Magento\Integration\Model\Resource\Oauth; /** * OAuth token resource model */ -class Token extends \Magento\Core\Model\Resource\Db\AbstractDb +class Token extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -59,13 +59,13 @@ class Token extends \Magento\Core\Model\Resource\Db\AbstractDb * Clean up old authorized tokens for specified consumer-user pairs * * @param \Magento\Integration\Model\Oauth\Token $exceptToken Token just created to exclude from delete - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return int The number of affected rows */ public function cleanOldAuthorizedTokensExcept(\Magento\Integration\Model\Oauth\Token $exceptToken) { if (!$exceptToken->getId() || !$exceptToken->getAuthorized()) { - throw new \Magento\Core\Exception('Invalid token to except'); + throw new \Magento\Model\Exception('Invalid token to except'); } $adapter = $this->_getWriteAdapter(); $where = $adapter->quoteInto( @@ -80,7 +80,7 @@ class Token extends \Magento\Core\Model\Resource\Db\AbstractDb } elseif ($exceptToken->getAdminId()) { $where .= $adapter->quoteInto(' AND admin_id = ?', $exceptToken->getAdminId(), \Zend_Db::INT_TYPE); } else { - throw new \Magento\Core\Exception('Invalid token to except'); + throw new \Magento\Model\Exception('Invalid token to except'); } return $adapter->delete($this->getMainTable(), $where); } diff --git a/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php b/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php index a7ce3f76f1050c1ddd6a134632896959140119b4..f9133ec5a0c783de48b7a0dc80354af289752609 100644 --- a/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php +++ b/app/code/Magento/Integration/Model/Resource/Oauth/Token/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Integration\Model\Resource\Oauth\Token; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize collection model diff --git a/app/code/Magento/Integration/Service/OauthV1.php b/app/code/Magento/Integration/Service/OauthV1.php index 812f505509001aa0721342953b1f9f5836381b13..7f88cfdf9f78a1191dedf48133d404e63b1cdd3a 100644 --- a/app/code/Magento/Integration/Service/OauthV1.php +++ b/app/code/Magento/Integration/Service/OauthV1.php @@ -123,7 +123,7 @@ class OauthV1 implements OauthV1Interface $consumer = $this->_consumerFactory->create($consumerData); $consumer->save(); return $consumer; - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to create oAuth consumer account.')); @@ -178,7 +178,7 @@ class OauthV1 implements OauthV1Interface { try { return $this->_consumerFactory->create()->load($consumerId); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); @@ -192,7 +192,7 @@ class OauthV1 implements OauthV1Interface { try { return $this->_consumerFactory->create()->load($key, 'key'); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Exception $exception) { throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); @@ -229,7 +229,7 @@ class OauthV1 implements OauthV1Interface $this->_httpClient->setConfig(array('maxredirects' => $maxredirects, 'timeout' => $timeout)); $this->_httpClient->request(\Magento\HTTP\ZendClient::POST); return $verifier->getVerifier(); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { throw $exception; } catch (\Magento\Oauth\Exception $exception) { throw $exception; diff --git a/app/code/Magento/Integration/Service/OauthV1Interface.php b/app/code/Magento/Integration/Service/OauthV1Interface.php index 330ba6af66198147a33c39e8d1455ceedf8703a8..763dfd87125f662ece081a4c394ec3821ace7048 100644 --- a/app/code/Magento/Integration/Service/OauthV1Interface.php +++ b/app/code/Magento/Integration/Service/OauthV1Interface.php @@ -41,7 +41,7 @@ interface OauthV1Interface * ) * </pre> * @return \Magento\Integration\Model\Oauth\Consumer - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Oauth\Exception */ public function createConsumer($consumerData); @@ -69,7 +69,7 @@ interface OauthV1Interface * @param int $consumerId * @return \Magento\Integration\Model\Oauth\Consumer * @throws \Magento\Oauth\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadConsumer($consumerId); @@ -79,7 +79,7 @@ interface OauthV1Interface * @param string $key * @return \Magento\Integration\Model\Oauth\Consumer * @throws \Magento\Oauth\Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function loadConsumerByKey($key); @@ -89,7 +89,7 @@ interface OauthV1Interface * @param int $consumerId - The consumer Id. * @param string $endpointUrl - The integration endpoint Url (for HTTP Post) * @return string - The oauth_verifier. - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Oauth\Exception */ public function postToConsumer($consumerId, $endpointUrl); diff --git a/app/code/Magento/Log/App/Shell.php b/app/code/Magento/Log/App/Shell.php index 469aa8f4e863fe6c61a301449f48f753942da859..1cd2bfee5f8bc36dffefaa672b54b270b4bd6ce6 100644 --- a/app/code/Magento/Log/App/Shell.php +++ b/app/code/Magento/Log/App/Shell.php @@ -26,9 +26,9 @@ namespace Magento\Log\App; use Magento\App\Console\Response; -use Magento\LauncherInterface; +use Magento\AppInterface; -class Shell implements LauncherInterface +class Shell implements AppInterface { /** * Filename of the entry point script diff --git a/app/code/Magento/Log/Model/Aggregation.php b/app/code/Magento/Log/Model/Aggregation.php index 1d1045e9fcb4c77f4fdf9edc9b061b20a3372b53..30e8fa28c313c619a6c7350858ac7e5d51128f82 100644 --- a/app/code/Magento/Log/Model/Aggregation.php +++ b/app/code/Magento/Log/Model/Aggregation.php @@ -35,7 +35,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Aggregation extends \Magento\Core\Model\AbstractModel +class Aggregation extends \Magento\Model\AbstractModel { /** * Last record data @@ -53,7 +53,7 @@ class Aggregation extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -61,7 +61,7 @@ class Aggregation extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/Model/Cron.php b/app/code/Magento/Log/Model/Cron.php index f83f6c946e9e1f418fdcf3967345de57481b08f5..70d35de7b6af643b441e53b984397845664d4066 100644 --- a/app/code/Magento/Log/Model/Cron.php +++ b/app/code/Magento/Log/Model/Cron.php @@ -34,7 +34,7 @@ */ namespace Magento\Log\Model; -class Cron extends \Magento\Core\Model\AbstractModel +class Cron extends \Magento\Model\AbstractModel { const XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE = 'system/log/error_email_template'; @@ -58,11 +58,6 @@ class Cron extends \Magento\Core\Model\AbstractModel */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Core\Model\StoreManagerInterface */ @@ -78,15 +73,20 @@ class Cron extends \Magento\Core\Model\AbstractModel */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Log\Model\Log $log + * @param Log $log * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\TranslateInterface $translate * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,17 +96,17 @@ class Cron extends \Magento\Core\Model\AbstractModel \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Log\Model\Log $log, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\TranslateInterface $translate, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_transportBuilder = $transportBuilder; $this->_log = $log; $this->_storeManager = $storeManager; - $this->_translate = $translate; $this->_coreStoreConfig = $coreStoreConfig; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -124,7 +124,7 @@ class Cron extends \Magento\Core\Model\AbstractModel return $this; } - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $transport = $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_EMAIL_LOG_CLEAN_TEMPLATE) @@ -143,7 +143,8 @@ class Cron extends \Magento\Core\Model\AbstractModel $transport->sendMessage(); - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); + return $this; } diff --git a/app/code/Magento/Log/Model/Customer.php b/app/code/Magento/Log/Model/Customer.php index 10e696e194338174a94a2b9a3a1d780ca2d02559..ea6b708d270a8b7c543a38363591b368903219a0 100644 --- a/app/code/Magento/Log/Model/Customer.php +++ b/app/code/Magento/Log/Model/Customer.php @@ -45,7 +45,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime @@ -56,7 +56,7 @@ class Customer extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -64,7 +64,7 @@ class Customer extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -86,16 +86,12 @@ class Customer extends \Magento\Core\Model\AbstractModel /** * Load last log by customer id * - * @param \Magento\Customer\Model\Customer|int $customer - * @return $this + * @param int $customerId + * @return \Magento\Log\Model\Customer */ - public function loadByCustomer($customer) + public function loadByCustomer($customerId) { - if ($customer instanceof \Magento\Customer\Model\Customer) { - $customer = $customer->getId(); - } - - return $this->load($customer, 'customer_id'); + return $this->load($customerId, 'customer_id'); } /** diff --git a/app/code/Magento/Log/Model/Log.php b/app/code/Magento/Log/Model/Log.php index fe636fd63416084d279ad2ca0f9894af57389556..a523909587293552bc7751b05404047b47194e0a 100644 --- a/app/code/Magento/Log/Model/Log.php +++ b/app/code/Magento/Log/Model/Log.php @@ -45,7 +45,7 @@ namespace Magento\Log\Model; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\AbstractModel +class Log extends \Magento\Model\AbstractModel { const XML_LOG_CLEAN_DAYS = 'system/log/clean_after_day'; @@ -60,7 +60,7 @@ class Log extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -68,7 +68,7 @@ class Log extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/Model/Resource/Aggregation.php b/app/code/Magento/Log/Model/Resource/Aggregation.php index fe2f10ae40ef70a93eb32441a2e6a1b520f9a124..c7adfb74fcf351f9177917a3df5760bf51f2af57 100644 --- a/app/code/Magento/Log/Model/Resource/Aggregation.php +++ b/app/code/Magento/Log/Model/Resource/Aggregation.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Aggregation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Aggregation extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Log/Model/Resource/Customer.php b/app/code/Magento/Log/Model/Resource/Customer.php index da432d4a137fa2d3f88ea8f34dcfdbf9dd0c98e7..d4139cf3043339c1bba15340eb23e1231648c022 100644 --- a/app/code/Magento/Log/Model/Resource/Customer.php +++ b/app/code/Magento/Log/Model/Resource/Customer.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Customer extends \Magento\Model\Resource\Db\AbstractDb { /** * Visitor data table name diff --git a/app/code/Magento/Log/Model/Resource/Helper.php b/app/code/Magento/Log/Model/Resource/Helper.php index b562e5a13a3406b66ee6beff34104435dce60da2..7fa5ce2d0a0e9ddedba84c41ef8f2cfe90b86e34 100644 --- a/app/code/Magento/Log/Model/Resource/Helper.php +++ b/app/code/Magento/Log/Model/Resource/Helper.php @@ -33,7 +33,7 @@ */ namespace Magento\Log\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper +class Helper extends \Magento\DB\Helper { /** * Returns information about table in DB diff --git a/app/code/Magento/Log/Model/Resource/Log.php b/app/code/Magento/Log/Model/Resource/Log.php index 771b2e8af71001fc906bb0a90e9cbaf65e024bba..218a5bc0bc040848fa791a62660c06335151006b 100644 --- a/app/code/Magento/Log/Model/Resource/Log.php +++ b/app/code/Magento/Log/Model/Resource/Log.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Log extends \Magento\Core\Model\Resource\Db\AbstractDb +class Log extends \Magento\Model\Resource\Db\AbstractDb { /** * Core event manager proxy diff --git a/app/code/Magento/Log/Model/Resource/Shell.php b/app/code/Magento/Log/Model/Resource/Shell.php index 8789b4f57ddc1054c229d0eb49464b75cd0f96b2..4ca3dba3f5f321a72ba788a1bd120fc230670da5 100644 --- a/app/code/Magento/Log/Model/Resource/Shell.php +++ b/app/code/Magento/Log/Model/Resource/Shell.php @@ -41,17 +41,19 @@ class Shell protected $_resource; /** - * @var \Magento\Core\Model\Resource\HelperFactory + * @var \Magento\Log\Model\Resource\Helper */ - protected $_helperPool; + protected $_resourceHelper; /** - * @param \Magento\Core\Model\Resource\HelperPool $helperPool + * @param \Magento\Log\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource */ - public function __construct(\Magento\Core\Model\Resource\HelperPool $helperPool, \Magento\App\Resource $resource) - { - $this->_helperPool = $helperPool; + public function __construct( + \Magento\Log\Model\Resource\Helper $resourceHelper, + \Magento\App\Resource $resource + ) { + $this->_resourceHelper = $resourceHelper; $this->_resource = $resource; } @@ -75,10 +77,9 @@ class Shell 'catalog_compare_item' ); - $resHelper = $this->_helperPool->get('Magento_Log'); $result = array(); foreach ($tables as $table) { - $info = $resHelper->getTableInfo($this->_resource->getTableName($table)); + $info = $this->_resourceHelper->getTableInfo($this->_resource->getTableName($table)); if (!$info) { continue; } diff --git a/app/code/Magento/Log/Model/Resource/Visitor.php b/app/code/Magento/Log/Model/Resource/Visitor.php index 1cbcb931e0585f32ee6c44ec632c6ba5551a9348..fa093a98afaed05ea535d2a2e9020c0ed27fb78f 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor.php +++ b/app/code/Magento/Log/Model/Resource/Visitor.php @@ -28,7 +28,7 @@ namespace Magento\Log\Model\Resource; /** * Visitor log resource */ -class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb +class Visitor extends \Magento\Model\Resource\Db\AbstractDb { /** * Magento string lib @@ -78,10 +78,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $visitor) { return array( 'session_id' => $visitor->getSessionId(), @@ -119,10 +119,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save url info before save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _beforeSave(\Magento\Model\AbstractModel $visitor) { if (!$visitor->getIsNewVisitor()) { $this->_saveUrlInfo($visitor); @@ -133,10 +133,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after save * - * @param \Magento\Core\Model\AbstractModel $visitor + * @param \Magento\Model\AbstractModel $visitor * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $visitor) + protected function _afterSave(\Magento\Model\AbstractModel $visitor) { if ($visitor->getIsNewVisitor()) { $this->_saveVisitorInfo($visitor); @@ -156,10 +156,10 @@ class Visitor extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel|\Magento\Object $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { parent::_afterLoad($object); // Add information about quote to visitor diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Collection.php index 6971c61d61dd97a52d2fa0c895e8c22001f2e71b..ea1aae1a30ec3f7d453ecedc0d267c26e7bd96b3 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Visitor data table name @@ -180,7 +180,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * * @param boolean $printQuery * @param boolean $logQuery - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function load($printQuery = false, $logQuery = false) { diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online.php b/app/code/Magento/Log/Model/Resource/Visitor/Online.php index edfb4485262da5ea1af738b19e4527bfede0b839..c5102b3499cff15997a78b8123861635b325ec20 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online.php @@ -32,7 +32,7 @@ namespace Magento\Log\Model\Resource\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Online extends \Magento\Core\Model\Resource\Db\AbstractDb +class Online extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php index 50eb8e56f6e9c7de806d35e4531d8ca6eadb4e00..440793e197449741a03f9b366c00e1920ea7e235 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Collection.php @@ -25,6 +25,8 @@ */ namespace Magento\Log\Model\Resource\Visitor\Online; +use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; + /** * Log Online visitors collection * @@ -32,7 +34,7 @@ namespace Magento\Log\Model\Resource\Visitor\Online; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Joined fields array @@ -42,29 +44,29 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl protected $_fields = array(); /** - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Eav\Helper\Data */ - protected $_customerFactory; + protected $_eavHelper; /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Eav\Helper\Data $eavHelper * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Eav\Helper\Data $eavHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { - $this->_customerFactory = $customerFactory; + $this->_eavHelper = $eavHelper; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); } @@ -85,7 +87,6 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ public function addCustomerData() { - $customer = $this->_customerFactory->create(); // alias => attribute_code $attributes = array( 'customer_lastname' => 'lastname', @@ -94,37 +95,34 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl ); foreach ($attributes as $alias => $attributeCode) { - $attribute = $customer->getAttribute($attributeCode); - /* @var $attribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ - if ($attribute->getBackendType() == 'static') { - $tableAlias = 'customer_' . $attribute->getAttributeCode(); + $attribute = $this->_eavHelper->getAttributeMetadata( + CustomerMetadataServiceInterface::ENTITY_TYPE_CUSTOMER, + $attributeCode + ); + + $tableAlias = 'customer_' . $attributeCode; + if ($attribute['backend_type'] == 'static') { $this->getSelect()->joinLeft( - array($tableAlias => $attribute->getBackend()->getTable()), + array($tableAlias => $attribute['attribute_table']), sprintf('%s.entity_id=main_table.customer_id', $tableAlias), - array($alias => $attribute->getAttributeCode()) + array($alias => $attributeCode) ); - - $this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attribute->getAttributeCode()); + $this->_fields[$alias] = sprintf('%s.%s', $tableAlias, $attributeCode); } else { - $tableAlias = 'customer_' . $attribute->getAttributeCode(); - - $joinConds = array( + $joinConds = array( sprintf('%s.entity_id=main_table.customer_id', $tableAlias), - $this->getConnection()->quoteInto($tableAlias . '.attribute_id=?', $attribute->getAttributeId()) + $this->getConnection()->quoteInto($tableAlias . '.attribute_id=?', $attribute['attribute_id']) ); - $this->getSelect()->joinLeft( - array($tableAlias => $attribute->getBackend()->getTable()), + array($tableAlias => $attribute['attribute_table']), join(' AND ', $joinConds), array($alias => 'value') ); - $this->_fields[$alias] = sprintf('%s.value', $tableAlias); } } - $this->setFlag('has_customer_data', true); return $this; } diff --git a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php index 6c9e676e225c0ff7550d98fc0204190a2e491806..60e26ee91a811a6e3f0d83428aa7d26a6f514c51 100644 --- a/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php +++ b/app/code/Magento/Log/Model/Resource/Visitor/Online/Grid/Collection.php @@ -37,20 +37,20 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Eav\Helper\Data $eavHelper * @param \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Eav\Helper\Data $eavHelper, \Magento\Log\Model\Visitor\OnlineFactory $onlineFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_onlineFactory = $onlineFactory; parent::__construct( @@ -58,7 +58,7 @@ class Collection extends \Magento\Log\Model\Resource\Visitor\Online\Collection $logger, $fetchStrategy, $eventManager, - $customerFactory, + $eavHelper, $connection, $resource ); diff --git a/app/code/Magento/Log/Model/Visitor.php b/app/code/Magento/Log/Model/Visitor.php index 4797e58b3154c85fb6121d730856ed9200c9d35d..428fd2b2bde60459da213208bcc870af1aed4b37 100644 --- a/app/code/Magento/Log/Model/Visitor.php +++ b/app/code/Magento/Log/Model/Visitor.php @@ -37,7 +37,7 @@ namespace Magento\Log\Model; * @method int getStoreId() * @method \Magento\Log\Model\Visitor setStoreId(int $value) */ -class Visitor extends \Magento\Core\Model\AbstractModel +class Visitor extends \Magento\Model\AbstractModel { const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; @@ -89,11 +89,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel */ protected $_quoteFactory; - /** - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\HTTP\Header */ @@ -118,7 +113,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Sales\Model\QuoteFactory $quoteFactory * @param \Magento\Session\SessionManagerInterface $session * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -127,7 +121,8 @@ class Visitor extends \Magento\Core\Model\AbstractModel * @param \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress * @param \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Module\Manager $moduleManager + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $ignoredUserAgents * @param array $ignores @@ -137,7 +132,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Sales\Model\QuoteFactory $quoteFactory, \Magento\Session\SessionManagerInterface $session, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -146,14 +140,14 @@ class Visitor extends \Magento\Core\Model\AbstractModel \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress, \Magento\HTTP\PhpEnvironment\ServerAddress $serverAddress, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Module\Manager $moduleManager, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $ignoredUserAgents = array(), array $ignores = array(), array $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - $this->_customerFactory = $customerFactory; $this->_quoteFactory = $quoteFactory; $this->_session = $session; $this->_storeManager = $storeManager; @@ -409,28 +403,6 @@ class Visitor extends \Magento\Core\Model\AbstractModel return $this; } - /** - * Load customer data into $data - * - * @param object $data - * @return $this - */ - public function addCustomerData($data) - { - $customerId = $data->getCustomerId(); - if (intval($customerId) <= 0) { - return $this; - } - $customerData = $this->_customerFactory->create()->load($customerId); - $newCustomerData = array(); - foreach ($customerData->getData() as $propName => $propValue) { - $newCustomerData['customer_' . $propName] = $propValue; - } - - $data->addData($newCustomerData); - return $this; - } - /** * Load quote data into $data * diff --git a/app/code/Magento/Log/Model/Visitor/Online.php b/app/code/Magento/Log/Model/Visitor/Online.php index c1342b8fb7265789e646042bfbff4bc6c94938e0..d625224e73bb77ae93d6d02f6e40fd241b5d6fc0 100644 --- a/app/code/Magento/Log/Model/Visitor/Online.php +++ b/app/code/Magento/Log/Model/Visitor/Online.php @@ -46,7 +46,7 @@ namespace Magento\Log\Model\Visitor; * @package Magento_Log * @author Magento Core Team <core@magentocommerce.com> */ -class Online extends \Magento\Core\Model\AbstractModel +class Online extends \Magento\Model\AbstractModel { const XML_PATH_ONLINE_INTERVAL = 'customer/online_customers/online_minutes_interval'; @@ -63,7 +63,7 @@ class Online extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -71,7 +71,7 @@ class Online extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Log/etc/module.xml b/app/code/Magento/Log/etc/module.xml index 04ec2fc0a420dd153033d0094c44a880a3a40860..280e757c075795b52333a093dff42612ed58c7a3 100644 --- a/app/code/Magento/Log/etc/module.xml +++ b/app/code/Magento/Log/etc/module.xml @@ -32,6 +32,7 @@ <depends> <module name="Magento_Core"/> <module name="Magento_Customer"/> + <module name="Magento_Eav"/> <module name="Magento_Sales"/> <module name="Magento_Backend"/> </depends> diff --git a/app/code/Magento/Multishipping/Controller/Checkout.php b/app/code/Magento/Multishipping/Controller/Checkout.php index 0046d9c7cadc29194f475d789c3ba473c8ff5e56..de025198e8bd4bdcd48710ecc595f6d9bf7f45f2 100755 --- a/app/code/Magento/Multishipping/Controller/Checkout.php +++ b/app/code/Magento/Multishipping/Controller/Checkout.php @@ -280,7 +280,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements if ($shipToInfo = $this->getRequest()->getPost('ship')) { $this->_getCheckout()->setShippingItemsInformation($shipToInfo); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/addresses'); } catch (\Exception $e) { @@ -462,7 +462,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements $this->_view->loadLayout(); $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (\Exception $e) { @@ -530,7 +530,7 @@ class Checkout extends \Magento\Checkout\Controller\Action implements $this->_getCheckout()->getCheckoutSession()->clearQuote(); $this->messageManager->addError($e->getMessage()); $this->_redirect('*/cart'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get( 'Magento\Checkout\Helper\Data' )->sendPaymentFailedEmail( diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php index a742d2c8645d677c490e532f8e197067c62b5044..01e9dc342a04a369e8b5edaa7bd07e9377d2559d 100644 --- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php +++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php @@ -283,7 +283,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $info * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setShippingItemsInformation($info) { @@ -299,7 +299,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType $maxQty = $this->helper->getMaximumQty(); if ($allQty > $maxQty) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Maximum qty allowed for Shipping to multiple addresses is %1', $maxQty) ); } @@ -460,7 +460,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $methods * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setShippingMethods($methods) { @@ -469,7 +469,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType if (isset($methods[$address->getId()])) { $address->setShippingMethod($methods[$address->getId()]); } elseif (!$address->getShippingMethod()) { - throw new \Magento\Core\Exception(__('Please select shipping methods for all addresses.')); + throw new \Magento\Model\Exception(__('Please select shipping methods for all addresses.')); } } $this->save(); @@ -481,15 +481,15 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * * @param array $payment * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setPaymentMethod($payment) { if (!isset($payment['method'])) { - throw new \Magento\Core\Exception(__('Payment method is not defined')); + throw new \Magento\Model\Exception(__('Payment method is not defined')); } if (!$this->paymentSpecification->isSatisfiedBy($payment['method'])) { - throw new \Magento\Core\Exception(__('The requested Payment Method is not available for multishipping.')); + throw new \Magento\Model\Exception(__('The requested Payment Method is not available for multishipping.')); } $quote = $this->getQuote(); $quote->getPayment()->importData($payment); @@ -555,7 +555,7 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType * Validate quote data * * @return \Magento\Multishipping\Model\Checkout\Type\Multishipping - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { @@ -564,24 +564,24 @@ class Multishipping extends \Magento\Checkout\Model\Type\AbstractType /** @var $paymentMethod \Magento\Payment\Model\Method\AbstractMethod */ $paymentMethod = $quote->getPayment()->getMethodInstance(); if (!empty($paymentMethod) && !$paymentMethod->isAvailable($quote)) { - throw new \Magento\Core\Exception(__('Please specify a payment method.')); + throw new \Magento\Model\Exception(__('Please specify a payment method.')); } $addresses = $quote->getAllShippingAddresses(); foreach ($addresses as $address) { $addressValidation = $address->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception(__('Please check shipping addresses information.')); + throw new \Magento\Model\Exception(__('Please check shipping addresses information.')); } $method = $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$method || !$rate) { - throw new \Magento\Core\Exception(__('Please specify shipping methods for all addresses.')); + throw new \Magento\Model\Exception(__('Please specify shipping methods for all addresses.')); } } $addressValidation = $quote->getBillingAddress()->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception(__('Please check billing address information.')); + throw new \Magento\Model\Exception(__('Please check billing address information.')); } return $this; } diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php index ffe8f7ea7a995a37981ebbfd597106e596c71cf0..fe7d0f8b4ad8da5db7f1855953b28f3a4350d911 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber/Grid/Filter/Website.php @@ -59,7 +59,7 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select /** * @param \Magento\Backend\Block\Context $context - * @param \Magento\Core\Model\Resource\Helper $resourceHelper + * @param \Magento\DB\Helper $resourceHelper * @param \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Registry $registry @@ -67,7 +67,7 @@ class Website extends \Magento\Backend\Block\Widget\Grid\Column\Filter\Select */ public function __construct( \Magento\Backend\Block\Context $context, - \Magento\Core\Model\Resource\Helper $resourceHelper, + \Magento\DB\Helper $resourceHelper, \Magento\Core\Model\Resource\Website\CollectionFactory $websitesFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Registry $registry, diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php index 2403b4819e915565679aac86296618895ff83df7..796aca675add8bd0d8a44090af5d20dc34677cac 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Queue.php @@ -282,7 +282,7 @@ class Queue extends \Magento\Backend\App\Action /** * Save Newsletter queue * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function saveAction() @@ -297,7 +297,7 @@ class Queue extends \Magento\Backend\App\Action $template = $this->_objectManager->create('Magento\Newsletter\Model\Template')->load($templateId); if (!$template->getId() || $template->getIsSystem()) { - throw new \Magento\Core\Exception(__('Please correct the newsletter template and try again.')); + throw new \Magento\Model\Exception(__('Please correct the newsletter template and try again.')); } $queue->setTemplateId( @@ -351,7 +351,7 @@ class Queue extends \Magento\Backend\App\Action $this->_getSession()->setFormData(false); $this->_redirect('*/*'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $id = $this->getRequest()->getParam('id'); if ($id) { diff --git a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php index a6a439f06f6a8e88ad86608cef2d3005c310c6e5..95924c54debaadb427ed98ec63fa08f7d1341e46 100644 --- a/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php +++ b/app/code/Magento/Newsletter/Controller/Adminhtml/Template.php @@ -227,7 +227,7 @@ class Template extends \Magento\Backend\App\Action $this->_redirect('*/template'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError(nl2br($e->getMessage())); $this->_getSession()->setData('newsletter_template_form_data', $this->getRequest()->getParams()); } catch (\Exception $e) { @@ -255,7 +255,7 @@ class Template extends \Magento\Backend\App\Action $template->delete(); $this->messageManager->addSuccess(__('The newsletter template has been deleted.')); $this->_getSession()->setFormData(false); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while deleting this template.')); diff --git a/app/code/Magento/Newsletter/Controller/Subscriber.php b/app/code/Magento/Newsletter/Controller/Subscriber.php index 074a2777f40758acdeaf7661b63d243a3d044535..1392bf2dfca2a5cb1a9a2a26752b250f6f1033ac 100644 --- a/app/code/Magento/Newsletter/Controller/Subscriber.php +++ b/app/code/Magento/Newsletter/Controller/Subscriber.php @@ -95,7 +95,7 @@ class Subscriber extends \Magento\App\Action\Action /** * New subscription action * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function newAction() @@ -105,7 +105,7 @@ class Subscriber extends \Magento\App\Action\Action try { if (!\Zend_Validate::is($email, 'EmailAddress')) { - throw new \Magento\Core\Exception(__('Please enter a valid email address.')); + throw new \Magento\Model\Exception(__('Please enter a valid email address.')); } if ($this->_objectManager->get( @@ -114,7 +114,7 @@ class Subscriber extends \Magento\App\Action\Action \Magento\Newsletter\Model\Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG ) != 1 && !$this->_customerSession->isLoggedIn() ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but the administrator denied subscription for guests. ' . 'Please <a href="%1">register</a>.', @@ -129,7 +129,7 @@ class Subscriber extends \Magento\App\Action\Action $email )->getId(); if ($ownerId !== null && $ownerId != $this->_customerSession->getId()) { - throw new \Magento\Core\Exception(__('This email address is already assigned to another user.')); + throw new \Magento\Model\Exception(__('This email address is already assigned to another user.')); } $status = $this->_subscriberFactory->create()->subscribe($email); @@ -138,7 +138,7 @@ class Subscriber extends \Magento\App\Action\Action } else { $this->messageManager->addSuccess(__('Thank you for your subscription.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addException( $e, __('There was a problem with the subscription: %1', $e->getMessage()) @@ -190,7 +190,7 @@ class Subscriber extends \Magento\App\Action\Action try { $this->_subscriberFactory->create()->load($id)->setCheckCode($code)->unsubscribe(); $this->messageManager->addSuccess(__('You have been unsubscribed.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addException($e, $e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong with the un-subscription.')); diff --git a/app/code/Magento/Newsletter/Model/Problem.php b/app/code/Magento/Newsletter/Model/Problem.php index d6f3d4cd470b95e81ce60f70173357273b0fb9de..afe21d0abf45323d3fc2d83c490f8511e968b0fb 100644 --- a/app/code/Magento/Newsletter/Model/Problem.php +++ b/app/code/Magento/Newsletter/Model/Problem.php @@ -43,7 +43,7 @@ namespace Magento\Newsletter\Model; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Problem extends \Magento\Core\Model\AbstractModel +class Problem extends \Magento\Model\AbstractModel { /** * Current Subscriber @@ -65,7 +65,7 @@ class Problem extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -73,7 +73,7 @@ class Problem extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php index 09f8820d6e5ad7bbcb665f04d4aa9f98b9965e51..8fd107795ebf24fea87fba644d699d4b5aaa77ac 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Grid/Collection.php @@ -39,7 +39,7 @@ class Collection extends \Magento\Newsletter\Model\Resource\Problem\Collection /** * Adds queue info to grid * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection|\Magento\Newsletter\Model\Resource\Grid\Collection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection|\Magento\Newsletter\Model\Resource\Grid\Collection */ protected function _initSelect() { diff --git a/app/code/Magento/Newsletter/Model/Resource/Problem.php b/app/code/Magento/Newsletter/Model/Resource/Problem.php index b52a02d6a442bc99c979382cdf71ce84f2f2543a..4372fe715b93e4f65424986a99f30ba1d452ac38 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Problem.php +++ b/app/code/Magento/Newsletter/Model/Resource/Problem.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Problem extends \Magento\Core\Model\Resource\Db\AbstractDb +class Problem extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php index 5f73363936453abf24c3fdc354faaef26b6c58c2..8f2a95f631ab05b90bfb574e10e5705be833d6f4 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Problem/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Newsletter\Model\Resource\Problem; * * @SuppressWarnings(PHPMD.LongVariable) */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * True when subscribers info joined @@ -60,7 +60,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -69,7 +69,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerCollectionFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_customerCollectionFactory = $customerCollectionFactory; diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue.php b/app/code/Magento/Newsletter/Model/Resource/Queue.php index 2b4dda041da49c2cbde41f1b84beee9f716c276a..025d08b3f5f468821264e710ded36ce93c7ea34f 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue.php @@ -26,7 +26,7 @@ namespace Magento\Newsletter\Model\Resource; use Magento\Newsletter\Model\Queue as ModelQueue; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Newsletter queue resource model @@ -35,7 +35,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Queue extends \Magento\Core\Model\Resource\Db\AbstractDb +class Queue extends \Magento\Model\Resource\Db\AbstractDb { /** * Subscriber collection @@ -74,16 +74,16 @@ class Queue extends \Magento\Core\Model\Resource\Db\AbstractDb * @param ModelQueue $queue * @param array $subscriberIds * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addSubscribersToQueue(ModelQueue $queue, array $subscriberIds) { if (count($subscriberIds) == 0) { - throw new \Magento\Core\Exception(__('There are no subscribers selected.')); + throw new \Magento\Model\Exception(__('There are no subscribers selected.')); } if (!$queue->getId() && $queue->getQueueStatus() != Magento_Newsletter_Model_Queue::STATUS_NEVER) { - throw new \Magento\Core\Exception(__('You selected an invalid queue.')); + throw new \Magento\Model\Exception(__('You selected an invalid queue.')); } $adapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php index 4d8c89c6ccf158adabedd050dd497ba539a2aa72..879ff3bca7f36817fd99b58343fb7d296ff7b6fe 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Queue/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource\Queue; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * True when subscribers info joined @@ -62,7 +62,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -71,7 +71,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime\DateTime $date, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_date = $date; diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php index 78e89e550dcd79ca550a5fbf7f6a8f20ded952a3..3c82cf898f847c2143c2c1841adb37ae78480f67 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb +class Subscriber extends \Magento\Model\Resource\Db\AbstractDb { /** * DB read connection @@ -178,7 +178,7 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb * @param \Magento\Newsletter\Model\Subscriber $subscriber * @param \Magento\Newsletter\Model\Queue $queue * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function received(\Magento\Newsletter\Model\Subscriber $subscriber, \Magento\Newsletter\Model\Queue $queue) { @@ -193,7 +193,7 @@ class Subscriber extends \Magento\Core\Model\Resource\Db\AbstractDb $this->_write->commit(); } catch (\Exception $e) { $this->_write->rollBack(); - throw new \Magento\Core\Exception(__('We cannot mark as received subscriber.')); + throw new \Magento\Model\Exception(__('We cannot mark as received subscriber.')); } return $this; } diff --git a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php index 8e0647f0f2072bf32f929dd26809e6d4e150dc46..0788cf15b8f4e8c3202459c31017fdf3713535df 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Subscriber/Collection.php @@ -34,7 +34,7 @@ use Magento\Newsletter\Model\Queue as ModelQueue; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Queue link table name @@ -85,7 +85,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param null|\Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -94,7 +94,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\CustomerFactory $customerFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { // _customerFactory is used in parent class constructor $this->_customerFactory = $customerFactory; diff --git a/app/code/Magento/Newsletter/Model/Resource/Template.php b/app/code/Magento/Newsletter/Model/Resource/Template.php index 2c8d4d843acdebfe8764c50f06164ba5185b21a1..08eaf75852feb872947ce57282da877499f41223 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Template.php +++ b/app/code/Magento/Newsletter/Model/Resource/Template.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Template extends \Magento\Core\Model\Resource\Db\AbstractDb +class Template extends \Magento\Model\Resource\Db\AbstractDb { /** * Date @@ -153,14 +153,14 @@ class Template extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if ($this->checkCodeUsage($object)) { - throw new \Magento\Core\Exception(__('Duplicate template code')); + throw new \Magento\Model\Exception(__('Duplicate template code')); } if (!$object->hasTemplateActual()) { diff --git a/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php b/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php index 54415b79ced59a43439ca89297fb602f9400cbc0..f6a6ed7723eb077a117afa7ac60da57a378d1c64 100644 --- a/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php +++ b/app/code/Magento/Newsletter/Model/Resource/Template/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Newsletter\Model\Resource\Template; * @package Magento_Newsletter * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model and model diff --git a/app/code/Magento/Newsletter/Model/Subscriber.php b/app/code/Magento/Newsletter/Model/Subscriber.php index 9fadd61505885242337c23aa228dadd54e05c7eb..d3b6d0b91f911e7531644d5761e670bf646ff5bb 100644 --- a/app/code/Magento/Newsletter/Model/Subscriber.php +++ b/app/code/Magento/Newsletter/Model/Subscriber.php @@ -43,7 +43,7 @@ namespace Magento\Newsletter\Model; * @method int getSubscriberId() * @method Subscriber setSubscriberId(int $value) */ -class Subscriber extends \Magento\Core\Model\AbstractModel +class Subscriber extends \Magento\Model\AbstractModel { const STATUS_SUBSCRIBED = 1; @@ -113,13 +113,6 @@ class Subscriber extends \Magento\Core\Model\AbstractModel */ protected $_customerSession; - /** - * Translate - * - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * Store manager * @@ -140,8 +133,11 @@ class Subscriber extends \Magento\Core\Model\AbstractModel protected $_transportBuilder; /** - * Construct - * + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Newsletter\Helper\Data $newsletterData @@ -149,9 +145,9 @@ class Subscriber extends \Magento\Core\Model\AbstractModel * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\TranslateInterface $translate * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -163,20 +159,20 @@ class Subscriber extends \Magento\Core\Model\AbstractModel \Magento\Mail\Template\TransportBuilder $transportBuilder, \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\TranslateInterface $translate, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_newsletterData = $newsletterData; $this->_coreStoreConfig = $coreStoreConfig; $this->_transportBuilder = $transportBuilder; $this->_customerFactory = $customerFactory; $this->_storeManager = $storeManager; - $this->_translate = $translate; $this->_customerSession = $customerSession; + $this->inlineTranslation = $inlineTranslation; + parent::__construct($context, $registry, $resource, $resourceCollection, $data); } /** @@ -467,13 +463,13 @@ class Subscriber extends \Magento\Core\Model\AbstractModel /** * Unsubscribes loaded subscription * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function unsubscribe() { if ($this->hasCheckCode() && $this->getCode() != $this->getCheckCode()) { - throw new \Magento\Core\Exception(__('This is an invalid subscription confirmation code.')); + throw new \Magento\Model\Exception(__('This is an invalid subscription confirmation code.')); } $this->setSubscriberStatus(self::STATUS_UNSUBSCRIBED)->save(); @@ -625,8 +621,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_CONFIRM_EMAIL_TEMPLATE) @@ -646,7 +641,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } @@ -670,8 +666,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_SUCCESS_EMAIL_TEMPLATE) @@ -691,7 +686,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } @@ -714,8 +710,7 @@ class Subscriber extends \Magento\Core\Model\AbstractModel return $this; } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_UNSUBSCRIBE_EMAIL_TEMPLATE) @@ -735,7 +730,8 @@ class Subscriber extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translate->setTranslateInline($translate); + $this->inlineTranslation->resume(); + return $this; } diff --git a/app/code/Magento/Newsletter/Model/Template.php b/app/code/Magento/Newsletter/Model/Template.php index d539fe7c3555051604dfedb826bb0618f8d80d77..d89072784581a7d32b20f8cc594240abc8fa2293 100644 --- a/app/code/Magento/Newsletter/Model/Template.php +++ b/app/code/Magento/Newsletter/Model/Template.php @@ -160,7 +160,7 @@ class Template extends \Magento\Core\Model\Template * Validate Newsletter template * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { @@ -188,7 +188,7 @@ class Template extends \Magento\Core\Model\Template } } - throw new \Magento\Core\Exception(join("\n", $errorMessages)); + throw new \Magento\Model\Exception(join("\n", $errorMessages)); } } diff --git a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php index 00a4105295d8d3cdad80743e23f58ca450501b8d..0195e5200f22cd9292ba088c46289d6c2fb2696a 100644 --- a/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Config/Backend/Tablerate.php @@ -23,7 +23,7 @@ */ namespace Magento\OfflineShipping\Model\Config\Backend; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Backend model for shipping table rates CSV importing @@ -43,7 +43,7 @@ class Tablerate extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class Tablerate extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\OfflineShipping\Model\Resource\Carrier\TablerateFactory $tablerateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php index 9bdbdfb47e2d7522eb8baab229250ca4e98423ac..dcc235bacf7ec321729f4ce5d6e261e00a06e600 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate.php @@ -31,7 +31,7 @@ */ namespace Magento\OfflineShipping\Model\Resource\Carrier; -class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tablerate extends \Magento\Model\Resource\Db\AbstractDb { /** * Import table rates website ID @@ -254,7 +254,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb * Upload table rate file and import data from it * * @param \Magento\Object $object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\OfflineShipping\Model\Resource\Carrier\Tablerate * @todo: this method should be refactored as soon as updated design will be provided * @see https://wiki.corp.x.com/display/MCOMS/Magento+Filesystem+Decisions @@ -281,7 +281,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb $headers = $stream->readCsv(); if ($headers === false || count($headers) < 5) { $stream->close(); - throw new \Magento\Core\Exception(__('Please correct Table Rates File Format.')); + throw new \Magento\Model\Exception(__('Please correct Table Rates File Format.')); } if ($object->getData('groups/tablerate/fields/condition_name/inherit') == '1') { @@ -327,15 +327,15 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb } $this->_saveImportData($importData); $stream->close(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $adapter->rollback(); $stream->close(); - throw new \Magento\Core\Exception($e->getMessage()); + throw new \Magento\Model\Exception($e->getMessage()); } catch (\Exception $e) { $adapter->rollback(); $stream->close(); $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('Something went wrong while importing table rates.')); + throw new \Magento\Model\Exception(__('Something went wrong while importing table rates.')); } $adapter->commit(); @@ -345,7 +345,7 @@ class Tablerate extends \Magento\Core\Model\Resource\Db\AbstractDb 'We couldn\'t import this file because of these errors: %1', implode(" \n", $this->_importErrors) ); - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } return $this; diff --git a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php index d22f6d015f645af7cba90697ab19a9e961f8fa72..a854a890e3e72fe57008d11367a7f653a7c615b6 100644 --- a/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php +++ b/app/code/Magento/OfflineShipping/Model/Resource/Carrier/Tablerate/Collection.php @@ -28,7 +28,7 @@ namespace Magento\OfflineShipping\Model\Resource\Carrier\Tablerate; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Directory/country table name diff --git a/app/code/Magento/Ogone/Controller/Api.php b/app/code/Magento/Ogone/Controller/Api.php index 1f34dbf0b9d9474685a59d7568a708b92be576da..05695d9952b0efe08a050e61eaba31f8a6761a8d 100644 --- a/app/code/Magento/Ogone/Controller/Api.php +++ b/app/code/Magento/Ogone/Controller/Api.php @@ -45,18 +45,18 @@ class Api extends \Magento\App\Action\Action protected $_salesOrderFactory; /** - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; /** * @param \Magento\App\Action\Context $context - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\OrderFactory $salesOrderFactory */ public function __construct( \Magento\App\Action\Context $context, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, \Magento\Sales\Model\OrderFactory $salesOrderFactory ) { parent::__construct($context); diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php index daf7ed6a83e61e956364911226af08bd8531bfc8..f4c1fadeafc10c2f1195ce5ccd808f3fb2b49d93 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Ttl.php @@ -35,14 +35,14 @@ class Ttl extends \Magento\Core\Model\Config\Value /** * Throw exception if Ttl data is invalid or empty * - * @return $this|\Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return $this + * @throws \Magento\Model\Exception */ protected function _beforeSave() { $value = $this->getValue(); if ($value < 0 || !preg_match('/^[0-9]+$/', $value)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Ttl value "%1" is not valid. Please use only numbers equal or greater than zero.', $value) ); } diff --git a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php index c42748f82ecd50cd43f6e89a1b43eb60e05dd1d5..33574f73886e3072a8aa2c01b27993a8d48a39c6 100644 --- a/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php +++ b/app/code/Magento/PageCache/Model/System/Config/Backend/Varnish.php @@ -39,8 +39,8 @@ class Varnish extends \Magento\Core\Model\Config\Value /** * Set default data if empty fields have been left * - * @return $this|\Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return $this|\Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -69,7 +69,7 @@ class Varnish extends \Magento\Core\Model\Config\Value /** * If fields are empty fill them with default data * - * @return $this|\Magento\Core\Model\AbstractModel + * @return $this|\Magento\Model\AbstractModel */ protected function _afterLoad() { diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php b/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php index 2c2c438a8cca095aee6c5def6d285aba0437310d..89eb59b78e93d8bc7fe35b30e16e0be387f08355 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Api/Nvp.php @@ -125,7 +125,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * SetExpressCheckout call * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @link https://cms.paypal.com/us/cgi-bin/?&cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout * TODO: put together style and giropay settings */ @@ -156,7 +156,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp foreach ($payments as $payment) { $payment->setMethodCode(\Magento\Paypal\Model\Config::METHOD_WPP_EXPRESS); if (!$payment->isValid()) { - throw new \Magento\Core\Exception($payment->getValidationErrors()); + throw new \Magento\Model\Exception($payment->getValidationErrors()); } $request["L_BILLINGTYPE{$i}"] = 'RecurringPayments'; $request["L_BILLINGAGREEMENTDESCRIPTION{$i}"] = $payment->getScheduleDescription(); @@ -223,7 +223,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * ManageRecurringPaymentStatus call * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function callManageRecurringPaymentStatus() { @@ -233,7 +233,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp } try { $this->call('ManageRecurringPaymentsProfileStatus', $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (in_array( 11556, $this->_callErrors @@ -245,7 +245,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp $this->_callErrors ) && 'Reactivate' === $request['ACTION'] ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We can\'t change the status because the current status doesn\'t match the real status.') ); } diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Express.php b/app/code/Magento/PayPalRecurringPayment/Model/Express.php index 21eab4d0d021f9c349404e3f7d2316d680369146..319f97d30791ffdb4b48bb230810847395a44d1a 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Express.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Express.php @@ -59,7 +59,7 @@ class Express implements ManagerInterface * * @param RecurringPayment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(RecurringPayment $payment) { @@ -81,7 +81,7 @@ class Express implements ManagerInterface $errors[] = __('The schedule description is too long.'); } if ($errors) { - throw new \Magento\Core\Exception(implode(' ', $errors)); + throw new \Magento\Model\Exception(implode(' ', $errors)); } } diff --git a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php index aa0648f4c1589dba89a9bcb2e50e7cdabec16705..b032a058c3ab3ab8727247a3720bbdd087d5ae96 100644 --- a/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php +++ b/app/code/Magento/PayPalRecurringPayment/Model/Ipn.php @@ -120,7 +120,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements \Magento\Paypal\M * Process notification from recurring payments * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws Exception */ protected function _processRecurringPayment() @@ -173,7 +173,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements \Magento\Paypal\M $message = __('You notified customer about invoice #%1.', $invoice->getIncrementId()); $order->sendNewOrderEmail()->addStatusHistoryComment($message)->setIsCustomerNotified(true)->save(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); //TODO: add to payment comments //$comment->save(); diff --git a/app/code/Magento/PayPalRecurringPayment/etc/module.xml b/app/code/Magento/PayPalRecurringPayment/etc/module.xml index 8c212ec8acfe5d6e0dd5c35de975f9dcbb9953a3..d95906ac37affd18a8e5d53284d4eaf7aecc0549 100644 --- a/app/code/Magento/PayPalRecurringPayment/etc/module.xml +++ b/app/code/Magento/PayPalRecurringPayment/etc/module.xml @@ -26,7 +26,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> <module name="Magento_PayPalRecurringPayment" version="1.0.0.0" active="true"> <depends> - <module name="Magento_Core"/> <module name="Magento_Customer" /> <module name="Magento_Directory" /> <module name="Magento_Payment"/> diff --git a/app/code/Magento/Payment/Block/Form.php b/app/code/Magento/Payment/Block/Form.php index ef032ff6a7664faba75bea2578aa5029c3e73114..5e5ec4f5145f52fd9deded1b0d5b045b48670a89 100644 --- a/app/code/Magento/Payment/Block/Form.php +++ b/app/code/Magento/Payment/Block/Form.php @@ -34,14 +34,14 @@ class Form extends \Magento\View\Element\Template * Retrieve payment method model * * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethod() { $method = $this->getData('method'); if (!$method instanceof \Magento\Payment\Model\MethodInterface) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment method model object.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment method model object.')); } return $method; } diff --git a/app/code/Magento/Payment/Block/Info.php b/app/code/Magento/Payment/Block/Info.php index ac47b24540286a6fde727b5ff316b63dcdd20599..07f8dfec54d55bd7da8471e7b5f50efb02722cdc 100644 --- a/app/code/Magento/Payment/Block/Info.php +++ b/app/code/Magento/Payment/Block/Info.php @@ -46,13 +46,13 @@ class Info extends \Magento\View\Element\Template * Retrieve info model * * @return \Magento\Payment\Model\Info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getInfo() { $info = $this->getData('info'); if (!$info instanceof \Magento\Payment\Model\Info) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment info model object.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment info model object.')); } return $info; } diff --git a/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php b/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php index a429864e17ebab7a095765b8132fbcb7e7b230db..58511c276b43ab47afd84547cae4a6765a32237e 100644 --- a/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php +++ b/app/code/Magento/Payment/Model/Checks/SpecificationFactory.php @@ -55,7 +55,7 @@ class SpecificationFactory * * @param array $data * @return SpecificationInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($data) { diff --git a/app/code/Magento/Payment/Model/Info.php b/app/code/Magento/Payment/Model/Info.php index c6d42e88bd02d8781e4e06c73430a566c825993e..260c3f183bfdf16fea649db4aa4de8cc10ddf606 100644 --- a/app/code/Magento/Payment/Model/Info.php +++ b/app/code/Magento/Payment/Model/Info.php @@ -28,7 +28,7 @@ namespace Magento\Payment\Model; /** * Payment information model */ -class Info extends \Magento\Core\Model\AbstractModel +class Info extends \Magento\Model\AbstractModel { /** * Additional information container @@ -54,7 +54,7 @@ class Info extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -63,7 +63,7 @@ class Info extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Payment\Helper\Data $paymentData, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -98,7 +98,7 @@ class Info extends \Magento\Core\Model\AbstractModel * Retrieve payment method model object * * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getMethodInstance() { @@ -111,7 +111,7 @@ class Info extends \Magento\Core\Model\AbstractModel return $instance; } } - throw new \Magento\Core\Exception(__('The payment method you requested is not available.')); + throw new \Magento\Model\Exception(__('The payment method you requested is not available.')); } return $this->_getData('method_instance'); @@ -153,12 +153,12 @@ class Info extends \Magento\Core\Model\AbstractModel * @param string|array $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value = null) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('The payment disallows storing objects.')); + throw new \Magento\Model\Exception(__('The payment disallows storing objects.')); } $this->_initAdditionalInformation(); if (is_array($key) && is_null($value)) { diff --git a/app/code/Magento/Payment/Model/Info/Exception.php b/app/code/Magento/Payment/Model/Info/Exception.php index ff92ffae48a7351efaef01dcf8b55c83801fb1e6..b127a3ca54cd8818674d25f58e69854ac00c0a91 100644 --- a/app/code/Magento/Payment/Model/Info/Exception.php +++ b/app/code/Magento/Payment/Model/Info/Exception.php @@ -34,6 +34,6 @@ namespace Magento\Payment\Model\Info; * @package Magento_Payment * @author Magento Core Team <core@magentocommerce.com> */ -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Payment/Model/Method/AbstractMethod.php b/app/code/Magento/Payment/Model/Method/AbstractMethod.php index 9e660f6c569dce9bbace536a2c81ff6ba58b11b0..59eef7598d3a9383dcb4942636c7ae5ab43eab99 100644 --- a/app/code/Magento/Payment/Model/Method/AbstractMethod.php +++ b/app/code/Magento/Payment/Model/Method/AbstractMethod.php @@ -414,12 +414,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Retrieve payment method code * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCode() { if (empty($this->_code)) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment method code.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment method code.')); } return $this->_code; } @@ -448,13 +448,13 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Retrieve payment iformation model object * * @return \Magento\Payment\Model\Info - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getInfoInstance() { $instance = $this->getData('info_instance'); if (!$instance instanceof \Magento\Payment\Model\Info) { - throw new \Magento\Core\Exception(__('We cannot retrieve the payment information object instance.')); + throw new \Magento\Model\Exception(__('We cannot retrieve the payment information object instance.')); } return $instance; } @@ -463,7 +463,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * Validate payment method information object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { @@ -477,7 +477,7 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen $billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId(); } if (!$this->canUseForCountry($billingCountry)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You can\'t use the payment type you selected to make payments to the billing country.') ); } @@ -491,12 +491,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function order(\Magento\Object $payment, $amount) { if (!$this->canOrder()) { - throw new \Magento\Core\Exception(__('The order action is not available.')); + throw new \Magento\Model\Exception(__('The order action is not available.')); } return $this; } @@ -508,12 +508,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function authorize(\Magento\Object $payment, $amount) { if (!$this->canAuthorize()) { - throw new \Magento\Core\Exception(__('The authorize action is not available.')); + throw new \Magento\Model\Exception(__('The authorize action is not available.')); } return $this; } @@ -525,12 +525,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param float $amount * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function capture(\Magento\Object $payment, $amount) { if (!$this->canCapture()) { - throw new \Magento\Core\Exception(__('The capture action is not available.')); + throw new \Magento\Model\Exception(__('The capture action is not available.')); } return $this; @@ -572,12 +572,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * @param \Magento\Object $payment * @param float $amount * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $amount) { if (!$this->canRefund()) { - throw new \Magento\Core\Exception(__('The refund action is not available.')); + throw new \Magento\Model\Exception(__('The refund action is not available.')); } return $this; } @@ -611,12 +611,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Object $payment * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { if (!$this->canVoid($payment)) { - throw new \Magento\Core\Exception(__('Void action is not available.')); + throw new \Magento\Model\Exception(__('Void action is not available.')); } return $this; } @@ -637,12 +637,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Payment\Model\Info $payment * @return false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function acceptPayment(\Magento\Payment\Model\Info $payment) { if (!$this->canReviewPayment($payment)) { - throw new \Magento\Core\Exception(__('The payment review action is unavailable.')); + throw new \Magento\Model\Exception(__('The payment review action is unavailable.')); } return false; } @@ -652,12 +652,12 @@ abstract class AbstractMethod extends \Magento\Object implements \Magento\Paymen * * @param \Magento\Payment\Model\Info $payment * @return false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function denyPayment(\Magento\Payment\Model\Info $payment) { if (!$this->canReviewPayment($payment)) { - throw new \Magento\Core\Exception(__('The payment review action is unavailable.')); + throw new \Magento\Model\Exception(__('The payment review action is unavailable.')); } return false; } diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index dc7077efb4e5ca580c84de61a1a0b61b00948815..4304f2ef94b074b62a9a61ad2910e86750dc5a71 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -151,7 +151,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod * Validate payment method information object * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ @@ -245,7 +245,7 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod } if ($errorMsg) { - throw new \Magento\Core\Exception($errorMsg); + throw new \Magento\Model\Exception($errorMsg); } //This must be after all validation conditions diff --git a/app/code/Magento/Payment/Model/Method/Factory.php b/app/code/Magento/Payment/Model/Method/Factory.php index 1134b9ea9d534651294557075e4d751bb3f29a3e..a8c90fa1012a54ceb538e8405a3b77fd00ddaaa1 100644 --- a/app/code/Magento/Payment/Model/Method/Factory.php +++ b/app/code/Magento/Payment/Model/Method/Factory.php @@ -51,13 +51,13 @@ class Factory * @param string $className * @param array $data * @return \Magento\Payment\Model\MethodInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($className, $data = array()) { $method = $this->_objectManager->create($className, $data); if (!$method instanceof \Magento\Payment\Model\MethodInterface) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( sprintf("%s class doesn't implement \Magento\Payment\Model\MethodInterface", $className) ); } diff --git a/app/code/Magento/Paypal/Block/Iframe.php b/app/code/Magento/Paypal/Block/Iframe.php index 22751df758d2ed96ac7018b7c7cba6de87da0da8..d4852ca0fd7746b5d33f35fe92a25d98ec5d2cb9 100644 --- a/app/code/Magento/Paypal/Block/Iframe.php +++ b/app/code/Magento/Paypal/Block/Iframe.php @@ -127,7 +127,7 @@ class Iframe extends \Magento\Payment\Block\Form * Get current block instance * * @return \Magento\Payment\Block\Form - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getBlock() { @@ -140,7 +140,7 @@ class Iframe extends \Magento\Payment\Block\Form ) . '\\Iframe' ); if (!$this->_block instanceof \Magento\Paypal\Block\Iframe) { - throw new \Magento\Core\Exception('Invalid block type'); + throw new \Magento\Model\Exception('Invalid block type'); } } diff --git a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php index 8e40c6a6c7da0b22b6629eefbc2fe9cfb4114f33..0a26728043432c5fa107fe71d1720a24c6e0bc4c 100644 --- a/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php +++ b/app/code/Magento/Paypal/Block/Payflow/Advanced/Iframe.php @@ -34,6 +34,26 @@ namespace Magento\Paypal\Block\Payflow\Advanced; */ class Iframe extends \Magento\Paypal\Block\Payflow\Link\Iframe { + /** + * @param \Magento\View\Element\Template\Context $context + * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Paypal\Helper\Hss $hssHelper + * @param \Magento\Payment\Helper\Data $paymentData + * @param array $data + */ + public function __construct( + \Magento\View\Element\Template\Context $context, + \Magento\Sales\Model\OrderFactory $orderFactory, + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Paypal\Helper\Hss $hssHelper, + \Magento\Payment\Helper\Data $paymentData, + array $data = array() + ) { + parent::__construct($context, $orderFactory, $checkoutSession, $hssHelper, $paymentData, $data); + $this->_isScopePrivate = false; + } + /** * Set payment method code * diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php index 971cd2c437d32aa5d5676beaed782932cc5f2fe1..28cc38ec82723ceba06122265ac10b0590d54b42 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Billing/Agreement.php @@ -132,7 +132,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You canceled the billing agreement.')); $this->_redirect('paypal/*/view', array('_current' => true)); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We could not cancel the billing agreement.')); @@ -158,7 +158,7 @@ class Agreement extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You deleted the billing agreement.')); $this->_redirect('paypal/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We could not delete the billing agreement.')); diff --git a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php index dd97af93737671c64aa3005c045d41eeed180c1c..d4a1a96f74251dca8052760ea2ac15c3e7c53237 100644 --- a/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php +++ b/app/code/Magento/Paypal/Controller/Adminhtml/Paypal/Reports.php @@ -124,7 +124,7 @@ class Reports extends \Magento\Backend\App\Action * Forced fetch reports action * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fetchAction() { @@ -133,7 +133,7 @@ class Reports extends \Magento\Backend\App\Action /* @var $reports \Magento\Paypal\Model\Report\Settlement */ $credentials = $reports->getSftpCredentials(); if (empty($credentials)) { - throw new \Magento\Core\Exception(__('We found nothing to fetch because of an empty configuration.')); + throw new \Magento\Model\Exception(__('We found nothing to fetch because of an empty configuration.')); } foreach ($credentials as $config) { try { @@ -155,7 +155,7 @@ class Reports extends \Magento\Backend\App\Action $this->_logger->logException($e); } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_logger->logException($e); diff --git a/app/code/Magento/Paypal/Controller/Billing/Agreement.php b/app/code/Magento/Paypal/Controller/Billing/Agreement.php index 9e07594cb1c27d3249d1879a2067cf751b4467f9..10fbd747956c75a94f84e78ee7c185f8d9bcdb34 100644 --- a/app/code/Magento/Paypal/Controller/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Controller/Billing/Agreement.php @@ -140,7 +140,7 @@ class Agreement extends \Magento\App\Action\Action ); return $this->getResponse()->setRedirect($agreement->initToken()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -176,7 +176,7 @@ class Agreement extends \Magento\App\Action\Action ); $this->_redirect('*/*/view', array('agreement' => $agreement->getId())); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -214,7 +214,7 @@ class Agreement extends \Magento\App\Action\Action $this->messageManager->addNotice( __('The billing agreement "%1" has been canceled.', $agreement->getReferenceId()) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php index 7e980e813e59c663a08e0ae852b6361039cb6dce..5faab9ef7fdc63f92f3d828addc23757abd6506b 100644 --- a/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php +++ b/app/code/Magento/Paypal/Controller/Express/AbstractExpress.php @@ -197,7 +197,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->getResponse()->setRedirect($url); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t start Express Checkout.')); @@ -249,7 +249,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } else { $this->messageManager->addSuccess(__('Express Checkout has been canceled.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Unable to cancel Express Checkout')); @@ -271,7 +271,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $this->_checkout->returnFromPaypal($this->_initToken()); $this->_redirect('*/*/review'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t process Express Checkout approval.')); @@ -300,7 +300,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements } $this->_view->renderLayout(); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t initialize Express Checkout review.')); @@ -318,7 +318,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements { try { $this->getResponse()->setRedirect($this->_config->getExpressCheckoutEditUrl($this->_initToken())); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*/*/review'); } @@ -342,7 +342,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements ); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update shipping method.')); @@ -379,7 +379,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements )->toHtml() ); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update Order data.')); @@ -408,7 +408,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements ); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update Order data.')); @@ -429,7 +429,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * Submit the order * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function placeOrderAction() { @@ -440,7 +440,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements if ($requiredAgreements) { $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array())); if (array_diff($requiredAgreements, $postedAgreements)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please agree to all the terms and conditions before placing the order.') ); } @@ -481,7 +481,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements // no need in token anymore $this->_redirect('checkout/onepage/success'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t place the order.')); @@ -494,14 +494,14 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * Instantiate quote and checkout * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ private function _initCheckout() { $quote = $this->_getQuote(); if (!$quote->hasItems() || $quote->getHasError()) { $this->getResponse()->setHeader('HTTP/1.1', '403 Forbidden'); - throw new \Magento\Core\Exception(__('We can\'t initialize Express Checkout.')); + throw new \Magento\Model\Exception(__('We can\'t initialize Express Checkout.')); } if (!isset($this->_checkoutTypes[$this->_checkoutType])) { $parameters = array('params' => array('quote' => $quote, 'config' => $this->_config)); @@ -519,7 +519,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements * * @param string|null $setToken * @return \Magento\Paypal\Controller\Express|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initToken($setToken = null) { @@ -527,7 +527,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements if (false === $setToken) { // security measure for avoid unsetting token twice if (!$this->_getSession()->getExpressCheckoutToken()) { - throw new \Magento\Core\Exception(__('PayPal Express Checkout Token does not exist.')); + throw new \Magento\Model\Exception(__('PayPal Express Checkout Token does not exist.')); } $this->_getSession()->unsExpressCheckoutToken(); } else { @@ -538,7 +538,7 @@ abstract class AbstractExpress extends \Magento\App\Action\Action implements $setToken = $this->getRequest()->getParam('token'); if ($setToken) { if ($setToken !== $this->_getSession()->getExpressCheckoutToken()) { - throw new \Magento\Core\Exception(__('A wrong PayPal Express Checkout Token is specified.')); + throw new \Magento\Model\Exception(__('A wrong PayPal Express Checkout Token is specified.')); } } else { $setToken = $this->_getSession()->getExpressCheckoutToken(); diff --git a/app/code/Magento/Paypal/Exception.php b/app/code/Magento/Paypal/Exception.php index deb9c148aff895d588d1254feac84fe6c54a9885..026ecf539ba5d7bc84ae3ed710062467990d32d6 100644 --- a/app/code/Magento/Paypal/Exception.php +++ b/app/code/Magento/Paypal/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Paypal; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Paypal/Model/Api/Nvp.php b/app/code/Magento/Paypal/Model/Api/Nvp.php index 1befeea7187c2947478b49dbb399b52c6cbc815a..80287448be65f5b92ba27898e279e91a19234d06 100644 --- a/app/code/Magento/Paypal/Model/Api/Nvp.php +++ b/app/code/Magento/Paypal/Model/Api/Nvp.php @@ -1080,7 +1080,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi $request = $this->_exportToRequest($this->_updateBillingAgreementRequest); try { $response = $this->call('BillAgreementUpdate', $request); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (in_array(10201, $this->_callErrors)) { $this->setIsBillingAgreementAlreadyCancelled(true); } @@ -1159,7 +1159,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * @param string $methodName * @param array $request * @return array - * @throws \Magento\Core\Exception|\Exception + * @throws \Magento\Model\Exception|\Exception */ public function call($methodName, array $request) { @@ -1216,7 +1216,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi ); $http->close(); - throw new \Magento\Core\Exception(__('We can\'t contact the PayPal gateway.')); + throw new \Magento\Model\Exception(__('We can\'t contact the PayPal gateway.')); } // cUrl resource must be closed after checking it for errors @@ -1224,7 +1224,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi if (!$this->_validateResponse($methodName, $response)) { $this->_logger->logException(new \Exception(__("PayPal response hasn't required fields."))); - throw new \Magento\Core\Exception(__('Something went wrong while processing your order.')); + throw new \Magento\Model\Exception(__('Something went wrong while processing your order.')); } $this->_callErrors = array(); @@ -1255,7 +1255,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi * * @param array $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _handleCallErrors($response) { @@ -1283,7 +1283,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi } if ($errors) { $errors = implode(' ', $errors); - $e = new \Magento\Core\Exception( + $e = new \Magento\Model\Exception( sprintf( 'PayPal NVP gateway errors: %s Correlation ID: %s. Version: %s.', $errors, diff --git a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php index f94c4486e88d57dc88384f1d7241d18138fe6e03..7114a088aba1b10224415700a497948844fca853 100644 --- a/app/code/Magento/Paypal/Model/Api/PayflowNvp.php +++ b/app/code/Magento/Paypal/Model/Api/PayflowNvp.php @@ -632,7 +632,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp * * @param array $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _handleCallErrors($response) { @@ -640,7 +640,7 @@ class PayflowNvp extends \Magento\Paypal\Model\Api\Nvp $message = $response['RESPMSG']; $e = new \Exception(sprintf('PayPal gateway errors: %s.', $message)); $this->_logger->logException($e); - throw new \Magento\Core\Exception(__('PayPal gateway rejected the request. %1', $message)); + throw new \Magento\Model\Exception(__('PayPal gateway rejected the request. %1', $message)); } } diff --git a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php index 86c010bbd22af539a773d6c8236e89a78f6ad6fb..02c42adf3cdb864b7607a049f93ecc8eb5f0e58c 100644 --- a/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php +++ b/app/code/Magento/Paypal/Model/Billing/AbstractAgreement.php @@ -26,7 +26,7 @@ namespace Magento\Paypal\Model\Billing; /** * Billing Agreement abstaract class */ -abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel +abstract class AbstractAgreement extends \Magento\Model\AbstractModel { /** * Payment method instance @@ -81,7 +81,7 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -133,8 +133,8 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel /** * Before save, it's overridden just to make data validation on before save event * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -142,6 +142,6 @@ abstract class AbstractAgreement extends \Magento\Core\Model\AbstractModel return parent::_beforeSave(); } array_unshift($this->_errors, __('Unable to save Billing Agreement:')); - throw new \Magento\Core\Exception(implode(' ', $this->_errors)); + throw new \Magento\Model\Exception(implode(' ', $this->_errors)); } } diff --git a/app/code/Magento/Paypal/Model/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Billing/Agreement.php index 52145362df8dcea4cd3f55b7c88c56396f9d8764..1685646f7a866aee6d05765960768a364ec2777e 100644 --- a/app/code/Magento/Paypal/Model/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/Billing/Agreement.php @@ -76,7 +76,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -86,7 +86,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement \Magento\Payment\Helper\Data $paymentData, \Magento\Paypal\Model\Resource\Billing\Agreement\CollectionFactory $billingAgreementFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -108,7 +108,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement /** * Set created_at parameter * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -124,7 +124,7 @@ class Agreement extends \Magento\Paypal\Model\Billing\AbstractAgreement /** * Save agreement order relations * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterSave() { diff --git a/app/code/Magento/Paypal/Model/Cert.php b/app/code/Magento/Paypal/Model/Cert.php index ab4edd8acc5a36cbc242240c5898d08ca01b027a..16caa27201204adf3a8e355f37658199cdde04ff 100644 --- a/app/code/Magento/Paypal/Model/Cert.php +++ b/app/code/Magento/Paypal/Model/Cert.php @@ -30,7 +30,7 @@ use Magento\Filesystem\Directory\WriteInterface; /** * PayPal specific model for certificate based authentication */ -class Cert extends \Magento\Core\Model\AbstractModel +class Cert extends \Magento\Model\AbstractModel { /** * Certificate base path @@ -52,7 +52,7 @@ class Cert extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\App\Filesystem $filesystem * @param \Magento\Encryption\EncryptorInterface $encryptor - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -61,7 +61,7 @@ class Cert extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\App\Filesystem $filesystem, \Magento\Encryption\EncryptorInterface $encryptor, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -98,12 +98,12 @@ class Cert extends \Magento\Core\Model\AbstractModel * Get path to PayPal certificate file, if file does not exist try to create it * * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getCertPath() { if (!$this->getContent()) { - throw new \Magento\Core\Exception(__('The PayPal certificate does not exist.')); + throw new \Magento\Model\Exception(__('The PayPal certificate does not exist.')); } $certFileName = sprintf('cert_%s_%s.pem', $this->getWebsiteId(), strtotime($this->getUpdatedAt())); diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index 88b8c491a73e6876dd12b769cf3ccb84a2f471ce..ddb2d1b082e5000adc28ab90259f4e743834760f 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -503,7 +503,7 @@ class Direct extends \Magento\Payment\Model\Method\Cc try { $api->callGetTransactionDetails(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // if we receive errors, but DoDirectPayment response is Success, then set Pending status for transaction $payment->setIsTransactionPending(true); } diff --git a/app/code/Magento/Paypal/Model/Express.php b/app/code/Magento/Paypal/Model/Express.php index afaea5b11cba3c9e4b0f8078425e53c4258265c3..6c0b2c3bfdfe9129dac69cde87364c00c728c192 100644 --- a/app/code/Magento/Paypal/Model/Express.php +++ b/app/code/Magento/Paypal/Model/Express.php @@ -403,7 +403,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod * * @param \Magento\Object|Payment $payment * @param float $amount - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function capture(\Magento\Object $payment, $amount) @@ -438,7 +438,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod if ($authorizationTransaction->getIsClosed() || $voided) { if ($payment->getAdditionalInformation($this->_authorizationCountKey) > $maxAuthorizationNumber - 1) { - throw new \Magento\Core\Exception(__('The maximum number of child authorizations is reached.')); + throw new \Magento\Model\Exception(__('The maximum number of child authorizations is reached.')); } $api = $this->_callDoAuthorize($amount, $payment, $authorizationTransaction->getParentTxnId()); diff --git a/app/code/Magento/Paypal/Model/Express/Checkout.php b/app/code/Magento/Paypal/Model/Express/Checkout.php index c97eefb1a28516e4d5f604cc616463202f38647c..3fdb92932afd4736c3f313ecb62785576148910e 100644 --- a/app/code/Magento/Paypal/Model/Express/Checkout.php +++ b/app/code/Magento/Paypal/Model/Express/Checkout.php @@ -414,14 +414,14 @@ class Checkout * @param string $returnUrl * @param string $cancelUrl * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function start($returnUrl, $cancelUrl) { $this->_quote->collectTotals(); if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'PayPal can\'t process orders with a zero balance due. ' . 'To finish your purchase, please go through the standard checkout process.' @@ -593,13 +593,13 @@ class Checkout * * @param string|null $token * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareOrderReview($token = null) { $payment = $this->_quote->getPayment(); if (!$payment || !$payment->getAdditionalInformation(self::PAYMENT_INFO_TRANSPORT_PAYER_ID)) { - throw new \Magento\Core\Exception(__('Payer is not identified.')); + throw new \Magento\Model\Exception(__('Payer is not identified.')); } $this->_quote->setMayEditShippingAddress( 1 != $this->_quote->getPayment()->getAdditionalInformation( diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index a39624204704068c195e9fc90108630933cd928f..a5d536224ca454d55de8a33054eb4895dca59bf7 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -209,7 +209,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * * @param \Magento\Payment\Model\Info $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setPaymentFormUrl(\Magento\Payment\Model\Info $payment) { @@ -218,7 +218,7 @@ class Hostedpro extends \Magento\Paypal\Model\Direct if ($response) { $payment->setAdditionalInformation('secure_form_url', $response); } else { - throw new \Magento\Core\Exception('Cannot get secure form URL from PayPal'); + throw new \Magento\Model\Exception('Cannot get secure form URL from PayPal'); } } diff --git a/app/code/Magento/Paypal/Model/Ipn.php b/app/code/Magento/Paypal/Model/Ipn.php index 90b79b88aecd3156083e9c69950fea447e05e9fd..3f97ead9a72f21e974d789b125e4d2f10bbe7f11 100644 --- a/app/code/Magento/Paypal/Model/Ipn.php +++ b/app/code/Magento/Paypal/Model/Ipn.php @@ -143,7 +143,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface * Admin will be notified on errors. * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processOrder() { @@ -165,7 +165,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface $this->_registerTransaction(); break; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); $comment->save(); throw $e; @@ -218,7 +218,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface * Process regular IPN notifications * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws Exception */ protected function _registerTransaction() @@ -264,7 +264,7 @@ class Ipn extends \Magento\Paypal\Model\AbstractIpn implements IpnInterface default: throw new Exception("Cannot handle payment status '{$paymentStatus}'."); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $comment = $this->_createIpnComment(__('Note: %1', $e->getMessage()), true); $comment->save(); throw $e; diff --git a/app/code/Magento/Paypal/Model/Method/Agreement.php b/app/code/Magento/Paypal/Model/Method/Agreement.php index c03e6e103c490c8e3aab4248626c2779576a7891..c7ee0a0f13276ed1153426270448f33743a7e9ad 100644 --- a/app/code/Magento/Paypal/Model/Method/Agreement.php +++ b/app/code/Magento/Paypal/Model/Method/Agreement.php @@ -257,7 +257,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr * * @param \Magento\Paypal\Model\Billing\AbstractAgreement $agreement * @return $this - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function updateBillingAgreementStatus(\Magento\Paypal\Model\Billing\AbstractAgreement $agreement) { @@ -269,7 +269,7 @@ class Agreement extends \Magento\Paypal\Model\Payment\Method\Billing\AbstractAgr ); try { $api->callUpdateBillingAgreement(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // when BA was already canceled, just pretend that the operation succeeded if (!(\Magento\Paypal\Model\Billing\Agreement::STATUS_CANCELED == $targetStatus && $api->getIsBillingAgreementAlreadyCancelled()) diff --git a/app/code/Magento/Paypal/Model/Payflow/Pro.php b/app/code/Magento/Paypal/Model/Payflow/Pro.php index 79c6b25ee7f4c562c39609ef0f320084853a9720..de930d102b7232630f48d8134ac16b83035e718e 100644 --- a/app/code/Magento/Paypal/Model/Payflow/Pro.php +++ b/app/code/Magento/Paypal/Model/Payflow/Pro.php @@ -120,12 +120,12 @@ class Pro extends \Magento\Paypal\Model\Pro * * @param \Magento\Payment\Model\Info $payment * @param string $transactionId - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return void */ public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId) { - throw new \Magento\Core\Exception(__('Fetch transaction details method does not exists in Payflow')); + throw new \Magento\Model\Exception(__('Fetch transaction details method does not exists in Payflow')); } /** diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index dfd71ca7c2f7ff02e8bf3655a810c4c9bd98853c..d797e3b7d72d7ff117047a3ec21c90aadc9d718d 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -324,7 +324,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @param array $responseData * @return void - * @throws \Magento\Core\Exception In case of validation error or order creation error + * @throws \Magento\Model\Exception In case of validation error or order creation error */ public function process($responseData) { @@ -343,7 +343,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @param \Magento\Sales\Model\Order $order * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processOrder(\Magento\Sales\Model\Order $order) { @@ -392,7 +392,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro } $this->_quoteFactory->create()->load($order->getQuoteId())->setIsActive(false)->save(); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('We cannot send the new order email.')); + throw new \Magento\Model\Exception(__('We cannot send the new order email.')); } } @@ -416,7 +416,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * Check response from Payflow gateway. * * @return false|\Magento\Sales\Model\Order in case of validation passed - * @throws \Magento\Core\Exception In other cases + * @throws \Magento\Model\Exception In other cases */ protected function _getOrderFromResponse() { @@ -437,7 +437,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro if ($order->getState() != \Magento\Sales\Model\Order::STATE_CANCELED) { $order->registerCancellation($response->getRespmsg())->save(); } - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } $amountCompared = $response->getAmt() == $order->getPayment()->getBaseAmountAuthorized() ? true : false; @@ -445,12 +445,12 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $order->getState() != \Magento\Sales\Model\Order::STATE_PENDING_PAYMENT || !$amountCompared ) { - throw new \Magento\Core\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Order')); + throw new \Magento\Model\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Order')); } $fetchData = $this->fetchTransactionInfo($order->getPayment(), $response->getPnref()); if (!isset($fetchData['custref']) || $fetchData['custref'] != $order->getIncrementId()) { - throw new \Magento\Core\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Transaction')); + throw new \Magento\Model\Exception($this->_formatStr(self::RESPONSE_ERROR_MSG, 'Transaction')); } return $order; @@ -651,7 +651,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @param \Magento\Object $response * @param \Magento\Sales\Model\Order\Payment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processTokenErrors($response, $payment) { @@ -659,7 +659,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $response->getResult() != self::RESPONSE_CODE_APPROVED && $response->getResult() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER ) { - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } else { $payment->setAdditionalInformation( 'secure_token_id', @@ -726,7 +726,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @deprecated since 1.6.2.0 * @param mixed|null $token * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function prepareOrderReview($token = null) { @@ -776,7 +776,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * * @deprecated since 1.6.2.0 * @return \Magento\Sales\Model\AbstractModel in case of validation passed - * @throws \Magento\Core\Exception In other cases + * @throws \Magento\Model\Exception In other cases */ protected function _getDocumentFromResponse() { diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index 36dd46ae6eb0c7a19bcbf58367932241f1dad657..b6f8f3cae7c7d173933ab22dd0ef6b04b1d0b15e 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -719,7 +719,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc * * @param \Magento\Object $response * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processErrors(\Magento\Object $response) { @@ -728,7 +728,7 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc } elseif ($response->getResultCode() != self::RESPONSE_CODE_APPROVED && $response->getResultCode() != self::RESPONSE_CODE_FRAUDSERVICE_FILTER ) { - throw new \Magento\Core\Exception($response->getRespmsg()); + throw new \Magento\Model\Exception($response->getRespmsg()); } } diff --git a/app/code/Magento/Paypal/Model/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Payment/Transaction.php index 8643452d177f0df009103a3e23bcc061b408bfeb..ad10383fff0b37d018aec590bc28b3556436bcea 100644 --- a/app/code/Magento/Paypal/Model/Payment/Transaction.php +++ b/app/code/Magento/Paypal/Model/Payment/Transaction.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Payment; * @method string getCreatedAt() * @method \Magento\Paypal\Model\Payment\Transaction setCreatedAt(string $value) */ -class Transaction extends \Magento\Core\Model\AbstractModel +class Transaction extends \Magento\Model\AbstractModel { /** * Whether to throw exceptions on different operations @@ -74,7 +74,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -161,12 +161,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('Payment transactions disallow storing objects.')); + throw new \Magento\Model\Exception(__('Payment transactions disallow storing objects.')); } $info = $this->_getData('additional_information'); if (!$info) { @@ -232,7 +232,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * Verify data required for saving * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -247,12 +247,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnId($txnId) { if (null !== $txnId && 0 == strlen($txnId)) { - throw new \Magento\Core\Exception(__('You need to enter a transaction ID.')); + throw new \Magento\Model\Exception(__('You need to enter a transaction ID.')); } } @@ -262,12 +262,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * TODO for more restriction we can check for data consistency * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyThisTransactionExists() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('This operation requires an existing transaction object.')); + throw new \Magento\Model\Exception(__('This operation requires an existing transaction object.')); } } } diff --git a/app/code/Magento/Paypal/Model/Pro.php b/app/code/Magento/Paypal/Model/Pro.php index be79b7460d4089376a9138059ab216a924d88a0d..b13e3e7f2003ffeab6a65a3acb515fc21eed5f23 100644 --- a/app/code/Magento/Paypal/Model/Pro.php +++ b/app/code/Magento/Paypal/Model/Pro.php @@ -233,7 +233,7 @@ class Pro * * @param \Magento\Object $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function void(\Magento\Object $payment) { @@ -243,7 +243,7 @@ class Pro $api->setPayment($payment)->setAuthorizationId($authTransactionId)->callDoVoid(); $this->importPaymentInfo($api, $payment); } else { - throw new \Magento\Core\Exception(__('You need an authorization transaction to void.')); + throw new \Magento\Model\Exception(__('You need an authorization transaction to void.')); } } @@ -284,7 +284,7 @@ class Pro * @param \Magento\Object $payment * @param float $amount * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund(\Magento\Object $payment, $amount) { @@ -310,7 +310,7 @@ class Pro $api->callRefundTransaction(); $this->_importRefundResultToPayment($api, $payment, $canRefundMore); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We can\'t issue a refund transaction because there is no capture transaction.') ); } diff --git a/app/code/Magento/Paypal/Model/Report/Settlement.php b/app/code/Magento/Paypal/Model/Report/Settlement.php index 3849e0bb03b4345b4481d98f1d2a1b9e4a70ad52..b7c37113cd60ad9becc0ebf5689267a3e14e319f 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement.php @@ -42,7 +42,7 @@ namespace Magento\Paypal\Model\Report; * @method string getLastModified() * @method \Magento\Paypal\Model\Report\Settlement setLastModified(string $value) */ -class Settlement extends \Magento\Core\Model\AbstractModel +class Settlement extends \Magento\Model\AbstractModel { /** * Default PayPal SFTP host @@ -173,7 +173,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\App\Filesystem $filesystem * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -182,7 +182,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\App\Filesystem $filesystem, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -204,7 +204,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel /** * Stop saving process if file with same report date, account ID and last modified date was already ferched * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeSave() { @@ -224,7 +224,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel * * @param \Magento\Io\Sftp $connection * @return int Number of report rows that were fetched and saved successfully - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fetchAndSave(\Magento\Io\Sftp $connection) { @@ -235,7 +235,7 @@ class Settlement extends \Magento\Core\Model\AbstractModel $localCsv = 'PayPal_STL_' . uniqid(mt_rand()) . time() . '.csv'; if ($connection->read($filename, $this->_tmpDirectory->getAbsolutePath($localCsv))) { if (!$this->_tmpDirectory->isWritable($localCsv)) { - throw new \Magento\Core\Exception(__('We cannot create a target file for reading reports.')); + throw new \Magento\Model\Exception(__('We cannot create a target file for reading reports.')); } $encoded = $this->_tmpDirectory->readFile($localCsv); diff --git a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php index 25bb61dd7d05555ba09896504c871f425e44eee7..37b23bcab1fcfbe500474065da45cd2d35a1e264 100644 --- a/app/code/Magento/Paypal/Model/Report/Settlement/Row.php +++ b/app/code/Magento/Paypal/Model/Report/Settlement/Row.php @@ -68,7 +68,7 @@ namespace Magento\Paypal\Model\Report\Settlement; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Row extends \Magento\Core\Model\AbstractModel +class Row extends \Magento\Model\AbstractModel { /** * Assoc array event code => label diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php index 30f8d37e7e1d4eda39c570785323a863f7f91746..1ea6bae7230ea61f29e2206fff58620dc93a6ec5 100644 --- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php +++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement.php @@ -26,7 +26,7 @@ namespace Magento\Paypal\Model\Resource\Billing; /** * Billing agreement resource model */ -class Agreement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Agreement extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php index d7edbc57f299d4291a4f83e024ed51b9f248783c..74ea4c85eca0caa396b51133a5e6e53c6cf626b3 100644 --- a/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Billing/Agreement/Collection.php @@ -28,7 +28,7 @@ use Magento\Customer\Service\V1\CustomerMetadataServiceInterface; /** * Billing agreements resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Mapping for fields @@ -63,7 +63,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param \Magento\Eav\Helper\Data $eavHelper * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -73,7 +73,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Customer\Model\Resource\Customer $customerResource, \Magento\Eav\Helper\Data $eavHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_eavHelper = $eavHelper; diff --git a/app/code/Magento/Paypal/Model/Resource/Cert.php b/app/code/Magento/Paypal/Model/Resource/Cert.php index afceb8a749c1791b1a8c67537b4094d3faf9dba7..32886a68f6e8c27e7b202a40cec521bd58d7295a 100644 --- a/app/code/Magento/Paypal/Model/Resource/Cert.php +++ b/app/code/Magento/Paypal/Model/Resource/Cert.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\Resource; /** * PayPal resource model for certificate based authentication */ -class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb +class Cert extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime\DateTime @@ -68,10 +68,10 @@ class Cert extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set date of last update * - * @param \Magento\Core\Model\AbstractModel $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $object->setUpdatedAt($this->dateTime->formatDate($this->_coreDate->gmtDate())); return parent::_beforeSave($object); diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php index a0507a2a9a111211eb6c7da6570606a5e24cd63d..0e4db5f91e7e97a084f8ba7a361152b9193b6907 100644 --- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php +++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Resource\Payment; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb +class Transaction extends \Magento\Model\Resource\Db\AbstractDb { /** * Serializeable field: additional_information @@ -71,11 +71,11 @@ class Transaction extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Serialize additional information, if any * - * @param \Magento\Core\Model\AbstractModel $transaction + * @param \Magento\Model\AbstractModel $transaction * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $transaction) + protected function _beforeSave(\Magento\Model\AbstractModel $transaction) { $txnId = $transaction->getData('txn_id'); $idFieldName = $this->getIdFieldName(); diff --git a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php index d7881e077c41367dc31049621a31bd9c8f688608..21699d562eae7bbc9ca15727a357f15f11e4a680 100644 --- a/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Payment/Transaction/Collection.php @@ -33,7 +33,7 @@ namespace Magento\Paypal\Model\Resource\Payment\Transaction; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Created Before filter diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php index 65ed5deef9f74c1cc7937a31d425c02835eddc82..216f62e5ba264761138c7b66bae68c8c712f4aa9 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement.php @@ -28,7 +28,7 @@ namespace Magento\Paypal\Model\Resource\Report; /** * Report settlement resource model */ -class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb +class Settlement extends \Magento\Model\Resource\Db\AbstractDb { /** * Table name @@ -66,10 +66,10 @@ class Settlement extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save report rows collected in settlement model * - * @param \Magento\Core\Model\AbstractModel|\Magento\Paypal\Model\Report\Settlement $object + * @param \Magento\Model\AbstractModel|\Magento\Paypal\Model\Report\Settlement $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $rows = $object->getRows(); if (is_array($rows)) { diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php index 73de8f5017e2970e8971f7c64339c5177dd9ad43..667d4f9dc08989eb4c11ac45b7b932872bb04a27 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row.php @@ -32,7 +32,7 @@ namespace Magento\Paypal\Model\Resource\Report\Settlement; * @package Magento_Paypal * @author Magento Core Team <core@magentocommerce.com> */ -class Row extends \Magento\Core\Model\Resource\Db\AbstractDb +class Row extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource model initialization. diff --git a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php index 5027ae2b817febe0b0edbd8b4236c429e84044fc..59a1a1527e6415698081c94dd6fd5a392f83b463 100644 --- a/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php +++ b/app/code/Magento/Paypal/Model/Resource/Report/Settlement/Row/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Paypal\Model\Resource\Report\Settlement\Row; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initializing diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php index 9ab6440ed68ceedee7aaddf0dc468fc36cfb5d46..bca063327161dcbbfb30df27f151dd4e5de3c80c 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cert.php @@ -53,7 +53,7 @@ class Cert extends \Magento\Core\Model\Config\Value * @param \Magento\Paypal\Model\CertFactory $certFactory * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -65,7 +65,7 @@ class Cert extends \Magento\Core\Model\Config\Value \Magento\Paypal\Model\CertFactory $certFactory, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -79,7 +79,7 @@ class Cert extends \Magento\Core\Model\Config\Value * Process additional data before save config * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -97,7 +97,7 @@ class Cert extends \Magento\Core\Model\Config\Value ); if ($tmpPath && $this->_tmpDirectory->isExist($tmpPath)) { if (!$this->_tmpDirectory->stat($tmpPath)['size']) { - throw new \Magento\Core\Exception(__('The PayPal certificate file is empty.')); + throw new \Magento\Model\Exception(__('The PayPal certificate file is empty.')); } $this->setValue($_FILES['groups']['name'][$this->getGroupId()]['fields'][$this->getField()]['value']); $content = $this->_encryptor->encrypt($this->_tmpDirectory->readFile($tmpPath)); diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php index 0db219bc0d7a65f90d3e52b59abf60c706bca4ca..42112746d7be8d01bc04f7044c1de3b016467743 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/Cron.php @@ -42,7 +42,7 @@ class Cron extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Model\Config\ValueFactory $configValueFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Cron extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Model\Config\ValueFactory $configValueFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php index 440b778b0a1c43295d43aeb2895c594e5d129dcf..de2a6c6a8fc0483d1018b808445e7dce8bac162c 100644 --- a/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php +++ b/app/code/Magento/Paypal/Model/System/Config/Backend/MerchantCountry.php @@ -43,7 +43,7 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -53,7 +53,7 @@ class MerchantCountry extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\Core\Helper\Data $coreData, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml index 2588666802b185ca5133aedbdbfa4d0bb9413698..bd5d78e2c614214ecc1b184519d97a930babd021 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_cancelpayment.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/redirect.phtml"/> + template="payflowadvanced/redirect.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml index 98c418cb3cd03f123e3be332573b14aa8a44a2e7..141092800b9f2eab89b279009479c69ebc3e5c55 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_form.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/form.phtml"/> + template="payflowadvanced/form.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml index 2588666802b185ca5133aedbdbfa4d0bb9413698..bd5d78e2c614214ecc1b184519d97a930babd021 100644 --- a/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml +++ b/app/code/Magento/Paypal/view/frontend/layout/paypal_payflowadvanced_returnurl.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <block class="Magento\Paypal\Block\Payflow\Advanced\Iframe" name="payflow.advanced.iframe" output="1" - template="payflowadvanced/redirect.phtml"/> + template="payflowadvanced/redirect.phtml" cacheable="false"/> </layout> diff --git a/app/code/Magento/Persistent/Model/Persistent/Config.php b/app/code/Magento/Persistent/Model/Persistent/Config.php index d7553869bf50d6749ff6c7ed6f776ec3f27f5668..27b91bb55113df6cf735362766b0b55629571e2d 100644 --- a/app/code/Magento/Persistent/Model/Persistent/Config.php +++ b/app/code/Magento/Persistent/Model/Persistent/Config.php @@ -120,7 +120,7 @@ class Config * Get persistent XML config xpath * * @return \DOMXPath - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getConfigDomXPath() { @@ -129,7 +129,7 @@ class Config $isFile = $this->_modulesDirectory->isFile($filePath); $isReadable = $this->_modulesDirectory->isReadable($filePath); if (!$isFile || !$isReadable) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We cannot load the configuration from file %1.', $this->_configFilePath) ); } @@ -230,7 +230,7 @@ class Config * @param array $info * @param bool $instance * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function fireOne($info, $instance = false) { @@ -250,7 +250,7 @@ class Config if (method_exists($object, $method)) { $object->{$method}($instance); } elseif ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( 'Method "' . $method . '" is not defined in "' . get_class($object) . '"' ); } diff --git a/app/code/Magento/Persistent/Model/Resource/Session.php b/app/code/Magento/Persistent/Model/Resource/Session.php index 4535ba7b927f5db0666d2f6870731fff9c326a5f..8ef15f607081fd5a255ae56c21a47d7540440872 100644 --- a/app/code/Magento/Persistent/Model/Resource/Session.php +++ b/app/code/Magento/Persistent/Model/Resource/Session.php @@ -28,7 +28,7 @@ namespace Magento\Persistent\Model\Resource; /** * Persistent Session Resource Model */ -class Session extends \Magento\Core\Model\Resource\Db\AbstractDb +class Session extends \Magento\Model\Resource\Db\AbstractDb { /** * Use is object new method for object saving diff --git a/app/code/Magento/Persistent/Model/Session.php b/app/code/Magento/Persistent/Model/Session.php index 419b6a4818bfea69e4fcfd7c38090b933eadc537..0c4acc9c161538dc68ac5905d550f47812ab5c82 100644 --- a/app/code/Magento/Persistent/Model/Session.php +++ b/app/code/Magento/Persistent/Model/Session.php @@ -28,7 +28,7 @@ namespace Magento\Persistent\Model; /** * Persistent Session Model */ -class Session extends \Magento\Core\Model\AbstractModel +class Session extends \Magento\Model\AbstractModel { /** * Persistent cookie key length @@ -116,7 +116,7 @@ class Session extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Math\Random $mathRandom * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -130,7 +130,7 @@ class Session extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Math\Random $mathRandom, \Magento\Session\Config\ConfigInterface $sessionConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Helper/Data.php b/app/code/Magento/ProductAlert/Helper/Data.php index 04309d241f51605f9c6bacb6f06586a0d2b4fa30..fe488b07fce46a7567fabcd1c96ef0007003e804 100644 --- a/app/code/Magento/ProductAlert/Helper/Data.php +++ b/app/code/Magento/ProductAlert/Helper/Data.php @@ -152,7 +152,7 @@ class Data extends \Magento\Core\Helper\Url * * @param string|\Magento\View\Element\AbstractBlock $block * @return \Magento\View\Element\AbstractBlock - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createBlock($block) { @@ -162,7 +162,7 @@ class Data extends \Magento\Core\Helper\Url } } if (!$block instanceof \Magento\View\Element\AbstractBlock) { - throw new \Magento\Core\Exception(__('Invalid block type: %1', $block)); + throw new \Magento\Model\Exception(__('Invalid block type: %1', $block)); } return $block; } diff --git a/app/code/Magento/ProductAlert/Model/Email.php b/app/code/Magento/ProductAlert/Model/Email.php index 335b8cb7f89194b10ecfe3ab3d46875a90d2da78..e2a0b89352c17cdd0ff3c802a4e03ddc207a9508 100644 --- a/app/code/Magento/ProductAlert/Model/Email.php +++ b/app/code/Magento/ProductAlert/Model/Email.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Email extends \Magento\Core\Model\AbstractModel +class Email extends \Magento\Model\AbstractModel { const XML_PATH_EMAIL_PRICE_TEMPLATE = 'catalog/productalert/email_price_template'; @@ -132,7 +132,7 @@ class Email extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Core\Model\App\Emulation $appEmulation * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -145,7 +145,7 @@ class Email extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\App\Emulation $appEmulation, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Model/Observer.php b/app/code/Magento/ProductAlert/Model/Observer.php index 64bffd48e2cf327b2591db84a981695357eff3fc..88ecc5bf527e888067678a142b80a67b366b01c5 100644 --- a/app/code/Magento/ProductAlert/Model/Observer.php +++ b/app/code/Magento/ProductAlert/Model/Observer.php @@ -119,11 +119,6 @@ class Observer */ protected $_stockColFactory; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Mail\Template\TransportBuilder */ @@ -134,6 +129,11 @@ class Observer */ protected $_emailFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -143,9 +143,9 @@ class Observer * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory * @param \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory - * @param \Magento\TranslateInterface $translate * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\ProductAlert\Model\EmailFactory $emailFactory + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Tax\Helper\Data $taxData, @@ -156,9 +156,9 @@ class Observer \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, \Magento\ProductAlert\Model\Resource\Stock\CollectionFactory $stockColFactory, - \Magento\TranslateInterface $translate, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\ProductAlert\Model\EmailFactory $emailFactory + \Magento\ProductAlert\Model\EmailFactory $emailFactory, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_taxData = $taxData; $this->_coreStoreConfig = $coreStoreConfig; @@ -168,9 +168,9 @@ class Observer $this->_productFactory = $productFactory; $this->_dateFactory = $dateFactory; $this->_stockColFactory = $stockColFactory; - $this->_translate = $translate; $this->_transportBuilder = $transportBuilder; $this->_emailFactory = $emailFactory; + $this->inlineTranslation = $inlineTranslation; } /** @@ -378,7 +378,7 @@ class Observer return $this; } - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $transport = $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -397,7 +397,7 @@ class Observer $transport->sendMessage(); - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->_errors[] = array(); } return $this; diff --git a/app/code/Magento/ProductAlert/Model/Price.php b/app/code/Magento/ProductAlert/Model/Price.php index e330666e80dca004a97fce34676868a40160b399..6582d6ecf1a4ce0ebe8bee02918fab0fed6599b7 100644 --- a/app/code/Magento/ProductAlert/Model/Price.php +++ b/app/code/Magento/ProductAlert/Model/Price.php @@ -53,7 +53,7 @@ use Resource\Price\Customer\Collection; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Price extends \Magento\Core\Model\AbstractModel +class Price extends \Magento\Model\AbstractModel { /** * @var \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory @@ -64,7 +64,7 @@ class Price extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -72,7 +72,7 @@ class Price extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\ProductAlert\Model\Resource\Price\Customer\CollectionFactory $customerColFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php b/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php index a2b4380e28cb337afaeba013ffd2538a91577a7a..75c9c649a8ab3c39fec5a2f6ae4d1ae566871b31 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php +++ b/app/code/Magento/ProductAlert/Model/Resource/AbstractResource.php @@ -32,15 +32,15 @@ namespace Magento\ProductAlert\Model\Resource; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Retrieve alert row by object parameters * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array|false */ - protected function _getAlertRow(\Magento\Core\Model\AbstractModel $object) + protected function _getAlertRow(\Magento\Model\AbstractModel $object) { $adapter = $this->_getReadAdapter(); if ($object->getCustomerId() && $object->getProductId() && $object->getWebsiteId()) { @@ -66,10 +66,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Load object data by parameters * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function loadByParam(\Magento\Core\Model\AbstractModel $object) + public function loadByParam(\Magento\Model\AbstractModel $object) { $row = $this->_getAlertRow($object); if ($row) { @@ -81,12 +81,12 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Delete all customer alerts on website * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param int $customerId * @param int $websiteId * @return $this */ - public function deleteCustomer(\Magento\Core\Model\AbstractModel $object, $customerId, $websiteId = null) + public function deleteCustomer(\Magento\Model\AbstractModel $object, $customerId, $websiteId = null) { $adapter = $this->_getWriteAdapter(); $where = array(); diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price.php b/app/code/Magento/ProductAlert/Model/Resource/Price.php index 64678c44e32c0359a04daa50e3090cbf05b31b33..165949255c901759c5806def2f532d9be4340ebe 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price.php @@ -58,10 +58,10 @@ class Price extends \Magento\ProductAlert\Model\Resource\AbstractResource /** * Before save process, check exists the same alert * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php index 87ae940cc543a4397cf176c777fd70a5f07dc4ba..726efb6163284c19e95f5ac1d0911b46e7ee24f1 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Price/Collection.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model\Resource\Price; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define price collection diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock.php b/app/code/Magento/ProductAlert/Model/Resource/Stock.php index 421f7bc7efb30161e50d0cdd44c7c12f426b95bb..7dea67151e288728cd972b7bf1791cc9fb5fb1f1 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock.php @@ -58,10 +58,10 @@ class Stock extends \Magento\ProductAlert\Model\Resource\AbstractResource /** * Before save action * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if (is_null($object->getId()) && $object->getCustomerId() && $object->getProductId() && $object->getWebsiteId() ) { diff --git a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php index 1d48138fb5c97c65787e89d5e390025d61421656..fc8bc4166333c36c6e1284b82eb390bc48018b75 100644 --- a/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php +++ b/app/code/Magento/ProductAlert/Model/Resource/Stock/Collection.php @@ -32,7 +32,7 @@ namespace Magento\ProductAlert\Model\Resource\Stock; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define stock collection diff --git a/app/code/Magento/ProductAlert/Model/Stock.php b/app/code/Magento/ProductAlert/Model/Stock.php index d21faef6f481693e676d1c4ba442a92d32c480bf..eabf55c333227aae1061524b4d294d4ff29adfe2 100644 --- a/app/code/Magento/ProductAlert/Model/Stock.php +++ b/app/code/Magento/ProductAlert/Model/Stock.php @@ -51,7 +51,7 @@ use Resource\Price\Customer\Collection; * @package Magento_ProductAlert * @author Magento Core Team <core@magentocommerce.com> */ -class Stock extends \Magento\Core\Model\AbstractModel +class Stock extends \Magento\Model\AbstractModel { /** * @var \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory @@ -62,7 +62,7 @@ class Stock extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -70,7 +70,7 @@ class Stock extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\ProductAlert\Model\Resource\Stock\Customer\CollectionFactory $customerColFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rating/Model/Rating.php b/app/code/Magento/Rating/Model/Rating.php index 6dd429fbe770306747f74145ec72332be9d32be8..b1263291b3429fcdbb190934cc9b63143543850c 100644 --- a/app/code/Magento/Rating/Model/Rating.php +++ b/app/code/Magento/Rating/Model/Rating.php @@ -40,7 +40,7 @@ namespace Magento\Rating\Model; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Rating extends \Magento\Core\Model\AbstractModel +class Rating extends \Magento\Model\AbstractModel { /** * rating entity codes @@ -66,7 +66,7 @@ class Rating extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -75,7 +75,7 @@ class Rating extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Rating\Model\Rating\OptionFactory $ratingOptionFactory, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rating/Model/Rating/Entity.php b/app/code/Magento/Rating/Model/Rating/Entity.php index 0dbdd83441941afac1de72f21b9041eb35d6749c..1fdfd8be8307efcc7c2dc3f94263b6038ce73229 100644 --- a/app/code/Magento/Rating/Model/Rating/Entity.php +++ b/app/code/Magento/Rating/Model/Rating/Entity.php @@ -37,7 +37,7 @@ namespace Magento\Rating\Model\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Entity extends \Magento\Core\Model\AbstractModel +class Entity extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Rating/Option.php b/app/code/Magento/Rating/Model/Rating/Option.php index dbe44a951546710ba626f1b176992dc0eb438e61..d9011e622a630f4cb08818e3ec30b8cad3515685 100644 --- a/app/code/Magento/Rating/Model/Rating/Option.php +++ b/app/code/Magento/Rating/Model/Rating/Option.php @@ -43,7 +43,7 @@ namespace Magento\Rating\Model\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\AbstractModel +class Option extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Rating/Option/Vote.php b/app/code/Magento/Rating/Model/Rating/Option/Vote.php index 0b74a01b6b99d3a09f50caaef9237989893fadbb..823a655a25726dd24c1611d880881e8d40b3668c 100644 --- a/app/code/Magento/Rating/Model/Rating/Option/Vote.php +++ b/app/code/Magento/Rating/Model/Rating/Option/Vote.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Vote extends \Magento\Core\Model\AbstractModel +class Vote extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Rating/Model/Resource/Rating.php b/app/code/Magento/Rating/Model/Resource/Rating.php index 2e79ae98c5e9f708eb4f60b6ed8491c51c2baef3..2e8911c20cf790fb9099ef93aaf14dee27c4846b 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating.php +++ b/app/code/Magento/Rating/Model/Resource/Rating.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rating extends \Magento\Model\Resource\Db\AbstractDb { const RATING_STATUS_APPROVED = 'Approved'; @@ -131,10 +131,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { parent::_afterLoad($object); @@ -184,10 +184,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Actions after save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Rating\Model\Rating $object + * @param \Magento\Model\AbstractModel|\Magento\Rating\Model\Rating $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { parent::_afterSave($object); @@ -273,10 +273,10 @@ class Rating extends \Magento\Core\Model\Resource\Db\AbstractDb * Perform actions after object delete * Prepare rating data for reaggregate all data for reviews * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { parent::_afterDelete($object); if (!$this->_ratingData->isModuleEnabled('Magento_Review')) { diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php index d3a83dd6ecdb5622f7a586071aa69dbbbd299038..4d987a1940880c41562ec90439c2f568147f83f2 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -58,7 +58,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -68,7 +68,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_ratingCollectionF = $ratingCollectionF; diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php b/app/code/Magento/Rating/Model/Resource/Rating/Entity.php index 6776ce46048d669d6b80461c60bcc3cca861215c..a20d688c1d75b2121f376174ed50dc10ebd3b7fb 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Entity.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Entity.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Entity extends \Magento\Core\Model\Resource\Db\AbstractDb +class Entity extends \Magento\Model\Resource\Db\AbstractDb { /** * Rating entity resource initialization diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php index 0896a9dd4a26fa52ffb6634a0f865ab1ab71a914..83e37040cfcd13c28400f75b7dfec1edb98ecd82 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Grid/Collection.php @@ -50,7 +50,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param \Magento\Registry $coreRegistry * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -61,7 +61,7 @@ class Collection extends \Magento\Rating\Model\Resource\Rating\Collection \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, \Magento\Registry $coreRegistry, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_coreRegistry = $coreRegistry; parent::__construct( diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option.php b/app/code/Magento/Rating/Model/Resource/Rating/Option.php index 9369bbf48e5d75fdcc646f66bfa3ec2ace19b81b..b1f8172851ba581ffd363314f3ab79b889b26b7b 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Review table diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php index 59273ca55a5e8b3f77c1e2700b02d9e718545ba4..d0be239875288817d9bd043341a3774a6b2a369e 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Rating votes table diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php index adb62a50f33ccfa0c1c71e4a6cf8e356d670c7f7..9612a6ecbc357fa7ccdf11871b60de34a9813e00 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Vote extends \Magento\Core\Model\Resource\Db\AbstractDb +class Vote extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php index 1d6ce8582b36601bed96393750a74c7d4f8e3a71..179fb83076ee6212e64baea2f1fb8c6f4414b500 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Option/Vote/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Rating\Model\Resource\Rating\Option\Vote; * @package Magento_Rating * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store list manager @@ -54,7 +54,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Rating\Model\Resource\Rating\Option\CollectionFactory $ratingCollectionF, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; $this->_ratingCollectionF = $ratingCollectionF; diff --git a/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php b/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php index 698813ef857d77cf1c056261726dea4fecf8acd2..dcce70c581009c53a8722575c0013754fa524515 100644 --- a/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php +++ b/app/code/Magento/RecurringPayment/Block/Adminhtml/Payment/View/Items.php @@ -40,7 +40,7 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } parent::_beforeToHtml(); } diff --git a/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php b/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php index 975f0d11b1c4fa2546251d213638d753795dd2e8..1a68efb3b7c3440d58ddde9eac0c4111d51e3230 100644 --- a/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Controller/Adminhtml/RecurringPayment.php @@ -24,7 +24,7 @@ namespace Magento\RecurringPayment\Controller\Adminhtml; use Magento\App\Action\NotFoundException; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; use Magento\Customer\Controller\RegistryConstants; /** @@ -244,7 +244,7 @@ class RecurringPayment extends \Magento\Backend\App\Action * Load/set payment * * @return \Magento\RecurringPayment\Model\Payment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initPayment() { diff --git a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php index 7161394f7fe2b547108275e94c3704d08eaf0529..0ab0ef6b0bf6907eb7b662c3864cf41b776ed276 100644 --- a/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Controller/RecurringPayment.php @@ -28,6 +28,7 @@ namespace Magento\RecurringPayment\Controller; use Magento\App\RequestInterface; +use Magento\Customer\Controller\RegistryConstants; class RecurringPayment extends \Magento\App\Action\Action { @@ -79,7 +80,9 @@ class RecurringPayment extends \Magento\App\Action\Action if (!$this->_session->authenticate($this)) { $this->_actionFlag->set('', 'no-dispatch', true); } - $this->_coreRegistry->register('current_customer', $this->_session->getCustomer()); + $customer = $this->_session->getCustomer(); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER, $customer); + $this->_coreRegistry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customer->getId()); return parent::dispatch($request); } @@ -141,7 +144,7 @@ class RecurringPayment extends \Magento\App\Action\Action break; } $this->messageManager->addSuccess(__('The payment state has been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -171,7 +174,7 @@ class RecurringPayment extends \Magento\App\Action\Action } else { $this->messageManager->addNotice(__('The payment has no changes.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -199,7 +202,7 @@ class RecurringPayment extends \Magento\App\Action\Action $this->_view->getLayout()->initMessages(); $this->_view->renderLayout(); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); @@ -211,7 +214,7 @@ class RecurringPayment extends \Magento\App\Action\Action * Instantiate current payment and put it into registry * * @return \Magento\RecurringPayment\Model\Payment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initPayment() { @@ -221,7 +224,7 @@ class RecurringPayment extends \Magento\App\Action\Action $this->getRequest()->getParam('payment') ); if (!$payment->getId()) { - throw new \Magento\Core\Exception(__('We can\'t find the payment you specified.')); + throw new \Magento\Model\Exception(__('We can\'t find the payment you specified.')); } $this->_coreRegistry->register('current_recurring_payment', $payment); return $payment; diff --git a/app/code/Magento/RecurringPayment/Model/ManagerInterface.php b/app/code/Magento/RecurringPayment/Model/ManagerInterface.php index 54fbe75207e64df4ab64c4a26cfa014452028660..3bf7d6cec466e225e9751b378652d4c31053d309 100644 --- a/app/code/Magento/RecurringPayment/Model/ManagerInterface.php +++ b/app/code/Magento/RecurringPayment/Model/ManagerInterface.php @@ -36,7 +36,7 @@ interface ManagerInterface * * @param RecurringPayment $payment * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate(RecurringPayment $payment); diff --git a/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php b/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php index e014a908df70048aded11e28533b16388736e7a7..5493e87436e16d385cf7bce2dd0de32fa08eb8dc 100644 --- a/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php +++ b/app/code/Magento/RecurringPayment/Model/Observer/CheckoutManagerObserver.php @@ -57,14 +57,14 @@ class CheckoutManagerObserver * * @param \Magento\Event\Observer $observer * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function submitRecurringPayments($observer) { $this->_recurringPayments = $this->_quoteImporter->import($observer->getEvent()->getQuote()); foreach ($this->_recurringPayments as $payment) { if (!$payment->isValid()) { - throw new \Magento\Core\Exception($payment->getValidationErrors()); + throw new \Magento\Model\Exception($payment->getValidationErrors()); } $payment->submit(); } diff --git a/app/code/Magento/RecurringPayment/Model/Payment.php b/app/code/Magento/RecurringPayment/Model/Payment.php index f5c09e84e07a31f82684489305862b3099e70e1a..ab76d3cc60529d0af14ab6716e2792cb4bc039df 100644 --- a/app/code/Magento/RecurringPayment/Model/Payment.php +++ b/app/code/Magento/RecurringPayment/Model/Payment.php @@ -141,7 +141,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory * @param \Magento\Math\Random $mathRandom * @param States $states - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -162,7 +162,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, \Magento\Math\Random $mathRandom, States $states, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -625,7 +625,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment * @param string $againstState * @param bool $soft * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _checkWorkflow($againstState, $soft = true) { @@ -633,7 +633,7 @@ class Payment extends \Magento\RecurringPayment\Model\RecurringPayment $state = $this->getState(); $result = !empty($this->_workflow[$state]) && in_array($againstState, $this->_workflow[$state]); if (!$soft && !$result) { - throw new \Magento\Core\Exception(__('This payment state cannot be changed to "%1".', $againstState)); + throw new \Magento\Model\Exception(__('This payment state cannot be changed to "%1".', $againstState)); } return $result; } diff --git a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php index 2d06560a92aa9b56c95980e90b40ffb1c8c30a9f..7bb51257c5627eb9bdf264efed5276e793d646aa 100644 --- a/app/code/Magento/RecurringPayment/Model/RecurringPayment.php +++ b/app/code/Magento/RecurringPayment/Model/RecurringPayment.php @@ -38,7 +38,7 @@ namespace Magento\RecurringPayment\Model; * @method RecurringPayment setToken() * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class RecurringPayment extends \Magento\Core\Model\AbstractModel +class RecurringPayment extends \Magento\Model\AbstractModel { /** * Constants for passing data through catalog @@ -117,7 +117,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * @param ManagerInterfaceFactory $managerFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -132,7 +132,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel ManagerInterfaceFactory $managerFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -223,7 +223,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel if ($this->_manager) { try { $this->_manager->validate($this); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_errors['payment_method'][] = $e->getMessage(); } } @@ -235,7 +235,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * Getter for errors that may appear after validation * * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getValidationErrors() { @@ -244,7 +244,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel foreach ($this->_errors as $row) { $result[] = implode(' ', $row); } - throw new \Magento\Core\Exception(__("The payment is invalid:\n%1.", implode("\n", $result))); + throw new \Magento\Model\Exception(__("The payment is invalid:\n%1.", implode("\n", $result))); } return $this->_errors; } @@ -268,7 +268,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * * @param \Magento\Object $buyRequest * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function importBuyRequest(\Magento\Object $buyRequest) @@ -283,7 +283,7 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel ); $localeCode = $this->_localeResolver->getLocaleCode(); if (!\Zend_Date::isDate($startDate, $dateFormat, $localeCode)) { - throw new \Magento\Core\Exception(__('The recurring payment start date has invalid format.')); + throw new \Magento\Model\Exception(__('The recurring payment start date has invalid format.')); } $utcTime = $this->_localeDate->utcDate( $this->_store, @@ -525,15 +525,15 @@ class RecurringPayment extends \Magento\Core\Model\AbstractModel * Perform full validation before saving * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateBeforeSave() { if (!$this->isValid()) { - throw new \Magento\Core\Exception($this->getValidationErrors()); + throw new \Magento\Model\Exception($this->getValidationErrors()); } if (!$this->getInternalReferenceId()) { - throw new \Magento\Core\Exception(__('An internal reference ID is required to save the payment.')); + throw new \Magento\Model\Exception(__('An internal reference ID is required to save the payment.')); } } diff --git a/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php b/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php index b82f7ceecf53cda90da3ccbe00f61157f93fa4f0..6194b8f4f25fb24ab8c571e8edd6763878e85818 100644 --- a/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php +++ b/app/code/Magento/RecurringPayment/Model/Resource/Order/CollectionFilter.php @@ -33,7 +33,7 @@ class CollectionFilter /** * Add filter by specified recurring payment id(s) * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection * @param array|int $ids * @return \Magento\Sales\Model\Resource\Order\Collection */ diff --git a/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php b/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php index ece00325143e5bfaedf6ab2bde937a3cc5e8fd2a..b8b326a00f0468c406e3e149065ebc0c943d97be 100644 --- a/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php +++ b/app/code/Magento/RecurringPayment/Model/Resource/Payment/Collection.php @@ -26,7 +26,7 @@ namespace Magento\RecurringPayment\Model\Resource\Payment; /** * Recurring payment collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php index f0260c9fe644408f59a1b046621a99bea04835d4..5e238032539f9499b369f002d617f42fbc1a3839 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Customer.php @@ -48,7 +48,7 @@ class Customer extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstra return sprintf( '<a href="%s">%s</a>', - $this->getUrl('catalog/product_review/', array('customerId' => $id)), + $this->getUrl('review/product/', array('customerId' => $id)), __('Show Reviews') ); } diff --git a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php index a40e633e4a3ba00b93884bfe933fb5fbe2e2dec3..3cceacd6c628906797a66c6ed81beb7d171dda8b 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Grid/Column/Renderer/Product.php @@ -44,7 +44,7 @@ class Product extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\Abstrac return sprintf( '<a href="%s">%s</a>', - $this->getUrl('catalog/product_review/', array('productId' => $id)), + $this->getUrl('review/product/', array('productId' => $id)), __('Show Reviews') ); } diff --git a/app/code/Magento/Reports/Block/Product/AbstractProduct.php b/app/code/Magento/Reports/Block/Product/AbstractProduct.php index e863d23add409ef97e08bcc4dca8d2025a2826e1..f1c231cd009aa7ec259f02556e948a4985baa1a0 100644 --- a/app/code/Magento/Reports/Block/Product/AbstractProduct.php +++ b/app/code/Magento/Reports/Block/Product/AbstractProduct.php @@ -57,36 +57,14 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr protected $_indexFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Reports\Model\Product\Index\Factory $indexFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Reports\Model\Product\Index\Factory $indexFactory, array $data = array(), @@ -94,16 +72,6 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr ) { parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); @@ -145,7 +113,7 @@ abstract class AbstractProduct extends \Magento\Catalog\Block\Product\AbstractPr try { $model = $this->_indexFactory->get($this->_indexType); } catch (\InvalidArgumentException $e) { - new \Magento\Core\Exception(__('Index type is not valid')); + new \Magento\Model\Exception(__('Index type is not valid')); } return $model; diff --git a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php index 35995f9b16ed1ce6ff396c159a3405ed868777b7..6a5a28d0fa647c0befd762c1268dde870deb8c0d 100644 --- a/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php +++ b/app/code/Magento/Reports/Controller/Adminhtml/Report/Statistics.php @@ -169,7 +169,7 @@ class Statistics extends \Magento\Backend\App\Action $this->_objectManager->create($collectionName)->aggregate($date); } $this->messageManager->addSuccess(__('Recent statistics have been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t refresh recent statistics.')); @@ -196,7 +196,7 @@ class Statistics extends \Magento\Backend\App\Action $this->_objectManager->create($collectionName)->aggregate(); } $this->messageManager->addSuccess(__('We updated lifetime statistics.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t refresh lifetime statistics.')); diff --git a/app/code/Magento/Reports/Model/Event.php b/app/code/Magento/Reports/Model/Event.php index 96c79b4470676bc772884b4bbbc1a001f0888640..a1a7b2edb0b47821ba55c2e8ff811c61e459ee25 100644 --- a/app/code/Magento/Reports/Model/Event.php +++ b/app/code/Magento/Reports/Model/Event.php @@ -47,7 +47,7 @@ namespace Magento\Reports\Model; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Event extends \Magento\Core\Model\AbstractModel +class Event extends \Magento\Model\AbstractModel { const EVENT_PRODUCT_VIEW = 1; @@ -76,7 +76,7 @@ class Event extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory * @param \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -85,7 +85,7 @@ class Event extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, \Magento\Reports\Model\Event\TypeFactory $eventTypeFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Reports/Model/Event/Type.php b/app/code/Magento/Reports/Model/Event/Type.php index 1459460b87859296aaf8018cab2f4e1e36e9878a..f5f9b55bfbc714f2b062826305b7525989a8c72f 100644 --- a/app/code/Magento/Reports/Model/Event/Type.php +++ b/app/code/Magento/Reports/Model/Event/Type.php @@ -39,7 +39,7 @@ namespace Magento\Reports\Model\Event; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Type extends \Magento\Core\Model\AbstractModel +class Type extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Reports/Model/Flag.php b/app/code/Magento/Reports/Model/Flag.php index 1e72f008e48a64390e0177f84c0c2e6e82377d87..77effab7f1293982a754b041843010ff64055669 100644 --- a/app/code/Magento/Reports/Model/Flag.php +++ b/app/code/Magento/Reports/Model/Flag.php @@ -32,7 +32,7 @@ namespace Magento\Reports\Model; * @package Magento_Reports * @author Magento Core Team <core@magentocommerce.com> */ -class Flag extends \Magento\Core\Model\Flag +class Flag extends \Magento\Flag { const REPORT_ORDER_FLAG_CODE = 'report_order_aggregated'; diff --git a/app/code/Magento/Reports/Model/Grouped/Collection.php b/app/code/Magento/Reports/Model/Grouped/Collection.php index c3155074e3f8f37c6b2375170af201d2327a7774..5c90c6b3229c82545c190441ea231d5b00dc2274 100644 --- a/app/code/Magento/Reports/Model/Grouped/Collection.php +++ b/app/code/Magento/Reports/Model/Grouped/Collection.php @@ -27,7 +27,7 @@ namespace Magento\Reports\Model\Grouped; use Magento\Data\Collection\Db; -class Collection extends \Magento\Data\Collection //\Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Data\Collection { /** * Column name for group by clause @@ -39,7 +39,7 @@ class Collection extends \Magento\Data\Collection //\Magento\Core\Model\Resource /** * Collection resource * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_resourceCollection = null; diff --git a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php index 34193fb31e554cbdfc267d7313a703f83bf3ece0..a8da1919015549da861bacdfc644e5b9fa6d09e7 100644 --- a/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Product/Index/AbstractIndex.php @@ -28,7 +28,7 @@ namespace Magento\Reports\Model\Product\Index; /** * Reports Product Index Abstract Model */ -abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel +abstract class AbstractIndex extends \Magento\Model\AbstractModel { /** * Cache key name for Count of product index @@ -76,7 +76,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel * @param \Magento\Session\Generic $reportSession * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\AbstractModel \Magento\Session\Generic $reportSession, \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Reports/Model/Product/Index/Compared.php b/app/code/Magento/Reports/Model/Product/Index/Compared.php index d30844c34f35e04abb0e998a074c92e31a80a248..3994a86183fe9de84b2254dbf771534af123f22d 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Compared.php +++ b/app/code/Magento/Reports/Model/Product/Index/Compared.php @@ -68,7 +68,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex * @param \Magento\Catalog\Model\Product\Visibility $productVisibility * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Catalog\Helper\Product\Compare $productCompare - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -82,7 +82,7 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex \Magento\Catalog\Model\Product\Visibility $productVisibility, \Magento\Stdlib\DateTime $dateTime, \Magento\Catalog\Helper\Product\Compare $productCompare, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -126,8 +126,8 @@ class Compared extends \Magento\Reports\Model\Product\Index\AbstractIndex } } - if ($this->_coreRegistry->registry('current_product')) { - $productIds[] = $this->_coreRegistry->registry('current_product')->getId(); + if ($this->_registry->registry('current_product')) { + $productIds[] = $this->_registry->registry('current_product')->getId(); } return array_unique($productIds); diff --git a/app/code/Magento/Reports/Model/Product/Index/Viewed.php b/app/code/Magento/Reports/Model/Product/Index/Viewed.php index 2188535875a5add2018da4f243d31f4e14bb78f9..93c32b37bfc45660d54d4d4b604c5e47fa147a6d 100644 --- a/app/code/Magento/Reports/Model/Product/Index/Viewed.php +++ b/app/code/Magento/Reports/Model/Product/Index/Viewed.php @@ -70,8 +70,8 @@ class Viewed extends \Magento\Reports\Model\Product\Index\AbstractIndex { $productIds = array(); - if ($this->_coreRegistry->registry('current_product')) { - $productIds[] = $this->_coreRegistry->registry('current_product')->getId(); + if ($this->_registry->registry('current_product')) { + $productIds[] = $this->_registry->registry('current_product')->getId(); } return $productIds; diff --git a/app/code/Magento/Reports/Model/Resource/Event.php b/app/code/Magento/Reports/Model/Resource/Event.php index dc68e78332b9f62044b8781e040129c5178a95f3..423ae58eb5df2fa9c357f42d688269b69d8e53fd 100644 --- a/app/code/Magento/Reports/Model/Resource/Event.php +++ b/app/code/Magento/Reports/Model/Resource/Event.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource; -class Event extends \Magento\Core\Model\Resource\Db\AbstractDb +class Event extends \Magento\Model\Resource\Db\AbstractDb { /** * Core store config diff --git a/app/code/Magento/Reports/Model/Resource/Event/Collection.php b/app/code/Magento/Reports/Model/Resource/Event/Collection.php index f0ed8c74f9ea7e424050ff7e4025d33345b9dae2..542c82c0a1e3181946b6f25538ae163baa075d2f 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store Ids diff --git a/app/code/Magento/Reports/Model/Resource/Event/Type.php b/app/code/Magento/Reports/Model/Resource/Event/Type.php index 7ec67e7afc4e94bcb1b2d566a3d01bfd7ba116d7..30fb1d00cfa798c77e2e79b4e1ff2f77647ef349 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Type.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Type.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event; -class Type extends \Magento\Core\Model\Resource\Db\AbstractDb +class Type extends \Magento\Model\Resource\Db\AbstractDb { /** * Main table initialization diff --git a/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php b/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php index 524ca542b15f590357ab6d01de12a60960bc0b81..fdb69772690a9957e5bb7851a0848cc00511b3c0 100644 --- a/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Event/Type/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Event\Type; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Reports/Model/Resource/Helper.php b/app/code/Magento/Reports/Model/Resource/Helper.php index 489e6f42d0ce4a6293ab1cd16878fac82bab9ce2..499c52e287940207aecc1f147d5aa18786a85e6c 100644 --- a/app/code/Magento/Reports/Model/Resource/Helper.php +++ b/app/code/Magento/Reports/Model/Resource/Helper.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource; -class Helper extends \Magento\Core\Model\Resource\Helper implements \Magento\Reports\Model\Resource\HelperInterface +class Helper extends \Magento\DB\Helper implements \Magento\Reports\Model\Resource\HelperInterface { /** * @param \Magento\App\Resource $resource diff --git a/app/code/Magento/Reports/Model/Resource/HelperInterface.php b/app/code/Magento/Reports/Model/Resource/HelperInterface.php index d48f3168591c5a3ceae978aa93be37c6807efa93..5431e877231c28a78a1d9ae57fd62fbbe41da671 100644 --- a/app/code/Magento/Reports/Model/Resource/HelperInterface.php +++ b/app/code/Magento/Reports/Model/Resource/HelperInterface.php @@ -48,7 +48,7 @@ interface HelperInterface * @param string $column * @param string $mainTable * @param string $aggregationTable - * @return \Magento\Core\Model\Resource\Helper\AbstractHelper + * @return \Magento\DB\Helper\AbstractHelper */ public function updateReportRatingPos($type, $column, $mainTable, $aggregationTable); } diff --git a/app/code/Magento/Reports/Model/Resource/Order/Collection.php b/app/code/Magento/Reports/Model/Resource/Order/Collection.php index 6e25ebdaa266f616285f7fd93fe4dbcc3aa66de7..bd94f6612a6113eea82a1d28813f024b554c01e6 100644 --- a/app/code/Magento/Reports/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Order/Collection.php @@ -80,15 +80,15 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper + * @param \Magento\DB\Helper $coreResourceHelper * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Sales\Model\Order\Config $orderConfig * @param \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource - * + * @param \Magento\Model\Resource\Db\AbstractDb $resource + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -96,14 +96,14 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $coreResourceHelper, + \Magento\DB\Helper $coreResourceHelper, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Sales\Model\Order\Config $orderConfig, \Magento\Sales\Model\Resource\Report\OrderFactory $reportOrderFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct( $entityFactory, diff --git a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php index 9d7e4affb42e3badde4b6e1a2f2b7d427f8677ec..fd3aefaaa4f8e3035be686461306884629a8446d 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Index/AbstractIndex.php @@ -28,7 +28,7 @@ namespace Magento\Reports\Model\Resource\Product\Index; /** * Reports Product Index Abstract Resource Model */ -abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractIndex extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime @@ -36,22 +36,22 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb protected $dateTime; /** - * @var \Magento\Reports\Model\Resource\HelperFactory + * @var \Magento\Reports\Model\Resource\Helper */ - protected $_helperFactory; + protected $_resourceHelper; /** * @param \Magento\App\Resource $resource - * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory + * @param \Magento\Reports\Model\Resource\Helper $resourceHelper * @param \Magento\Stdlib\DateTime $dateTime */ public function __construct( \Magento\App\Resource $resource, - \Magento\Reports\Model\Resource\HelperFactory $helperFactory, + \Magento\Reports\Model\Resource\Helper $resourceHelper, \Magento\Stdlib\DateTime $dateTime ) { parent::__construct($resource); - $this->_helperFactory = $helperFactory; + $this->_resourceHelper = $resourceHelper; $this->dateTime = $dateTime; } @@ -141,10 +141,10 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save Product Index data (forced save) * - * @param \Magento\Core\Model\AbstractModel $object - * @return $this|\Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel $object + * @return $this|\Magento\Model\Resource\Db\AbstractDb */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if ($object->isDeleted()) { return $this->delete($object); @@ -159,8 +159,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb $matchFields = array('product_id', 'store_id'); - $this->_helperFactory->create()->mergeVisitorProductIndex($this->getMainTable(), $data, $matchFields); - + $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $data, $matchFields); $this->unserializeFields($object); $this->_afterSave($object); @@ -233,7 +232,7 @@ abstract class AbstractIndex extends \Magento\Core\Model\Resource\Db\AbstractDb $matchFields = array('product_id', 'store_id'); foreach ($data as $row) { - $this->_helperFactory->create()->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields); + $this->_resourceHelper->mergeVisitorProductIndex($this->getMainTable(), $row, $matchFields); } return $this; } diff --git a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php index 8869328b5bd6872a1a5c0305a63f4c9ec87cc6db..7df5ea0568a5bc03983fe40a46290f15a9099775 100644 --- a/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Product/Lowstock/Collection.php @@ -256,7 +256,7 @@ class Collection extends \Magento\Reports\Model\Resource\Product\Collection public function filterByProductType($typeFilter) { if (!is_string($typeFilter) && !is_array($typeFilter)) { - new \Magento\Core\Exception(__('The product type filter specified is incorrect.')); + new \Magento\Model\Exception(__('The product type filter specified is incorrect.')); } $this->addAttributeToFilter('type_id', $typeFilter); return $this; diff --git a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php index 1abcf7617a798104c017710b97045da5a027c392..63050477abb0b47ad8cd39fcbdb251c175efbf0e 100644 --- a/app/code/Magento/Reports/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Quote/Collection.php @@ -75,7 +75,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection * @param \Magento\Catalog\Model\Resource\Product\Collection $productResource * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param null $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -85,7 +85,7 @@ class Collection extends \Magento\Sales\Model\Resource\Quote\Collection \Magento\Catalog\Model\Resource\Product\Collection $productResource, \Magento\Customer\Model\Resource\Customer $customerResource, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_productResource = $productResource; diff --git a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php index a980e3d946eb4dcdbde4e620edcd6b90324f2b82..7ba5d1c5fdc6bacfd6d9691f8eccebce5df2b71f 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php +++ b/app/code/Magento/Reports/Model/Resource/Report/AbstractReport.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Report; -abstract class AbstractReport extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractReport extends \Magento\Model\Resource\Db\AbstractDb { /** * Flag object diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection.php index f0ca912b42f1b478c9b362f7f31decb13bb30575..2da872666f30eeb6563c963a3d3d5d87073b8c92 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection.php @@ -356,7 +356,7 @@ class Collection extends \Magento\Data\Collection * * @param int $fromDate * @param int $toDate - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _getReport($fromDate, $toDate) { diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php index beceb075268ada96f9d141be81e2a49495a5e026..c97674cbe12d4efd00ffdf4583fcb8c4df6c990a 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection/AbstractCollection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Report\Collection; -class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * From date diff --git a/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php b/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php index aea1fd6e504245b15f2ceccbf4e9289689c8076d..e448cef0649e06ba5f18524c5c0de43c6bb3e716 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Collection/Factory.php @@ -43,7 +43,7 @@ class Factory * * @param string $className * @param array $arguments - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function create($className, array $arguments = array()) { diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php index bc2e6b3420bfaa8cf564c17e5aeccb5a8c77386c..131a567eec21bf7fd5c00084ca24e5d2031bd9d2 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed.php @@ -57,9 +57,9 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport protected $_productResource; /** - * @var \Magento\Reports\Model\Resource\HelperFactory + * @var \Magento\Reports\Model\Resource\Helper */ - protected $_helperFactory; + protected $_resourceHelper; /** * @param \Magento\App\Resource $resource @@ -69,7 +69,7 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Stdlib\DateTime\Timezone\Validator $timezoneValidator * @param \Magento\Catalog\Model\Resource\Product $productResource - * @param \Magento\Reports\Model\Resource\HelperFactory $helperFactory + * @param \Magento\Reports\Model\Resource\Helper $resourceHelper */ public function __construct( \Magento\App\Resource $resource, @@ -79,11 +79,11 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport \Magento\Stdlib\DateTime $dateTime, \Magento\Stdlib\DateTime\Timezone\Validator $timezoneValidator, \Magento\Catalog\Model\Resource\Product $productResource, - \Magento\Reports\Model\Resource\HelperFactory $helperFactory + \Magento\Reports\Model\Resource\Helper $resourceHelper ) { parent::__construct($resource, $logger, $localeDate, $reportsFlagFactory, $dateTime, $timezoneValidator); $this->_productResource = $productResource; - $this->_helperFactory = $helperFactory; + $this->_resourceHelper = $resourceHelper; } /** @@ -234,10 +234,9 @@ class Viewed extends \Magento\Sales\Model\Resource\Report\AbstractReport $insertQuery = $select->insertFromSelect($this->getMainTable(), array_keys($columns)); $adapter->query($insertQuery); - $helper = $this->_helperFactory->create(); - $helper->updateReportRatingPos('day', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_DAILY)); - $helper->updateReportRatingPos('month', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_MONTHLY)); - $helper->updateReportRatingPos('year', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_YEARLY)); + $this->_resourceHelper->updateReportRatingPos('day', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_DAILY)); + $this->_resourceHelper->updateReportRatingPos('month', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_MONTHLY)); + $this->_resourceHelper->updateReportRatingPos('year', 'views_num', $mainTable, $this->getTable(self::AGGREGATION_YEARLY)); $this->_setFlagData(\Magento\Reports\Model\Flag::REPORT_PRODUCT_VIEWED_FLAG_CODE); diff --git a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php index b0a4dfcb80a994cc1ae6ca22e28c8326f3ba0efa..490c5aa0cb4d9e1113ff809235d83c8882a70720 100644 --- a/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Report/Product/Viewed/Collection.php @@ -239,7 +239,7 @@ class Collection extends \Magento\Reports\Model\Resource\Report\Collection\Abstr * Re-declare parent method for applying filters after parent method, but before adding unions and calculating * totals * - * @return $this|\Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return $this|\Magento\Model\Resource\Db\Collection\AbstractCollection */ protected function _beforeLoad() { diff --git a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php index c7ac843caa0557433347173ad6d54154d9a9d43e..77fdb60fc71a92e2ac18442cb9aaf9a0d787feed 100644 --- a/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Review/Customer/Collection.php @@ -51,7 +51,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Customer\Model\Resource\Customer $customerResource * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -63,7 +63,7 @@ class Collection extends \Magento\Review\Model\Resource\Review\Collection \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Customer\Model\Resource\Customer $customerResource, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_customerResource = $customerResource; parent::__construct( diff --git a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php index bb8f81e783c22053c18289d5f2421901aa30c151..8b1c46d309b7e3d73ca3f6b0ead773606f21bfc1 100644 --- a/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Reports/Model/Resource/Wishlist/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Reports\Model\Resource\Wishlist; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Wishlist table name @@ -55,7 +55,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -64,7 +64,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Model\Resource\Customer\CollectionFactory $customerResFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_customerResFactory = $customerResFactory; diff --git a/app/code/Magento/Reports/etc/di.xml b/app/code/Magento/Reports/etc/di.xml index 1304c822160ce434bf6445224fbf143a0b370b29..03ef739d0363dbbe9434fe450d570fa378415e9b 100644 --- a/app/code/Magento/Reports/etc/di.xml +++ b/app/code/Magento/Reports/etc/di.xml @@ -49,4 +49,9 @@ <argument name="reportSession" xsi:type="object">Magento\Reports\Model\Session</argument> </arguments> </type> + <type name="Magento\Reports\Model\Resource\Helper"> + <arguments> + <argument name="modulePrefix" xsi:type="string">reports</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Reports/etc/module.xml b/app/code/Magento/Reports/etc/module.xml index e14249a2f8a68ef764657382d35bef71fe035b4c..ac2e3e0d987701caaf59d728197dc43a80b87bcb 100644 --- a/app/code/Magento/Reports/etc/module.xml +++ b/app/code/Magento/Reports/etc/module.xml @@ -49,8 +49,6 @@ <module name="Magento_Rating"/> <module name="Magento_Downloadable"/> <module name="Magento_SalesRule"/> - <module name="Magento_Checkout"/> - <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml index dc9c86ad939c0517fb02a5d4d75305a2d6d41491..71ab3265bad8f5473ffee7db982ddbc58a041a00 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_customer_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">customers_grid</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">catalog/product_review</item> + <item name="path" xsi:type="string">review/product</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="customerId" xsi:type="string">getCustomerId</item> </item> diff --git a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml index 7f6e77c489004d8e78ad954eea99afa4b94e413d..ed9530aa909ce48c405d05abd301140e9f2f8c49 100644 --- a/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml +++ b/app/code/Magento/Reports/view/adminhtml/layout/reports_report_review_product_grid.xml @@ -51,7 +51,7 @@ <argument name="filter_visibility" xsi:type="string">0</argument> <argument name="id" xsi:type="string">gridProducts</argument> <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">catalog/product_review</item> + <item name="path" xsi:type="string">review/product</item> <item name="extraParamsTemplate" xsi:type="array"> <item name="productId" xsi:type="string">getId</item> </item> diff --git a/app/code/Magento/Review/Block/Adminhtml/Add.php b/app/code/Magento/Review/Block/Adminhtml/Add.php index 1051f83fa413d6d9a7d19f83e6da5be5891b2a90..760f4ba67f0f5cd34afc235657df44d83c350514 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add.php @@ -97,7 +97,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container } new Ajax.Updater("rating_detail", "' . $this->getUrl( - 'catalog/*/ratingItems' + 'review/product/ratingItems' ) . '", {parameters:params, evalScripts: true, onComplete:function(){ $(\'save_button\').disabled = false; } }); }, @@ -106,7 +106,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container var response = Ext.util.JSON.decode(o.responseText); if( response.error ) { alert(response.message); - } elseif( response.id ){ + } else if( response.id ){ $("product_id").value = response.id; $("product_name").innerHTML = \'<a href="' . @@ -114,7 +114,7 @@ class Add extends \Magento\Backend\Block\Widget\Form\Container 'catalog/product/edit' ) . 'id/\' + response.id + \'" target="_blank">\' + response.name + \'</a>\'; - } elseif ( response.message ) { + } else if ( response.message ) { alert(response.message); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php index 2adb9f1312a97dd4588e39f248c825c3e298cbd2..22c5586b5dcb5641dc60d7dbf6a1cd255d64d548 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Add/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Add/Form.php @@ -172,7 +172,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $form->setMethod('post'); $form->setUseContainer(true); $form->setId('edit_form'); - $form->setAction($this->getUrl('catalog/*/post')); + $form->setAction($this->getUrl('review/product/post')); $this->setForm($form); } diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit.php b/app/code/Magento/Review/Block/Adminhtml/Edit.php index 9bdd984bd8a57e9d35aca610e94d85869eada4fe..ad021f25909934c984ce418791ed9bdddf9bfedf 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit.php @@ -96,7 +96,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container 'previous', array( 'label' => __('Previous'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $prevId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('review/*/*', array('id' => $prevId)) . '\')' ), 3, 10 @@ -145,7 +145,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container 'next', array( 'label' => __('Next'), - 'onclick' => 'setLocation(\'' . $this->getUrl('catalog/*/*', array('id' => $nextId)) . '\')' + 'onclick' => 'setLocation(\'' . $this->getUrl('review/*/*', array('id' => $nextId)) . '\')' ), 3, 105 @@ -209,7 +209,7 @@ class Edit extends \Magento\Backend\Block\Widget\Form\Container "rating_detail", "' . $this->getUrl( - 'catalog/*/ratingItems', + 'review/*/ratingItems', array('_current' => true) ) . '", diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php index a3362e1d111e7d059e7b1f11ba216edc930934e3..58407479827fcc175fe428ed82a62221f45431c3 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php @@ -39,11 +39,9 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic protected $_reviewData = null; /** - * Customer model factory - * - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ - protected $_customerFactory; + protected $customerAccount; /** * Catalog product factory @@ -64,7 +62,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Helper\Data $reviewData * @param array $data @@ -74,13 +72,13 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\System\Store $systemStore, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Helper\Data $reviewData, array $data = array() ) { $this->_reviewData = $reviewData; - $this->_customerFactory = $customerFactory; + $this->customerAccount = $customerAccount; $this->_productFactory = $productFactory; $this->_systemStore = $systemStore; parent::__construct($context, $registry, $formFactory, $data); @@ -95,7 +93,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { $review = $this->_coreRegistry->registry('review_data'); $product = $this->_productFactory->create()->load($review->getEntityPkValue()); - $customer = $this->_customerFactory->create()->load($review->getCustomerId()); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create( @@ -103,7 +100,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl( - 'catalog/*/save', + 'review/*/save', array( 'id' => $this->getRequest()->getParam('id'), 'ret' => $this->_coreRegistry->registry('ret') @@ -133,18 +130,18 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic ) ); - if ($customer->getId()) { + try { + $customer = $this->customerAccount->getCustomer($review->getCustomerId()); $customerText = __( '<a href="%1" onclick="this.target=\'blank\'">%2 %3</a> <a href="mailto:%4">(%4)</a>', - $this->getUrl('customer/index/edit', array('id' => $customer->getId(), 'active_tab' => 'review')), + $this->getUrl('customer/index/edit', array('id' => $customer->getId(), 'active_tab'=>'review')), $this->escapeHtml($customer->getFirstname()), $this->escapeHtml($customer->getLastname()), $this->escapeHtml($customer->getEmail()) ); - } elseif ($review->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) { - $customerText = __('Administrator'); - } else { - $customerText = __('Guest'); + } catch (\Magento\Exception\NoSuchEntityException $e) { + $customerText = ($review->getStoreId() == \Magento\Core\Model\Store::DEFAULT_STORE_ID) + ? __('Administrator') : __('Guest'); } $fieldset->addField('customer', 'note', array('label' => __('Posted By'), 'text' => $customerText)); diff --git a/app/code/Magento/Review/Block/Adminhtml/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Grid.php index c0f65919ad057ca9fc0c7a90b54194212d21eccd..29415b7ba615d89a806303624db340c92d25bb51 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Grid.php @@ -307,7 +307,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended array( 'caption' => __('Edit'), 'url' => array( - 'base' => 'catalog/product_review/edit', + 'base' => 'review/product/edit', 'params' => array( 'productId' => $this->getProductId(), 'customerId' => $this->getCustomerId(), @@ -383,7 +383,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended public function getRowUrl($row) { return $this->getUrl( - 'catalog/product_review/edit', + 'review/product/edit', array( 'id' => $row->getReviewId(), 'productId' => $this->getProductId(), @@ -402,7 +402,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended { if ($this->getProductId() || $this->getCustomerId()) { return $this->getUrl( - 'catalog/product_review/' . ($this->_coreRegistry->registry('usePendingFilter') ? 'pending' : ''), + 'review/product' . ($this->_coreRegistry->registry('usePendingFilter') ? 'pending' : ''), array('productId' => $this->getProductId(), 'customerId' => $this->getCustomerId()) ); } else { diff --git a/app/code/Magento/Review/Block/Adminhtml/Main.php b/app/code/Magento/Review/Block/Adminhtml/Main.php index 855cdcd4b1fe540edd36f869ac9843b477a50a12..1e2e8e248b083a9d316e6d0e615fabe86e5feef0 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Main.php +++ b/app/code/Magento/Review/Block/Adminhtml/Main.php @@ -39,11 +39,9 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container protected $_coreRegistry = null; /** - * Customer model factory - * - * @var \Magento\Customer\Model\CustomerFactory + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface */ - protected $_customerFactory; + protected $customerAccount; /** * Catalog product model factory @@ -54,20 +52,20 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container /** * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Registry $registry * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - \Magento\Customer\Model\CustomerFactory $customerFactory, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccount, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Registry $registry, array $data = array() ) { $this->_coreRegistry = $registry; - $this->_customerFactory = $customerFactory; + $this->customerAccount = $customerAccount; $this->_productFactory = $productFactory; parent::__construct($context, $data); } @@ -89,7 +87,7 @@ class Main extends \Magento\Backend\Block\Widget\Grid\Container $customerId = $this->getRequest()->getParam('customerId', false); $customerName = ''; if ($customerId) { - $customer = $this->_customerFactory->create()->load($customerId); + $customer = $this->customerAccount->getCustomer($customerId); $customerName = $customer->getFirstname() . ' ' . $customer->getLastname(); $customerName = $this->escapeHtml($customerName); } diff --git a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php similarity index 63% rename from app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php rename to app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php index 41ea96b99747e0f23e3b41b91e149f324cd2e73b..b77ee104c0d22afcd337cf138f21a589d7245574 100644 --- a/app/code/Magento/Backend/Model/Translate/Inline/ConfigFactory.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab.php @@ -18,25 +18,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Translate\Inline; +namespace Magento\Review\Block\Adminhtml\Product\Edit; -/** - * Backend Inline Translation config factory - */ -class ConfigFactory extends \Magento\Translate\Inline\ConfigFactory +class Tab extends \Magento\Backend\Block\Widget\Tab { /** - * Get instance of inline translate config - * - * @return \Magento\Translate\Inline\ConfigFactory + * @param \Magento\Backend\Block\Template\Context $context + * @param array $data */ - public function get() - { - return $this->_objectManager->get('Magento\Backend\Model\Translate\Inline\Config'); + public function __construct( + \Magento\Backend\Block\Template\Context $context, + array $data = array() + ) { + parent::__construct($context, $data); + + if (!$this->_request->getParam('id') || !$this->_authorization->isAllowed('Magento_Review::reviews_all')) { + $this->setCanShow(false); + } } } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php similarity index 74% rename from app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php rename to app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php index 2c94e414e3560e4674a70bd603f4850a5170ac39..825a5a3bf57685c1ed47f12a8963781325435c98 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Reviews.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Edit/Tab/Reviews.php @@ -1,5 +1,7 @@ <?php /** + * Reviews products admin grid + * * Magento * * NOTICE OF LICENSE @@ -18,27 +20,17 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Adminhtml * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Reviews products admin grid - * - * @category Magento - * @package Magento_Catalog - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab; +namespace Magento\Review\Block\Adminhtml\Product\Edit\Tab; class Reviews extends \Magento\Review\Block\Adminhtml\Grid { /** * Hide grid mass action elements * - * @return \Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews + * @return $this */ protected function _prepareMassaction() { @@ -52,6 +44,6 @@ class Reviews extends \Magento\Review\Block\Adminhtml\Grid */ public function getGridUrl() { - return $this->getUrl('catalog/*/reviews', array('_current' => true)); + return $this->getUrl('review/product_reviews/grid', array('_current' => true)); } } diff --git a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php index ae63934c0c16d179f6e6eee835807329e08c4246..91e3d9e2266ffb7dc029805821b3802bce052cc8 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php +++ b/app/code/Magento/Review/Block/Adminhtml/Product/Grid.php @@ -155,7 +155,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid */ public function getGridUrl() { - return $this->getUrl('catalog/*/productGrid', array('_current' => true)); + return $this->getUrl('catalog/product/productGrid', array('_current' => true)); } /** @@ -166,7 +166,7 @@ class Grid extends \Magento\Catalog\Block\Adminhtml\Product\Grid */ public function getRowUrl($row) { - return $this->getUrl('catalog/*/jsonProductInfo', array('id' => $row->getId())); + return $this->getUrl('review/product/jsonProductInfo', array('id' => $row->getId())); } /** diff --git a/app/code/Magento/Review/Block/Customer/View.php b/app/code/Magento/Review/Block/Customer/View.php index 28980596699a32a4e2ade6ad561da96c715a3c17..125bd917c0e38141a476dd0d44381530d26c6ed9 100644 --- a/app/code/Magento/Review/Block/Customer/View.php +++ b/app/code/Magento/Review/Block/Customer/View.php @@ -79,17 +79,7 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct protected $currentCustomer; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory @@ -97,21 +87,9 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Customer\Service\V1\CustomerCurrentService $currentCustomer * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, @@ -128,16 +106,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Review/Block/Form.php b/app/code/Magento/Review/Block/Form.php index 4b3e116a6216f78bce810e441292032a9d9f0f33..21434fda40b7570ada9608ee13cf7095167a1392 100644 --- a/app/code/Magento/Review/Block/Form.php +++ b/app/code/Magento/Review/Block/Form.php @@ -141,7 +141,7 @@ class Form extends \Magento\View\Element\Template // add logged in customer name as nickname if (!$data->getNickname()) { - $customer = $this->_customerSession->getCustomer(); + $customer = $this->_customerSession->getCustomerDataObject(); if ($customer && $customer->getId()) { $data->setNickname($customer->getFirstname()); } diff --git a/app/code/Magento/Review/Block/Helper.php b/app/code/Magento/Review/Block/Product/ReviewRenderer.php similarity index 79% rename from app/code/Magento/Review/Block/Helper.php rename to app/code/Magento/Review/Block/Product/ReviewRenderer.php index 46613c506addc775379f25f8252d0fb6d9b1f933..722f5e507dd774bd1915b9af253fe4d12e6ab744 100644 --- a/app/code/Magento/Review/Block/Helper.php +++ b/app/code/Magento/Review/Block/Product/ReviewRenderer.php @@ -1,5 +1,7 @@ <?php /** + * Review renderer + * * Magento * * NOTICE OF LICENSE @@ -18,23 +20,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Review\Block; +namespace Magento\Review\Block\Product; +use Magento\Catalog\Block\Product\ReviewRendererInterface; use Magento\Catalog\Model\Product; -/** - * Review helper - * - * @category Magento - * @package Magento_Review - * @author Magento Core Team <core@magentocommerce.com> - */ -class Helper extends \Magento\View\Element\Template +class ReviewRenderer extends \Magento\View\Element\Template implements ReviewRendererInterface { /** * Array of available template name @@ -42,8 +36,8 @@ class Helper extends \Magento\View\Element\Template * @var array */ protected $_availableTemplates = array( - 'default' => 'helper/summary.phtml', - 'short' => 'helper/summary_short.phtml' + self::DEFAULT_REVIEW => 'helper/summary.phtml', + self::SHORT_REVIEW => 'helper/summary_short.phtml' ); /** @@ -73,13 +67,17 @@ class Helper extends \Magento\View\Element\Template * @param Product $product * @param string $templateType * @param bool $displayIfNoReviews + * * @return string */ - public function getSummaryHtml($product, $templateType, $displayIfNoReviews) - { + public function getReviewsSummaryHtml( + \Magento\Catalog\Model\Product $product, + $templateType = self::DEFAULT_REVIEW, + $displayIfNoReviews = false + ) { // pick template among available if (empty($this->_availableTemplates[$templateType])) { - $templateType = 'default'; + $templateType = self::DEFAULT_REVIEW; } $this->setTemplate($this->_availableTemplates[$templateType]); @@ -125,18 +123,4 @@ class Helper extends \Magento\View\Element\Template array('id' => $this->getProduct()->getId(), 'category' => $this->getProduct()->getCategoryId()) ); } - - /** - * Add an available template by type - * - * It should be called before getSummaryHtml() - * - * @param string $type - * @param string $template - * @return void - */ - public function addTemplate($type, $template) - { - $this->_availableTemplates[$type] = $template; - } } diff --git a/app/code/Magento/Review/Block/Product/View.php b/app/code/Magento/Review/Block/Product/View.php index 9ae2a5c2dab43c39834db943bafc2bf92a4ef014..300b0de852dcd4b37a758632803f1b1818731c6e 100644 --- a/app/code/Magento/Review/Block/Product/View.php +++ b/app/code/Magento/Review/Block/Product/View.php @@ -51,17 +51,7 @@ class View extends \Magento\Catalog\Block\Product\View protected $_reviewsColFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\ProductFactory $productFactory @@ -73,21 +63,9 @@ class View extends \Magento\Catalog\Block\Product\View * @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\Data $coreData, \Magento\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\ProductFactory $productFactory, @@ -103,16 +81,6 @@ class View extends \Magento\Catalog\Block\Product\View $this->_reviewsColFactory = $collectionFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $coreData, $jsonEncoder, $productFactory, diff --git a/app/code/Magento/Review/Block/View.php b/app/code/Magento/Review/Block/View.php index f41d4dfc59b496d8fe6ed6399988d7e71518eba4..09c5f44cd002d2a881085ff530e58d12925555ed 100644 --- a/app/code/Magento/Review/Block/View.php +++ b/app/code/Magento/Review/Block/View.php @@ -61,37 +61,15 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct protected $_reviewFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Rating\Model\RatingFactory $ratingFactory * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Rating\Model\RatingFactory $ratingFactory, \Magento\Review\Model\ReviewFactory $reviewFactory, @@ -103,16 +81,6 @@ class View extends \Magento\Catalog\Block\Product\AbstractProduct parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php b/app/code/Magento/Review/Controller/Adminhtml/Product.php similarity index 93% rename from app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php rename to app/code/Magento/Review/Controller/Adminhtml/Product.php index 247ed05130257a5d5568ca4b7a930c20304c4159..233b1fb9121eafd84d43a1bb5ec9072f8556532a 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Review.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product.php @@ -19,16 +19,16 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Adminhtml + * @package Magento_Review * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Catalog\Controller\Adminhtml\Product; +namespace Magento\Review\Controller\Adminhtml; /** * Reviews admin controller */ -class Review extends \Magento\Backend\App\Action +class Product extends \Magento\Backend\App\Action { /** * Array of actions which can be processed without secret key validation @@ -181,7 +181,7 @@ class Review extends \Magento\Backend\App\Action $review->aggregate(); $this->messageManager->addSuccess(__('You saved the review.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong while saving this review.')); @@ -191,11 +191,11 @@ class Review extends \Magento\Backend\App\Action $nextId = (int)$this->getRequest()->getParam('next_item'); $url = $this->getUrl($this->getRequest()->getParam('ret') == 'pending' ? '*/*/pending' : '*/*/'); if ($nextId) { - $url = $this->getUrl('catalog/*/edit', array('id' => $nextId)); + $url = $this->getUrl('review/*/edit', array('id' => $nextId)); } return $this->getResponse()->setRedirect($url); } - $this->_redirect('catalog/*/'); + $this->_redirect('review/*/'); } /** @@ -209,18 +209,18 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The review has been deleted.')); if ($this->getRequest()->getParam('ret') == 'pending') { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); + $this->getResponse()->setRedirect($this->getUrl('review/*/pending')); } else { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); } return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong deleting this review.')); } - $this->_redirect('catalog/*/edit/', array('id' => $reviewId)); + $this->_redirect('review/*/edit/', array('id' => $reviewId)); } /** @@ -241,14 +241,14 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been deleted.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while deleting record(s).')); } } - $this->_redirect('catalog/*/' . $this->getRequest()->getParam('ret', 'index')); + $this->_redirect('review/*/' . $this->getRequest()->getParam('ret', 'index')); } /** @@ -269,7 +269,7 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -279,7 +279,7 @@ class Review extends \Magento\Backend\App\Action } } - $this->_redirect('catalog/*/' . $this->getRequest()->getParam('ret', 'index')); + $this->_redirect('review/*/' . $this->getRequest()->getParam('ret', 'index')); } /** @@ -302,7 +302,7 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('A total of %1 record(s) have been updated.', count($reviewsIds)) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -312,7 +312,7 @@ class Review extends \Magento\Backend\App\Action } } - $this->_redirect('catalog/*/pending'); + $this->_redirect('review/*/pending'); } /** @@ -401,19 +401,19 @@ class Review extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You saved the review.')); if ($this->getRequest()->getParam('ret') == 'pending') { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/pending')); + $this->getResponse()->setRedirect($this->getUrl('review/*/pending')); } else { - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); } return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('An error occurred while saving review.')); } } - $this->getResponse()->setRedirect($this->getUrl('catalog/*/')); + $this->getResponse()->setRedirect($this->getUrl('review/*/')); return; } diff --git a/app/code/Magento/Core/Model/Resource/HelperFactory.php b/app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php similarity index 51% rename from app/code/Magento/Core/Model/Resource/HelperFactory.php rename to app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php index beda5d8900694ab6d769051711def4b1c17d5447..ace0dc0a0dc32bb319168522dc423193e48aec1a 100644 --- a/app/code/Magento/Core/Model/Resource/HelperFactory.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product/Reviews.php @@ -1,7 +1,5 @@ <?php /** - * Resource helper factory - * * Magento * * NOTICE OF LICENSE @@ -23,35 +21,39 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Review\Controller\Adminhtml\Product; -abstract class HelperFactory +class Reviews extends \Magento\Backend\App\Action { /** - * @var string + * @var \Magento\Catalog\Controller\Adminhtml\Product\Builder */ - protected $_moduleName; + protected $productBuilder; /** - * @var \Magento\Core\Model\Resource\HelperPool + * @param \Magento\Backend\App\Action\Context $context + * @param \Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder */ - protected $_helperPool; - - /** - * @param \Magento\Core\Model\Resource\HelperPool $helperPool - */ - public function __construct(\Magento\Core\Model\Resource\HelperPool $helperPool) - { - $this->_helperPool = $helperPool; + public function __construct( + \Magento\Backend\App\Action\Context $context, + \Magento\Catalog\Controller\Adminhtml\Product\Builder $productBuilder + ) { + $this->productBuilder = $productBuilder; + parent::__construct($context); } /** - * Create resource helper instance + * Get product reviews grid * * @return void */ - public function create() + public function gridAction() { - return $this->_helperPool->get($this->_moduleName); + $product = $this->productBuilder->build($this->getRequest()); + $this->_view->loadLayout(); + $this->_view->getLayout()->getBlock('admin.product.reviews') + ->setProductId($product->getId()) + ->setUseAjax(true); + $this->_view->renderLayout(); } } diff --git a/app/code/Magento/Review/Controller/Product.php b/app/code/Magento/Review/Controller/Product.php index 538c1fa3341272f3443b6a106813eed7b34d592d..75e113fe84a11f832d71f135fdd24e0a3c711e2f 100644 --- a/app/code/Magento/Review/Controller/Product.php +++ b/app/code/Magento/Review/Controller/Product.php @@ -224,7 +224,7 @@ class Product extends \Magento\App\Action\Action 'review_controller_product_init_after', array('product' => $product, 'controller_action' => $this) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_logger->logException($e); return false; } diff --git a/app/code/Magento/Review/Helper/Action/Pager.php b/app/code/Magento/Review/Helper/Action/Pager.php index b38c60ba2bd886984df5b46852799eb520dc86be..6509a1e97616e105f5008806fcf49f3a47594a98 100644 --- a/app/code/Magento/Review/Helper/Action/Pager.php +++ b/app/code/Magento/Review/Helper/Action/Pager.php @@ -25,7 +25,7 @@ */ namespace Magento\Review\Helper\Action; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Action pager helper for iterating over search results diff --git a/app/code/Magento/Review/Model/Resource/Review.php b/app/code/Magento/Review/Model/Resource/Review.php index 52b10def3d5c30928301cae0a718d06ac1bf92a0..adbd31a2d64a206fb382d0a28f5125ae7c6ea876 100644 --- a/app/code/Magento/Review/Model/Resource/Review.php +++ b/app/code/Magento/Review/Model/Resource/Review.php @@ -25,7 +25,7 @@ */ namespace Magento\Review\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Review resource model @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ -class Review extends \Magento\Core\Model\Resource\Db\AbstractDb +class Review extends \Magento\Model\Resource\Db\AbstractDb { /** * Review table diff --git a/app/code/Magento/Review/Model/Resource/Review/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Collection.php index a33565ef8bab46fe0a9f6670ce6e5dc20bf9adc9..450e0955d3770a666f9462bc61a02492d52a93fb 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Review\Model\Resource\Review; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Review table @@ -103,7 +103,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -114,7 +114,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Rating\Model\Rating\Option\VoteFactory $voteFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_reviewData = $reviewData; $this->_voteFactory = $voteFactory; diff --git a/app/code/Magento/Review/Model/Resource/Review/Status.php b/app/code/Magento/Review/Model/Resource/Review/Status.php index 5b3d62b4c69f259e9c8ecfa4c269c27e9882d455..9b2340e2062534215082caa2cf1b7c7be94f9181 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Status.php +++ b/app/code/Magento/Review/Model/Resource/Review/Status.php @@ -30,7 +30,7 @@ namespace Magento\Review\Model\Resource\Review; * * @author Magento Core Team <core@magentocommerce.com> */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource status model initialization diff --git a/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php b/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php index e75373a565af32ead9ca24e02babcf399a7a4fb7..12a2724fac157b6053987070e07c571e4aaac4fb 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php +++ b/app/code/Magento/Review/Model/Resource/Review/Status/Collection.php @@ -33,7 +33,7 @@ */ namespace Magento\Review\Model\Resource\Review\Status; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Review status table diff --git a/app/code/Magento/Review/Model/Resource/Review/Summary.php b/app/code/Magento/Review/Model/Resource/Review/Summary.php index 747af7ea0809b73ea3f73e26f4b8e9cdbbe48b12..63a0b3aa92f36ce35db4a418472d233eef0576a2 100644 --- a/app/code/Magento/Review/Model/Resource/Review/Summary.php +++ b/app/code/Magento/Review/Model/Resource/Review/Summary.php @@ -25,14 +25,14 @@ */ namespace Magento\Review\Model\Resource\Review; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Review summary resource model * * @author Magento Core Team <core@magentocommerce.com> */ -class Summary extends \Magento\Core\Model\Resource\Db\AbstractDb +class Summary extends \Magento\Model\Resource\Db\AbstractDb { /** * Define module diff --git a/app/code/Magento/Review/Model/Review.php b/app/code/Magento/Review/Model/Review.php index 0111e1f34a6acbebd30ab247c225b11f38ad5cca..7df4187ffa780ad27f4085ad32d86116036eb3d3 100644 --- a/app/code/Magento/Review/Model/Review.php +++ b/app/code/Magento/Review/Model/Review.php @@ -46,7 +46,7 @@ use Magento\Catalog\Model\Product; * @package Magento_Review * @author Magento Core Team <core@magentocommerce.com> */ -class Review extends \Magento\Core\Model\AbstractModel +class Review extends \Magento\Model\AbstractModel { /** * Event prefix for observer @@ -129,7 +129,7 @@ class Review extends \Magento\Core\Model\AbstractModel * @param \Magento\Review\Model\Review\Summary $reviewSummary * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlModel - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -143,7 +143,7 @@ class Review extends \Magento\Core\Model\AbstractModel \Magento\Review\Model\Review\Summary $reviewSummary, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlModel, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -276,7 +276,7 @@ class Review extends \Magento\Core\Model\AbstractModel /** * Perform actions after object delete * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _afterDeleteCommit() { @@ -325,7 +325,6 @@ class Review extends \Magento\Core\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Review/Model/Review/Status.php b/app/code/Magento/Review/Model/Review/Status.php index d4d8fcf1291b583eff8123786f68a3ae74ec2402..bda94ce1c46eaea04384b76061a479c952152b7d 100644 --- a/app/code/Magento/Review/Model/Review/Status.php +++ b/app/code/Magento/Review/Model/Review/Status.php @@ -33,19 +33,19 @@ */ namespace Magento\Review\Model\Review; -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Review/Model/Review/Summary.php b/app/code/Magento/Review/Model/Review/Summary.php index 6414fcdb2398ff68c446d922ff8bb57311e71536..fb0d5f4ed1e27bbc6e604d0e0c63fd7392d784ea 100644 --- a/app/code/Magento/Review/Model/Review/Summary.php +++ b/app/code/Magento/Review/Model/Review/Summary.php @@ -28,7 +28,7 @@ namespace Magento\Review\Model\Review; /** * Review summary */ -class Summary extends \Magento\Core\Model\AbstractModel +class Summary extends \Magento\Model\AbstractModel { /** * @param \Magento\Model\Context $context diff --git a/app/code/Magento/Review/etc/adminhtml/menu.xml b/app/code/Magento/Review/etc/adminhtml/menu.xml index ebff77dc91f4f24b8b561538eafcd95bddb44245..a31a6e7f83f8645c85165091aa23a7afdc4c5bd8 100644 --- a/app/code/Magento/Review/etc/adminhtml/menu.xml +++ b/app/code/Magento/Review/etc/adminhtml/menu.xml @@ -28,7 +28,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/menu.xsd"> <menu> <add id="Magento_Review::catalog_reviews_ratings_ratings" title="Rating" module="Magento_Review" sortOrder="60" parent="Magento_Backend::stores_attributes" action="rating/index/" resource="Magento_Rating::ratings"/> - <add id="Magento_Review::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Backend::marketing_user_content" sortOrder="10" action="catalog/product_review/" resource="Magento_Review::reviews_all"/> + <add id="Magento_Review::catalog_reviews_ratings_reviews_all" title="Reviews" module="Magento_Review" parent="Magento_Backend::marketing_user_content" sortOrder="10" action="review/product/index" resource="Magento_Review::reviews_all"/> <add id="Magento_Review::report_review" title="Reviews" module="Magento_Reports" sortOrder="20" parent="Magento_Reports::report" resource="Magento_Reports::review"/> <add id="Magento_Review::report_review_customer" title="By Customers" sortOrder="10" module="Magento_Review" parent="Magento_Review::report_review" action="reports/report_review/customer" resource="Magento_Reports::review_customer"/> <add id="Magento_Review::report_review_product" title="By Products" sortOrder="20" module="Magento_Review" parent="Magento_Review::report_review" action="reports/report_review/product" resource="Magento_Reports::review_product"/> diff --git a/app/code/Magento/Customer/etc/frontend/events.xml b/app/code/Magento/Review/etc/adminhtml/routes.xml similarity index 78% rename from app/code/Magento/Customer/etc/frontend/events.xml rename to app/code/Magento/Review/etc/adminhtml/routes.xml index 0c456c5fdf2b52fa2a07ba89e122b3dde1fe239f..859cc6b8208e11043d1541ee73f0366823af8448 100644 --- a/app/code/Magento/Customer/etc/frontend/events.xml +++ b/app/code/Magento/Review/etc/adminhtml/routes.xml @@ -23,8 +23,10 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/Event/etc/events.xsd"> - <event name="sales_model_service_quote_submit_after"> - <observer name="restore_customer_group_id" instance="Magento\Customer\Model\Observer" method="quoteSubmitAfter" /> - </event> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="admin"> + <route id="review" frontName="review"> + <module name="Magento_Review" /> + </route> + </router> </config> diff --git a/app/code/Magento/Review/etc/di.xml b/app/code/Magento/Review/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..639abe1f711050c83928d9fe9c51bbb3c9bab186 --- /dev/null +++ b/app/code/Magento/Review/etc/di.xml @@ -0,0 +1,35 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Catalog\Block\Product\ReviewRendererInterface" type="Magento\Review\Block\Product\ReviewRenderer" /> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="review" xsi:type="string">Magento\Review\Model\Review</item> + </argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 9f86ed7ff62d2e85f92454cbd542a764da0e21eb..27e24a63542e1eca1441dd09df6c61cb39065f1d 100644 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -39,8 +39,6 @@ <module name="Magento_Backend"/> <module name="Magento_Tax"/> <module name="Magento_Newsletter"/> - <module name="Magento_Checkout"/> - <module name="Magento_Wishlist"/> </depends> </module> </config> diff --git a/app/code/Magento/Review/i18n/de_DE.csv b/app/code/Magento/Review/i18n/de_DE.csv index fd00ded0e34c47aa5b57372a9e21256601dae8be..a211543d41ee9ded4b4f87c0b30dbe887c726fec 100644 --- a/app/code/Magento/Review/i18n/de_DE.csv +++ b/app/code/Magento/Review/i18n/de_DE.csv @@ -91,3 +91,13 @@ "Your Rating:","Ihre Bewertung:" "Your Review (submitted on %s):","Ihr Review (von % hinzugefügt)" "Your review has been accepted for moderation.","Ihr Review wurde für Moderation akzeptiert." +"An error occurred while deleting this review.","Beim Löschen dieser Rezension ist ein Fehler aufgetreten." +"An error occurred while saving this review.","Beim Speichern der Rezension ist ein Fehler aufgetreten." +"Product Reviews","Produktreviews" +"The review has been deleted","Diese Bewertung wurde gelöscht" +"The review has been saved.","Diese Bewertung wrude gespeichert." +"The review was removed by another user or does not exist.","Diese Bewertung wurde von einem anderen Benutzer entfernt oder existiert nicht." +"Pending Reviews RSS","Ausstehende Kundenmeinungen RSS" +"Products Reviews","Artikelbewertungen" +"Reviews","Bewertungen" +"Customers Reviews","Berichte der Kunden" diff --git a/app/code/Magento/Review/i18n/en_US.csv b/app/code/Magento/Review/i18n/en_US.csv index 367ef415570b3e2a4382265a4dacad7b90e0251a..bcd62bf78c70c240981fef7c4aba79d8bf335171 100644 --- a/app/code/Magento/Review/i18n/en_US.csv +++ b/app/code/Magento/Review/i18n/en_US.csv @@ -92,3 +92,13 @@ "Your Rating:","Your Rating:" "Your Review (submitted on %s):","Your Review (submitted on %s):" "Your review has been accepted for moderation.","Your review has been accepted for moderation." +"An error occurred while deleting this review.","An error occurred while deleting this review." +"An error occurred while saving this review.","An error occurred while saving this review." +"The review has been deleted","The review has been deleted" +"The review has been saved.","The review has been saved." +"The review was removed by another user or does not exist.","The review was removed by another user or does not exist." +"Customers Reviews","Customers Reviews" +"Pending Reviews RSS","Pending Reviews RSS" +"Product Reviews","Product Reviews" +"Products Reviews","Products Reviews" +"Reviews","Reviews" diff --git a/app/code/Magento/Review/i18n/es_ES.csv b/app/code/Magento/Review/i18n/es_ES.csv index bbd0019f5c98fbe07f5dc5765a7a3b77294498c0..5c28b9230aecbf908c7b0fb8c873c8867bab0ede 100644 --- a/app/code/Magento/Review/i18n/es_ES.csv +++ b/app/code/Magento/Review/i18n/es_ES.csv @@ -91,3 +91,13 @@ "Your Rating:","Tu Valoración:" "Your Review (submitted on %s):","Tu Revisión (enviada en %s):" "Your review has been accepted for moderation.","Tu revisión se ha aceptado para ser moderada." +"An error occurred while deleting this review.","Se produjo un error al eliminar esta revisión." +"An error occurred while saving this review.","Se produjo un error al guardar esta revisión." +"The review has been deleted","Se eliminó la reseña" +"The review has been saved.","Se guardó la reseña." +"The review was removed by another user or does not exist.","La reseña no existe o fue eliminada por otro usuario." +"Customers Reviews","Revisiones Personalizadas" +"Pending Reviews RSS","RSS de reseñas pendientes" +"Product Reviews","Opiniones de Producto" +"Products Reviews","Opiniones de Productos" +"Reviews","Reseñas" diff --git a/app/code/Magento/Review/i18n/fr_FR.csv b/app/code/Magento/Review/i18n/fr_FR.csv index be523f8a1039f682a70fcce158243b76cc16af8d..ba54b3f3943347c3f3d4c9d2405ba5a04432c319 100644 --- a/app/code/Magento/Review/i18n/fr_FR.csv +++ b/app/code/Magento/Review/i18n/fr_FR.csv @@ -91,3 +91,13 @@ "Your Rating:","Votre évaluation :" "Your Review (submitted on %s):","Votre avis (envoyé le %s) :" "Your review has been accepted for moderation.","Votre avis a été accepté pour la modération." +"An error occurred while deleting this review.","Une erreur est survenue en effaçant ce commentaire" +"An error occurred while saving this review.","Une erreur est survenue en enregistrant ce commentaire" +"The review has been deleted","Le rapport a été supprimé" +"The review has been saved.","Le rapport a été enregistré." +"The review was removed by another user or does not exist.","Le rapport a été supprimé par un autre utilisateur ou n'existe pas." +"Customers Reviews","Avis des clients" +"Pending Reviews RSS","RSS des avis en attente" +"Product Reviews","Avis sur le produit" +"Products Reviews","Avis sur les produits" +"Reviews","Commentaires" diff --git a/app/code/Magento/Review/i18n/nl_NL.csv b/app/code/Magento/Review/i18n/nl_NL.csv index 9da9f411908a095b502a6822db166baac57c8d5e..44dadffa9f05bfc7f375cfaf0afa6f3c49cd47a7 100644 --- a/app/code/Magento/Review/i18n/nl_NL.csv +++ b/app/code/Magento/Review/i18n/nl_NL.csv @@ -91,3 +91,13 @@ "Your Rating:","Uw beoordeling:" "Your Review (submitted on %s):","Uw recensie (verzonden op %s):" "Your review has been accepted for moderation.","Uw beoordeling is geaccepteerd voor evaluatie." +"An error occurred while deleting this review.","Er is een fout opgetreden bij het verwijderen van deze recentie." +"An error occurred while saving this review.","Er is een fout opgetreden bij het opslaan van deze recensie." +"The review has been deleted","De beoordeling is verwijderd" +"The review has been saved.","De beoordeling is opgeslagen." +"The review was removed by another user or does not exist.","De beoordeling werd verwijderd door een andere gebruiker of bestaat niet." +"Customers Reviews","Klantenrecensies" +"Pending Reviews RSS","In Afwachting van Reviews RSS" +"Product Reviews","Productbeoordelingen" +"Products Reviews","Productrecensies" +"Reviews","Reviews" diff --git a/app/code/Magento/Review/i18n/pt_BR.csv b/app/code/Magento/Review/i18n/pt_BR.csv index ea1bf5212acb4c9b2e1727e6ceb7b52bdc07657a..f9714f20faa947f6b4977f12f9a95e206ead3443 100644 --- a/app/code/Magento/Review/i18n/pt_BR.csv +++ b/app/code/Magento/Review/i18n/pt_BR.csv @@ -91,3 +91,13 @@ "Your Rating:","Sua avaliação:" "Your Review (submitted on %s):","Sua revisão (enviada em %s):" "Your review has been accepted for moderation.","Sua avaliação foi aceita para moderação." +"An error occurred while deleting this review.","Ocorreu um erro ao excluir essa resenha." +"An error occurred while saving this review.","Ocorreu um erro ao salvar a resenha." +"The review has been deleted","A análise foi apagada" +"The review has been saved.","A análise foi salva." +"The review was removed by another user or does not exist.","A análise foi removida por outro usuário ou não existe." +"Customers Reviews","Análises dos clientes" +"Pending Reviews RSS","Comentários RSS Pendentes" +"Product Reviews","Comentários sobre Produto" +"Products Reviews","Comentários sobre Produtos" +"Reviews","Resenhas" diff --git a/app/code/Magento/Review/i18n/zh_CN.csv b/app/code/Magento/Review/i18n/zh_CN.csv index 57907575727fa8fdf69fe134e7ef231fc60c7970..b42851ad102d30f4f584ab41ef7aed0661f97a17 100644 --- a/app/code/Magento/Review/i18n/zh_CN.csv +++ b/app/code/Magento/Review/i18n/zh_CN.csv @@ -91,3 +91,13 @@ "Your Rating:","您的评分:" "Your Review (submitted on %s):","您的评测(æäº¤äºŽ %s):" "Your review has been accepted for moderation.","您的评测已被管ç†å‘˜æ‰¹å‡†ã€‚" +"An error occurred while deleting this review.","åˆ é™¤è¯¥è¯„è®ºæ—¶å‡ºé”™ã€‚" +"An error occurred while saving this review.","ä¿å˜è¯¥è¯„论时出错。" +"The review has been deleted","è¯„è®ºå·²è¢«åˆ é™¤" +"The review has been saved.","评论已ä¿å˜ã€‚" +"The review was removed by another user or does not exist.","评论已被å¦ä¸€ç”¨æˆ·åˆ 除,或评论ä¸å˜åœ¨ã€‚" +"Customers Reviews","客户评测" +"Pending Reviews RSS","挂起评测RSS" +"Product Reviews","产å“评测" +"Products Reviews","产å“评论" +"Reviews","评测" diff --git a/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml b/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml new file mode 100644 index 0000000000000000000000000000000000000000..860ec5d436e2528286b751f2e423f8b206191dc4 --- /dev/null +++ b/app/code/Magento/Review/view/adminhtml/layout/catalog_product_new.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> + <referenceBlock name="product_tabs"> + <block class="Magento\Review\Block\Adminhtml\Product\Edit\Tab" name="product.reviews"> + <arguments> + <argument name="label" xsi:type="string" translate="true">Product Reviews</argument> + <argument name="url" xsi:type="url" path="review/product_reviews/grid"> + <param name="_current">1</param> + </argument> + <argument name="class" xsi:type="string">ajax</argument> + <argument name="group_code" xsi:type="string">advanced</argument> + </arguments> + </block> + <action method="addTab"> + <argument name="name" xsi:type="string">product-reviews</argument> + <argument name="block" xsi:type="string">product.reviews</argument> + </action> + </referenceBlock> +</layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml similarity index 95% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml index 302f3a241b86f8c0af0b2774d6e8ed3b07cfc5fb..bb5469701a503a46f9eb93379487bebb0ad0fef9 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_edit.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_edit.xml @@ -24,5 +24,5 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> - <update handle="catalog_product_review_new"/> + <update handle="review_product_new"/> </layout> diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_new.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml similarity index 100% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_review_new.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_new.xml diff --git a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml b/app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml similarity index 91% rename from app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml rename to app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml index ef4fbea621efdff40b9a2d99f8e7f44a8e3879d2..3ddc307e0874c34332b64eb9b71f9e552c2c2451 100644 --- a/app/code/Magento/Catalog/view/adminhtml/layout/catalog_product_reviews.xml +++ b/app/code/Magento/Review/view/adminhtml/layout/review_product_reviews_grid.xml @@ -25,6 +25,6 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../Core/etc/layout_single.xsd"> <container name="root" label="Root" output="1"> - <block class="Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews" name="admin.product.reviews"/> + <block class="Magento\Review\Block\Adminhtml\Product\Edit\Tab\Reviews" name="admin.product.reviews"/> </container> </layout> diff --git a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php index fed6b85d025177a6207e09ae5ff5a65a4d9dfa4c..3215e9cc64e31d22d5a80f8d6c51b709f6c18fde 100644 --- a/app/code/Magento/Rss/Block/Catalog/NewCatalog.php +++ b/app/code/Magento/Rss/Block/Catalog/NewCatalog.php @@ -46,7 +46,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog protected $_visibility; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -62,7 +62,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Visibility $visibility - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Catalog\Helper\Image $imageHelper * @param array $data */ @@ -73,7 +73,7 @@ class NewCatalog extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Visibility $visibility, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Catalog\Helper\Image $imageHelper, array $data = array() ) { diff --git a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php index f55d7a3a3bfcd56982b37e28c6513a7110ed1418..3f1fa556ab22fae80c6184119e54c5e503fa9540 100644 --- a/app/code/Magento/Rss/Block/Catalog/NotifyStock.php +++ b/app/code/Magento/Rss/Block/Catalog/NotifyStock.php @@ -51,7 +51,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock protected $_productStatus; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -61,7 +61,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory * @param \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param array $data */ public function __construct( @@ -70,7 +70,7 @@ class NotifyStock extends \Magento\Backend\Block\AbstractBlock \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\CatalogInventory\Model\Resource\StockFactory $stockFactory, \Magento\Catalog\Model\Product\Attribute\Source\Status $productStatus, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, array $data = array() ) { $this->_rssFactory = $rssFactory; diff --git a/app/code/Magento/Rss/Block/Catalog/Review.php b/app/code/Magento/Rss/Block/Catalog/Review.php index 25652152032667070d21d6830685c094bd5bd604..6cfe4d18b440e8b0fc7a8d633f14350de86987dc 100644 --- a/app/code/Magento/Rss/Block/Catalog/Review.php +++ b/app/code/Magento/Rss/Block/Catalog/Review.php @@ -36,7 +36,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock protected $_rssFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -53,7 +53,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Review\Model\ReviewFactory $reviewFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data @@ -61,7 +61,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock public function __construct( \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Review\Model\ReviewFactory $reviewFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, array $data = array() @@ -127,7 +127,7 @@ class Review extends \Magento\Backend\Block\AbstractBlock array('id' => $row['entity_id']) ); $reviewUrl = $this->getUrl( - 'catalog/product_review/edit/', + 'review/product/edit/', array('id' => $row['review_id'], '_secure' => true, '_nosecret' => true) ); $storeName = $this->_storeManager->getStore($row['store_id'])->getName(); diff --git a/app/code/Magento/Rss/Block/Catalog/Special.php b/app/code/Magento/Rss/Block/Catalog/Special.php index 14dddb188565225d448e60d483c4608556fcd639..fcd0c1671a74331e0af7a439daa81d1082a817d0 100644 --- a/app/code/Magento/Rss/Block/Catalog/Special.php +++ b/app/code/Magento/Rss/Block/Catalog/Special.php @@ -48,7 +48,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog protected $_rssFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -74,7 +74,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Rss\Model\RssFactory $rssFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Catalog\Helper\Image $imageHelper * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data @@ -86,7 +86,7 @@ class Special extends \Magento\Rss\Block\Catalog\AbstractCatalog \Magento\Core\Helper\Data $coreData, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Rss\Model\RssFactory $rssFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Helper\Output $outputHelper, array $data = array() diff --git a/app/code/Magento/Rss/Block/Order/NewOrder.php b/app/code/Magento/Rss/Block/Order/NewOrder.php index 9b5ccdc4720e237052ac89120f765209762dcd1b..934626212803fa3879d5b99ba07daa79619fccbb 100644 --- a/app/code/Magento/Rss/Block/Order/NewOrder.php +++ b/app/code/Magento/Rss/Block/Order/NewOrder.php @@ -41,7 +41,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock protected $_orderFactory; /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_resourceIterator; @@ -54,7 +54,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock * @param \Magento\Backend\Block\Context $context * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Resource\Iterator $resourceIterator + * @param \Magento\Model\Resource\Iterator $resourceIterator * @param \Magento\Stdlib\DateTime $dateTime * @param array $data */ @@ -62,7 +62,7 @@ class NewOrder extends \Magento\Backend\Block\AbstractBlock \Magento\Backend\Block\Context $context, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Resource\Iterator $resourceIterator, + \Magento\Model\Resource\Iterator $resourceIterator, \Magento\Stdlib\DateTime $dateTime, array $data = array() ) { diff --git a/app/code/Magento/Rss/Block/Wishlist.php b/app/code/Magento/Rss/Block/Wishlist.php index c423881132f2026ca364401ae08670699e9bddfc..e9111f755bebb80e7aaefe0032d6fd8e14d321f9 100644 --- a/app/code/Magento/Rss/Block/Wishlist.php +++ b/app/code/Magento/Rss/Block/Wishlist.php @@ -34,13 +34,6 @@ namespace Magento\Rss\Block; */ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock { - /** - * Customer instance - * - * @var \Magento\Customer\Model\Customer - */ - protected $_customer; - /** * Default MAP renderer type * @@ -53,11 +46,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected $_wishlistFactory; - /** - * @var \Magento\Customer\Model\CustomerFactory - */ - protected $_customerFactory; - /** * @var \Magento\Rss\Model\RssFactory */ @@ -74,46 +62,22 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_outputHelper; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory - * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param \Magento\Rss\Model\RssFactory $rssFactory * @param \Magento\Catalog\Helper\Output $outputHelper * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Core\Helper\Data $coreData, \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, - \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Rss\Model\RssFactory $rssFactory, \Magento\Catalog\Helper\Output $outputHelper, array $data = array(), @@ -122,20 +86,9 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_outputHelper = $outputHelper; $this->_coreData = $coreData; $this->_wishlistFactory = $wishlistFactory; - $this->_customerFactory = $customerFactory; $this->_rssFactory = $rssFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, @@ -151,41 +104,13 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected function _getWishlist() { if (is_null($this->_wishlist)) { - $this->_wishlist = $this->_wishlistFactory->create(); - $wishlistId = $this->getRequest()->getParam('wishlist_id'); - if ($wishlistId) { - $this->_wishlist->load($wishlistId); - if ($this->_wishlist->getCustomerId() != $this->_getCustomer()->getId()) { - $this->_wishlist->unsetData(); - } - } else { - if ($this->_getCustomer()->getId()) { - $this->_wishlist->loadByCustomer($this->_getCustomer()); - } + $this->_wishlist = parent::_getWishlist(); + if ($this->_wishlist->getCustomerId() != $this->_getHelper()->getCustomer()->getId()) { + $this->_wishlist->unsetData(); } } - return $this->_wishlist; - } - - /** - * Retrieve Customer instance - * - * @return \Magento\Customer\Model\Customer - */ - protected function _getCustomer() - { - if (is_null($this->_customer)) { - $this->_customer = $this->_customerFactory->create(); - $params = $this->_coreData->urlDecode($this->getRequest()->getParam('data')); - $data = explode(',', $params); - $cId = abs(intval($data[0])); - if ($cId && ($cId == $this->httpContext->getValue(\Magento\Customer\Helper\Data::CONTEXT_AUTH))) { - $this->_customer->load($cId); - } - } - - return $this->_customer; + return $this->_wishlist; } /** @@ -195,7 +120,7 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock */ protected function _getTitle() { - return __('%1\'s Wishlist', $this->_getCustomer()->getName()); + return __('%1\'s Wishlist', $this->_getHelper()->getCustomerName()); } /** diff --git a/app/code/Magento/Rss/Controller/Index.php b/app/code/Magento/Rss/Controller/Index.php index 8cc7819786d494f968a9d765692c11724971c9d4..6192cdb4c84b19e4fe9253071fb34d4826fe09fd 100644 --- a/app/code/Magento/Rss/Controller/Index.php +++ b/app/code/Magento/Rss/Controller/Index.php @@ -30,31 +30,35 @@ use Magento\App\Action\NotFoundException; class Index extends \Magento\App\Action\Action { /** - * Current wishlist - * - * @var \Magento\Wishlist\Model\Wishlist + * @var \Magento\Core\Model\Store\Config */ - protected $_wishlist; + protected $_storeConfig; /** - * Current customer - * - * @var \Magento\Customer\Model\Customer + * @var \Magento\Rss\Helper\WishlistRss */ - protected $_customer; + protected $_wishlistHelper; /** - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Customer\Model\Session */ - protected $_storeConfig; + protected $_customerSession; /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\Model\Store\Config $storeConfig + * @param \Magento\Rss\Helper\WishlistRss $wishlistHelper + * @param \Magento\Customer\Model\Session $customerSession */ - public function __construct(\Magento\App\Action\Context $context, \Magento\Core\Model\Store\Config $storeConfig) - { + public function __construct( + \Magento\App\Action\Context $context, + \Magento\Core\Model\Store\Config $storeConfig, + \Magento\Rss\Helper\WishlistRss $wishlistHelper, + \Magento\Customer\Model\Session $customerSession + ) { $this->_storeConfig = $storeConfig; + $this->_wishlistHelper = $wishlistHelper; + $this->_customerSession = $customerSession; parent::__construct($context); } @@ -104,12 +108,10 @@ class Index extends \Magento\App\Action\Action public function wishlistAction() { if ($this->_storeConfig->getConfig('rss/wishlist/active')) { - $wishlist = $this->_getWishlist(); - if ($wishlist && ($wishlist->getVisibility() || $this->_objectManager->get( - 'Magento\Customer\Model\Session' - )->authenticate( - $this - ) && $wishlist->getCustomerId() == $this->_getCustomer()->getId()) + $wishlist = $this->_wishlistHelper->getWishlist(); + if ($wishlist && ($wishlist->getVisibility() + || $this->_customerSession->authenticate($this) + && $wishlist->getCustomerId() == $this->_wishlistHelper->getCustomer()->getId()) ) { $this->getResponse()->setHeader('Content-Type', 'text/xml; charset=UTF-8'); $this->_view->loadLayout(false); @@ -119,51 +121,4 @@ class Index extends \Magento\App\Action\Action } $this->nofeedAction(); } - - /** - * Retrieve Wishlist model - * - * @return \Magento\Wishlist\Model\Wishlist - */ - protected function _getWishlist() - { - if (is_null($this->_wishlist)) { - $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist'); - $wishlistId = $this->getRequest()->getParam('wishlist_id'); - if ($wishlistId) { - $this->_wishlist->load($wishlistId); - } else { - if ($this->_getCustomer()->getId()) { - $this->_wishlist->loadByCustomer($this->_getCustomer()); - } - } - } - return $this->_wishlist; - } - - /** - * Retrieve Customer instance - * - * @return \Magento\Customer\Model\Customer - */ - protected function _getCustomer() - { - if (is_null($this->_customer)) { - $this->_customer = $this->_objectManager->create('Magento\Customer\Model\Customer'); - $params = $this->_objectManager->get( - 'Magento\Core\Helper\Data' - )->urlDecode( - $this->getRequest()->getParam('data') - ); - $data = explode(',', $params); - $customerId = abs(intval($data[0])); - if ($customerId && $customerId == $this->_objectManager->get( - 'Magento\Customer\Model\Session' - )->getCustomerId() - ) { - $this->_customer->load($customerId); - } - } - return $this->_customer; - } } diff --git a/app/code/Magento/Rss/Helper/WishlistRss.php b/app/code/Magento/Rss/Helper/WishlistRss.php new file mode 100644 index 0000000000000000000000000000000000000000..e1482ca9db8a751ca61127c7914db66a230faf6a --- /dev/null +++ b/app/code/Magento/Rss/Helper/WishlistRss.php @@ -0,0 +1,158 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Helper; + +class WishlistRss extends \Magento\Wishlist\Helper\Data +{ + /** + * @var \Magento\Customer\Service\V1\Data\Customer + */ + protected $_customer; + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerBuilder + */ + protected $_customerBuilder; + + /** + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + */ + protected $_customerAccountService; + + /** + * @var \Magento\Customer\Helper\View + */ + protected $_customerViewHelper; + + /** + * @param \Magento\App\Helper\Context $context + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Registry $coreRegistry + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Customer\Model\Session $customerSession + * @param \Magento\Wishlist\Model\WishlistFactory $wishlistFactory + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Helper\PostData $postDataHelper + * @param \Magento\Customer\Helper\View $customerViewHelper + * @param \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder + * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + */ + public function __construct( + \Magento\App\Helper\Context $context, + \Magento\Core\Helper\Data $coreData, + \Magento\Registry $coreRegistry, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Customer\Model\Session $customerSession, + \Magento\Wishlist\Model\WishlistFactory $wishlistFactory, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Helper\PostData $postDataHelper, + \Magento\Customer\Helper\View $customerViewHelper, + \Magento\Customer\Service\V1\Data\CustomerBuilder $customerBuilder, + \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerAccountService + ) { + $this->_customerViewHelper = $customerViewHelper; + $this->_customerBuilder = $customerBuilder; + $this->_customerAccountService = $customerAccountService; + + parent::__construct( + $context, + $coreData, + $coreRegistry, + $coreStoreConfig, + $customerSession, + $wishlistFactory, + $storeManager, + $postDataHelper + ); + } + + /** + * Retrieve Wishlist model + * + * @return \Magento\Wishlist\Model\Wishlist + */ + public function getWishlist() + { + if (is_null($this->_wishlist)) { + $this->_wishlist = $this->_wishlistFactory->create(); + + $wishlistId = $this->_getRequest()->getParam('wishlist_id'); + if ($wishlistId) { + $this->_wishlist->load($wishlistId); + } else { + if ($this->getCustomer()->getId()) { + $this->_wishlist->loadByCustomerId($this->getCustomer()->getId()); + } + } + } + return $this->_wishlist; + } + + /** + * Retrieve Customer instance + * + * @return \Magento\Customer\Service\V1\Data\Customer + */ + public function getCustomer() + { + if (is_null($this->_customer)) { + $this->_customer = $this->_customerBuilder->create(); + + $params = $this->_coreData->urlDecode($this->_getRequest()->getParam('data')); + $data = explode(',', $params); + $cId = abs(intval($data[0])); + if ($cId && ($cId == $this->_customerSession->getCustomerId())) { + $this->_customer = $this->_customerSession->getCustomerDataObject(); + } + } + + return $this->_customer; + } + + /** + * Set current customer + * + * @param \Magento\Customer\Model\Customer $customer + * @return void + */ + public function setCustomer(\Magento\Customer\Model\Customer $customer) + { + /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ + $this->_customer = $this->_customerAccountService->getCustomer($customer->getId()); + } + + /** + * Retrieve customer name + * + * @return string|void + */ + public function getCustomerName() + { + /* TODO this method must be eliminated after refactoring of Magento\Wishlist\Helper\Data */ + return $this->getCustomer() + ? $this->_customerViewHelper->getCustomerName($this->getCustomer()) + : null; + } +} diff --git a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php index 17aa62d2a903d32b31f9cab3eb6414d4dd8d3cb5..ae9e2fe2b5211ea8a8ceee4250b4bcb04af93120 100644 --- a/app/code/Magento/Rss/Model/System/Config/Backend/Links.php +++ b/app/code/Magento/Rss/Model/System/Config/Backend/Links.php @@ -42,7 +42,7 @@ class Links extends \Magento\Core\Model\Config\Value * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\ConfigInterface $config * @param \Magento\App\Cache\TypeListInterface $cacheTypeList - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -52,7 +52,7 @@ class Links extends \Magento\Core\Model\Config\Value \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\ConfigInterface $config, \Magento\App\Cache\TypeListInterface $cacheTypeList, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rss/etc/di.xml b/app/code/Magento/Rss/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..02f7ed6ff5b8851102e5939a9d6b53693065ae3a --- /dev/null +++ b/app/code/Magento/Rss/etc/di.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <virtualType name="Magento\Rss\Block\Context" type="Magento\Catalog\Block\Product\Context"> + <arguments> + <argument name="wishlistHelper" xsi:type="object">Magento\Rss\Helper\WishlistRss</argument> + </arguments> + </virtualType> + <type name="Magento\Rss\Block\Wishlist"> + <arguments> + <argument name="context" xsi:type="object">Magento\Rss\Block\Context</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Rss/etc/module.xml b/app/code/Magento/Rss/etc/module.xml index b9e2def7231b8d6e7b131fc0f3732f0b3834e42f..774ccf502fc9a9d3cf4081f24f340deb63fea3be 100644 --- a/app/code/Magento/Rss/etc/module.xml +++ b/app/code/Magento/Rss/etc/module.xml @@ -36,7 +36,6 @@ </sequence> <depends> <module name="Magento_Catalog"/> - <module name="Magento_Tax"/> <module name="Magento_CatalogInventory"/> <module name="Magento_Sales"/> <module name="Magento_SalesRule"/> @@ -46,8 +45,6 @@ <module name="Magento_Customer"/> <module name="Magento_Backend"/> <module name="Magento_GiftMessage"/> - <module name="Magento_Checkout"/> - <module name="Magento_Theme"/> </depends> </module> </config> diff --git a/app/code/Magento/Rule/Block/Editable.php b/app/code/Magento/Rule/Block/Editable.php index a8483602bfcacb54512c64d9d71d746548bf51c3..c7bc0ec4c6653be7c945d6322f9fe4721fa70135 100644 --- a/app/code/Magento/Rule/Block/Editable.php +++ b/app/code/Magento/Rule/Block/Editable.php @@ -30,6 +30,25 @@ use Magento\View\Element\AbstractBlock; class Editable extends AbstractBlock implements RendererInterface { + /** + * @var \Magento\Translate\InlineInterface + */ + protected $inlineTranslate; + + /** + * @param \Magento\View\Element\Context $context + * @param \Magento\Translate\InlineInterface $inlineTranslate + * @param array $data + */ + public function __construct( + \Magento\View\Element\Context $context, + \Magento\Translate\InlineInterface $inlineTranslate, + array $data = array() + ) { + $this->inlineTranslate = $inlineTranslate; + parent::__construct($context, $data); + } + /** * Render element * @@ -66,7 +85,7 @@ class Editable extends AbstractBlock implements RendererInterface '>' . '<a href="javascript:void(0)" class="label">'; - if ($this->_translator->isAllowed()) { + if ($this->inlineTranslate->isAllowed()) { $html .= $this->escapeHtml($valueName); } else { $html .= $this->escapeHtml( diff --git a/app/code/Magento/Rule/Model/AbstractModel.php b/app/code/Magento/Rule/Model/AbstractModel.php index 7f1c63d3eb7e30c281e860e54f5de0fb37c59da6..9bc2dfc83ea098ec0679211ea2e10c4361d301f4 100644 --- a/app/code/Magento/Rule/Model/AbstractModel.php +++ b/app/code/Magento/Rule/Model/AbstractModel.php @@ -29,9 +29,9 @@ */ namespace Magento\Rule\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * Store rule combine conditions model @@ -97,7 +97,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -106,7 +106,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Rule/Model/Resource/AbstractResource.php b/app/code/Magento/Rule/Model/Resource/AbstractResource.php index ed4a7ecdb8b73938fc109163689eae42b5844ae7..4f40d7c80017c76bb1b9dfd8288f9f583491b88c 100644 --- a/app/code/Magento/Rule/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Rule/Model/Resource/AbstractResource.php @@ -33,7 +33,7 @@ */ namespace Magento\Rule\Model\Resource; -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Store associated with rule entities information map @@ -60,10 +60,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Prepare rule's active "from" and "to" dates * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _beforeSave(\Magento\Core\Model\AbstractModel $object) + public function _beforeSave(\Magento\Model\AbstractModel $object) { $fromDate = $object->getFromDate(); if ($fromDate instanceof \Zend_Date) { @@ -241,7 +241,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract * * @param string $entityType * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getAssociatedEntityInfo($entityType) { @@ -249,7 +249,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract return $this->_associatedEntitiesMap[$entityType]; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('There is no information about associated entity type "%1".', $entityType), 0 ); diff --git a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php index eb35698a09ca30c6c2e983cf4819b3ff7e1c654e..d084d1e7fac678700839bf8af3324cbb1b152078 100644 --- a/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php +++ b/app/code/Magento/Rule/Model/Resource/Rule/Collection/AbstractCollection.php @@ -33,7 +33,7 @@ */ namespace Magento\Rule\Model\Resource\Rule\Collection; -abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Store associated with rule entities information map @@ -165,7 +165,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec * * @param string $entityType * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return array */ protected function _getAssociatedEntityInfo($entityType) @@ -174,7 +174,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec return $this->_associatedEntitiesMap[$entityType]; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('There is no information about associated entity type "%1".', $entityType), 0 ); diff --git a/app/code/Magento/Rule/Model/Rule.php b/app/code/Magento/Rule/Model/Rule.php index e6b521573f09f840d703c4f561fb4ddc44530f71..5f481782b72ff407c7b54fc7a5c575bf192d9840 100644 --- a/app/code/Magento/Rule/Model/Rule.php +++ b/app/code/Magento/Rule/Model/Rule.php @@ -54,7 +54,7 @@ class Rule extends AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory * @param \Magento\Rule\Model\Action\CollectionFactory $actionsFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -65,7 +65,7 @@ class Rule extends AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Rule\Model\Condition\CombineFactory $conditionsFactory, \Magento\Rule\Model\Action\CollectionFactory $actionsFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php index 965c94c12ba23d7399db0037890da2306afefa6d..3bff3d51549bf4a04494d81f901108ddb36bb12c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Items/AbstractItems.php @@ -215,7 +215,7 @@ class AbstractItems extends \Magento\Backend\Block\Template /** * Retrieve available order * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return Order */ public function getOrder() @@ -239,7 +239,7 @@ class AbstractItems extends \Magento\Backend\Block\Template return $this->getItem()->getOrder(); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php index 8f2d9ae6c6e9b1a88c2f6fa842fa7c96bd5d61af..e466a423384301503df5ad9baaf85d8600ad0a7c 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php @@ -71,7 +71,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget * Retrieve available order * * @return Order - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getOrder() { @@ -84,7 +84,7 @@ class AbstractOrder extends \Magento\Backend\Block\Widget if ($this->_coreRegistry->registry('order')) { return $this->_coreRegistry->registry('order'); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php index 14d45c7a377d9f6996821a2b51a5adcafee0a22c..6dde7fa2bc1f85e5e254145fbb4e0f9dc766f443 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Comments/View.php @@ -59,12 +59,12 @@ class View extends \Magento\Backend\Block\Template * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setEntity($this->getParentBlock()->getSource()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php index 9f04c0b77760c498109f462836da103420602a89..5bf0e5b9506e59f938d975b177fc4153b21cf013 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Payment.php @@ -61,12 +61,12 @@ class Payment extends \Magento\Backend\Block\Template * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } $this->setPayment($this->getParentBlock()->getOrder()->getPayment()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php index c0c0a375b6e5f1f5613af1ccef69be5bc6d5da9d..1c0d0cb5ee6cf0489c4baec9c3022baa21e534a3 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Totalbar.php @@ -45,12 +45,12 @@ class Totalbar extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); $this->setSource($this->getParentBlock()->getSource()); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index 00025662678f87ff1dc9e725e8b20e7db4833c41..b77f9d95a7bee008f14983ef7b6f151f2c7fda6d 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -84,7 +84,7 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Please correct the parent block for this block.')); + throw new \Magento\Model\Exception(__('Please correct the parent block for this block.')); } $this->setOrder($this->getParentBlock()->getOrder()); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php index fbae50084030e3f9b3319dc0740fc02e3aa942d9..546cae95121f4b1223671442fd1470802d4a221a 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Items.php @@ -40,12 +40,12 @@ class Items extends \Magento\Sales\Block\Adminhtml\Items\AbstractItems * Retrieve required options from parent * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeToHtml() { if (!$this->getParentBlock()) { - throw new \Magento\Core\Exception(__('Invalid parent block for this block')); + throw new \Magento\Model\Exception(__('Invalid parent block for this block')); } $this->setOrder($this->getParentBlock()->getOrder()); parent::_beforeToHtml(); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php index f4e120ad35b24e00758967550c27645a1aa1fa39..50e1d91b0ddb74a2a7cc5369a657ab68234de167 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Tabs.php @@ -59,7 +59,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs * Retrieve available order * * @return \Magento\Sales\Model\Order - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getOrder() { @@ -72,7 +72,7 @@ class Tabs extends \Magento\Backend\Block\Widget\Tabs if ($this->_coreRegistry->registry('order')) { return $this->_coreRegistry->registry('order'); } - throw new \Magento\Core\Exception(__('We cannot get the order instance.')); + throw new \Magento\Model\Exception(__('We cannot get the order instance.')); } /** diff --git a/app/code/Magento/Sales/Block/Order/Comments.php b/app/code/Magento/Sales/Block/Order/Comments.php index 9b2de31ac6d1622e2c80441067ff0a0427ca20aa..e0758c0f67846273540b658a3415b94490638f9b 100644 --- a/app/code/Magento/Sales/Block/Order/Comments.php +++ b/app/code/Magento/Sales/Block/Order/Comments.php @@ -104,7 +104,7 @@ class Comments extends \Magento\View\Element\Template * Initialize model comments and return comment collection * * @return \Magento\Sales\Model\Resource\Order\Comment\Collection\AbstractCollection - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getComments() { @@ -117,7 +117,7 @@ class Comments extends \Magento\View\Element\Template } else if ($entity instanceof \Magento\Sales\Model\Order\Shipment) { $this->_commentCollection = $this->_shipmentCollectionFactory->create(); } else { - throw new \Magento\Core\Exception(__('We found an invalid entity model.')); + throw new \Magento\Model\Exception(__('We found an invalid entity model.')); } $this->_commentCollection->setParentFilter($entity)->setCreatedAtOrder()->addVisibleOnFrontFilter(); diff --git a/app/code/Magento/Sales/Controller/AbstractController.php b/app/code/Magento/Sales/Controller/AbstractController.php index 9ab3515718b758a573f6a99111db27ad9bdaf6ba..414c185b3f58d32233adae3cfa8c7c8ac32da445 100644 --- a/app/code/Magento/Sales/Controller/AbstractController.php +++ b/app/code/Magento/Sales/Controller/AbstractController.php @@ -174,7 +174,7 @@ abstract class AbstractController extends \Magento\App\Action\Action foreach ($items as $item) { try { $cart->addOrderItem($item); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($this->_objectManager->get('Magento\Checkout\Model\Session')->getUseNotice(true)) { $this->messageManager->addNotice($e->getMessage()); } else { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order.php b/app/code/Magento/Sales/Controller/Adminhtml/Order.php index 6e3b72af35af3819244650b49bc60d0cf8fe20c1..d6d3ef3eff4eaf61175a8901dbaf2fe0c08623ff 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order.php @@ -193,7 +193,7 @@ class Order extends \Magento\Backend\App\Action $historyItem->save(); } $this->messageManager->addSuccess(__('You sent the order email.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t send the email order.')); @@ -215,7 +215,7 @@ class Order extends \Magento\Backend\App\Action try { $order->cancel()->save(); $this->messageManager->addSuccess(__('You canceled the order.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You have not canceled the item.')); @@ -237,7 +237,7 @@ class Order extends \Magento\Backend\App\Action try { $order->hold()->save(); $this->messageManager->addSuccess(__('You put the order on hold.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You have not put the order on hold.')); @@ -258,7 +258,7 @@ class Order extends \Magento\Backend\App\Action try { $order->unhold()->save(); $this->messageManager->addSuccess(__('You released the order from holding status.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('The order was not on hold.')); @@ -303,7 +303,7 @@ class Order extends \Magento\Backend\App\Action } $order->save(); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t update the payment.')); @@ -325,7 +325,7 @@ class Order extends \Magento\Backend\App\Action $response = false; $data = $this->getRequest()->getPost('history'); if (empty($data['comment']) && $data['status'] == $order->getDataByKey('status')) { - throw new \Magento\Core\Exception(__('Comment text cannot be empty.')); + throw new \Magento\Model\Exception(__('Comment text cannot be empty.')); } $notify = isset($data['is_customer_notified']) ? $data['is_customer_notified'] : false; @@ -343,7 +343,7 @@ class Order extends \Magento\Backend\App\Action $this->_view->loadLayout('empty'); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('We cannot add order history.')); @@ -404,12 +404,13 @@ class Order extends \Magento\Backend\App\Action public function commentsHistoryAction() { $this->_initOrder(); + $html = $this->_view->getLayout()->createBlock( 'Magento\Sales\Block\Adminhtml\Order\View\Tab\History' )->toHtml(); - if ($this->_translateInline->isAllowed()) { - $this->_translateInline->processResponseBody($html); - } + + $this->_translateInline->processResponseBody($html); + $this->getResponse()->setBody($html); } @@ -806,7 +807,7 @@ class Order extends \Magento\Backend\App\Action $order->getPayment()->void(new \Magento\Object()); // workaround for backwards compatibility $order->save(); $this->messageManager->addSuccess(__('The payment has been voided.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We couldn\'t void the payment.')); @@ -944,7 +945,7 @@ class Order extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You updated the order address.')); $this->_redirect('sales/*/view', array('order_id' => $address->getParentId())); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong updating the order address.')); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php index 72cc8b8e9e01a503ee8d072ce294eb2a573f7d9c..21a9e334b123a6adaa8b942227921a34c06002f5 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Create.php @@ -391,7 +391,7 @@ class Create extends \Magento\Backend\App\Action $request = $this->getRequest(); try { $this->_initSession()->_processData(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_reloadQuote(); $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -530,7 +530,7 @@ class Create extends \Magento\Backend\App\Action $this->messageManager->addError($message); } $this->_redirect('sales/*/'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $message = $e->getMessage(); if (!empty($message)) { $this->messageManager->addError($message); @@ -618,12 +618,12 @@ class Create extends \Magento\Backend\App\Action try { $quoteItemId = (int)$this->getRequest()->getParam('id'); if (!$quoteItemId) { - throw new \Magento\Core\Exception(__('Quote item id is not received.')); + throw new \Magento\Model\Exception(__('Quote item id is not received.')); } $quoteItem = $this->_objectManager->create('Magento\Sales\Model\Quote\Item')->load($quoteItemId); if (!$quoteItem->getId()) { - throw new \Magento\Core\Exception(__('Quote item is not loaded.')); + throw new \Magento\Model\Exception(__('Quote item is not loaded.')); } $configureResult->setOk(true); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php index 5a38afab99705b900520b75470fcdc4fe1915cca..853b135d7d9bc50fd2fd52ed75bef9800e335245 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo.php @@ -189,7 +189,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract protected function _saveCreditmemo($creditmemo) { $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $creditmemo )->addObject( @@ -281,7 +281,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo = $this->_initCreditmemo(true); $this->_view->loadLayout(); $response = $this->_view->getLayout()->getBlock('order_items')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { @@ -307,7 +307,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo = $this->_initCreditmemo(); if ($creditmemo) { if ($creditmemo->getGrandTotal() <= 0 && !$creditmemo->getAllowZeroGrandTotal()) { - throw new \Magento\Core\Exception(__('Credit memo\'s total must be positive.')); + throw new \Magento\Model\Exception(__('Credit memo\'s total must be positive.')); } $comment = ''; @@ -328,7 +328,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract if (isset($data['do_offline'])) { //do not allow online refund for Refund to Store Credit if (!$data['do_offline'] && !empty($data['refund_customerbalance_return_enable'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Cannot create online refund for Refund to Store Credit.') ); } @@ -351,7 +351,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->_forward('noroute'); return; } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setFormData($data); } catch (\Exception $e) { @@ -374,7 +374,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo->cancel(); $this->_saveCreditmemo($creditmemo); $this->messageManager->addSuccess(__('The credit memo has been canceled.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('You canceled the credit memo.')); @@ -398,7 +398,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $creditmemo->void(); $this->_saveCreditmemo($creditmemo); $this->messageManager->addSuccess(__('You voided the credit memo.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t void the credit memo.')); @@ -420,7 +420,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->getRequest()->setParam('creditmemo_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - throw new \Magento\Core\Exception(__('The Comment Text field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Comment Text field cannot be empty.')); } $creditmemo = $this->_initCreditmemo(); $comment = $creditmemo->addComment( @@ -433,7 +433,7 @@ class Creditmemo extends \Magento\Sales\Controller\Adminhtml\Creditmemo\Abstract $this->_view->loadLayout(); $response = $this->_view->getLayout()->getBlock('creditmemo_comments')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php index e8e75d824710d20e961efaae89d7979180ef595b..7dade411b172f06d9ad0178568ddbcffe2ee8980 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Edit.php @@ -53,7 +53,7 @@ class Edit extends \Magento\Sales\Controller\Adminhtml\Order\Create } else { $this->_redirect('sales/order/'); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('sales/order/view', array('order_id' => $orderId)); } catch (\Exception $e) { diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php index cafabffeb0188c0afb7f25c74b7887e678460483..ad7039a40c6ee7e00aeb51428f477984fde156cb 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Controller\Adminhtml\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\App\ResponseInterface; /** @@ -141,7 +141,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic { $invoice->getOrder()->setIsInProcess(true); $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $invoice )->addObject( @@ -311,7 +311,7 @@ class Invoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoic $invoice->getOrder()->setIsInProcess(true); $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $invoice )->addObject( diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php index 05f35dca12f0bfd0c2b7eb4ecaa4ff8fcc794ce6..388e532cf3c6c5f4c1a292ae412dbfaab41b6cc9 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/Status.php @@ -160,7 +160,7 @@ class Status extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You have saved the order status.')); $this->_redirect('sales/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -211,7 +211,7 @@ class Status extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('You have assigned the order status.')); $this->_redirect('sales/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( @@ -239,7 +239,7 @@ class Status extends \Magento\Backend\App\Action try { $status->unassignState($state); $this->messageManager->addSuccess(__('You have unassigned the order status.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException( diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php b/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php index 77628119757a5a7646fd6b22b1ec387c35bb10e1..6866b1c135d53057b082fd1a1b265cd223699b0d 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Order/View/Giftmessage.php @@ -43,7 +43,7 @@ class Giftmessage extends \Magento\Backend\App\Action $this->_getGiftmessageSaveModel()->setGiftmessages( $this->getRequest()->getParam('giftmessage') )->saveAllInOrder(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong while saving the gift message.')); diff --git a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php index e747db34f6a1782c099eb31305143ded7ecf5aa0..8f7853a6332966435a2ce3295a8ed2f864c377e3 100644 --- a/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php +++ b/app/code/Magento/Sales/Controller/Adminhtml/Transactions.php @@ -136,7 +136,7 @@ class Transactions extends \Magento\Backend\App\Action $txn->getOrderPaymentObject()->setOrder($txn->getOrder())->importTransactionInfo($txn); $txn->save(); $this->messageManager->addSuccess(__('The transaction details have been updated.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('We can\'t update the transaction details.')); diff --git a/app/code/Magento/Sales/Helper/Admin.php b/app/code/Magento/Sales/Helper/Admin.php index 234283fb91763b0a7339f9dd6fac8b468d405aba..116b145a9150ec3fb4171534f1b7807445bcdea7 100644 --- a/app/code/Magento/Sales/Helper/Admin.php +++ b/app/code/Magento/Sales/Helper/Admin.php @@ -113,8 +113,8 @@ class Admin extends \Magento\App\Helper\AbstractHelper /** * Filter collection by removing not available product types * - * @param \Magento\Core\Model\Resource\Db\Collection\AbstractCollection $collection - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @param \Magento\Model\Resource\Db\Collection\AbstractCollection $collection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function applySalableProductTypesFilter($collection) { diff --git a/app/code/Magento/Sales/Model/AbstractModel.php b/app/code/Magento/Sales/Model/AbstractModel.php index 7b51ce6f07566751c9cf91e53968aec5a81d1705..16c30c276efe11b6380eae5722bb94241d49ddd7 100644 --- a/app/code/Magento/Sales/Model/AbstractModel.php +++ b/app/code/Magento/Sales/Model/AbstractModel.php @@ -29,7 +29,7 @@ namespace Magento\Sales\Model; * Sales abstract model * Provide date processing functionality */ -abstract class AbstractModel extends \Magento\Core\Model\AbstractModel +abstract class AbstractModel extends \Magento\Model\AbstractModel { /** * @var \Magento\Stdlib\DateTime\TimezoneInterface @@ -46,7 +46,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ abstract class AbstractModel extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/AdminOrder/Create.php b/app/code/Magento/Sales/Model/AdminOrder/Create.php index 3d1309109dcb3cf31df482d329f7c913533083c7..913e4599f73f5d9fb207608ce294813f4d9729bf 100644 --- a/app/code/Magento/Sales/Model/AdminOrder/Create.php +++ b/app/code/Magento/Sales/Model/AdminOrder/Create.php @@ -383,7 +383,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param \Magento\Sales\Model\Order $order * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function initFromOrder(\Magento\Sales\Model\Order $order) { @@ -407,7 +407,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if ($qty > 0) { $item = $this->initFromOrderItem($orderItem, $qty); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } } } @@ -583,7 +583,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $customerId = (int)$this->getSession()->getCustomerId(); if ($customerId) { $this->_wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist'); - $this->_wishlist->loadByCustomer($customerId, true); + $this->_wishlist->loadByCustomerId($customerId, true); $this->_wishlist->setStore( $this->getSession()->getStore() )->setSharedStoreIds( @@ -662,7 +662,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param string $moveTo * @param int $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function moveQuoteItem($item, $moveTo, $qty) { @@ -687,7 +687,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $newItem = $this->getQuote()->addProduct($product, $info); if (is_string($newItem)) { - throw new \Magento\Core\Exception($newItem); + throw new \Magento\Model\Exception($newItem); } $product->unsSkipCheckRequiredOption(); $newItem->checkData(); @@ -722,7 +722,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $cartItem = $cart->addProduct($product, $info); if (is_string($cartItem)) { - throw new \Magento\Core\Exception($cartItem); + throw new \Magento\Model\Exception($cartItem); } $cartItem->setPrice($item->getProduct()->getPrice()); $this->_needCollectCart = true; @@ -734,7 +734,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if (!isset($moveTo[1])) { $wishlist = $this->_objectManager->create( 'Magento\Wishlist\Model\Wishlist' - )->loadByCustomer( + )->loadByCustomerId( $this->getSession()->getCustomerId(), true ); @@ -746,7 +746,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } } if (!$wishlist) { - throw new \Magento\Core\Exception(__('We couldn\'t find this wish list.')); + throw new \Magento\Model\Exception(__('We couldn\'t find this wish list.')); } $wishlist->setStore( $this->getSession()->getStore() @@ -786,7 +786,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function applySidebarData($data) { @@ -796,7 +796,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $orderItem = $this->_objectManager->create('Magento\Sales\Model\Order\Item')->load($orderItemId); $item = $this->initFromOrderItem($orderItem); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } } } @@ -893,7 +893,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param int|\Magento\Catalog\Model\Product $product * @param array|float|int|\Magento\Object $config * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProduct($product, $config = 1) { @@ -914,7 +914,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $product ); if (!$product->getId()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We could not add a product to cart by the ID "%1".', $productId) ); } @@ -923,7 +923,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $item = $this->quoteInitializer->init($this->getQuote(), $product, $config); if (is_string($item)) { - throw new \Magento\Core\Exception($item); + throw new \Magento\Model\Exception($item); } $item->checkData(); @@ -943,7 +943,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car $config['qty'] = isset($config['qty']) ? (double)$config['qty'] : 1; try { $this->addProduct($productId, $config); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { return $e; @@ -957,7 +957,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * * @param array $data * @return $this - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function updateQuoteItems($data) { @@ -1002,7 +1002,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->recollectCart(); throw $e; } catch (\Exception $e) { @@ -1019,7 +1019,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * @param \Magento\Sales\Model\Quote\Item $item * @param string $additionalOptions * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _parseOptions(\Magento\Sales\Model\Quote\Item $item, $additionalOptions) { @@ -1036,11 +1036,11 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car if (strlen(trim($_additionalOption))) { try { if (strpos($_additionalOption, ':') === false) { - throw new \Magento\Core\Exception(__('There is an error in one of the option rows.')); + throw new \Magento\Model\Exception(__('There is an error in one of the option rows.')); } list($label, $value) = explode(':', $_additionalOption, 2); } catch (\Exception $e) { - throw new \Magento\Core\Exception(__('There is an error in one of the option rows.')); + throw new \Magento\Model\Exception(__('There is an error in one of the option rows.')); } $label = trim($label); $value = trim($value); @@ -1804,17 +1804,17 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car * Validate quote data before order creation * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { $customerId = $this->getSession()->getCustomerId(); if (is_null($customerId)) { - throw new \Magento\Core\Exception(__('Please select a customer.')); + throw new \Magento\Model\Exception(__('Please select a customer.')); } if (!$this->getSession()->getStore()->getId()) { - throw new \Magento\Core\Exception(__('Please select a store.')); + throw new \Magento\Model\Exception(__('Please select a store.')); } $items = $this->getQuote()->getAllItems(); @@ -1847,7 +1847,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car } else { try { $method->validate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_errors[] = $e->getMessage(); } } @@ -1857,7 +1857,7 @@ class Create extends \Magento\Object implements \Magento\Checkout\Model\Cart\Car foreach ($this->_errors as $error) { $this->messageManager->addError($error); } - throw new \Magento\Core\Exception(''); + throw new \Magento\Model\Exception(''); } return $this; } diff --git a/app/code/Magento/Sales/Model/Config/Ordered.php b/app/code/Magento/Sales/Model/Config/Ordered.php index 57876cde80f956a026a1b10883dea002bb6a8741..15085604d78d6580d4f99c7e253983c90c9b2ecf 100644 --- a/app/code/Magento/Sales/Model/Config/Ordered.php +++ b/app/code/Magento/Sales/Model/Config/Ordered.php @@ -153,17 +153,38 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base /** * Aggregate before/after information from all items and sort totals based on this data + * Invoke simple sorting if the first element contains the "sort_order" key * * @param array $config * @return array */ - protected function _getSortedCollectorCodes(array $config) + private function _getSortedCollectorCodes(array $config) { - // invoke simple sorting if the first element contains the "sort_order" key reset($config); $element = current($config); if (isset($element['sort_order'])) { - uasort($config, array($this, '_compareSortOrder')); + uasort( + $config, + // @codingStandardsIgnoreStart + /** + * @param array $a + * @param array $b + * @return int + */ + // @codingStandardsIgnoreEnd + function ($a, $b) { + if (!isset($a['sort_order']) || !isset($b['sort_order'])) { + return 0; + } + if ($a['sort_order'] > $b['sort_order']) { + return 1; + } elseif ($a['sort_order'] < $b['sort_order']) { + return -1; + } else { + return 0; + } + } + ); } $result = array_keys($config); return $result; @@ -192,26 +213,4 @@ abstract class Ordered extends \Magento\Core\Model\Config\Base return $this; } - - /** - * Callback that uses sort_order for comparison - * - * @param array $a - * @param array $b - * @return int - */ - protected function _compareSortOrder($a, $b) - { - if (!isset($a['sort_order']) || !isset($b['sort_order'])) { - return 0; - } - if ($a['sort_order'] > $b['sort_order']) { - $res = 1; - } elseif ($a['sort_order'] < $b['sort_order']) { - $res = -1; - } else { - $res = 0; - } - return $res; - } } diff --git a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php index fcf884cfe283db0c4304d2cb4d61452b6dff9394..3dbbf6751742f728822ac3d9f4e464fd4ca6e208 100644 --- a/app/code/Magento/Sales/Model/Config/Source/Order/Status.php +++ b/app/code/Magento/Sales/Model/Config/Source/Order/Status.php @@ -31,9 +31,10 @@ namespace Magento\Sales\Model\Config\Source\Order; class Status implements \Magento\Option\ArrayInterface { - // set null to enable all possible + const UNDEFINED_OPTION_LABEL = '-- Please Select --'; + /** - * @var array + * @var string[] */ protected $_stateStatuses = array( \Magento\Sales\Model\Order::STATE_NEW, @@ -62,15 +63,13 @@ class Status implements \Magento\Option\ArrayInterface */ public function toOptionArray() { - if ($this->_stateStatuses) { - $statuses = $this->_orderConfig->getStateStatuses($this->_stateStatuses); - } else { - $statuses = $this->_orderConfig->getStatuses(); - } - $options = array(); - $options[] = array('value' => '', 'label' => __('-- Please Select --')); + $statuses = $this->_stateStatuses + ? $this->_orderConfig->getStateStatuses($this->_stateStatuses) + : $this->_orderConfig->getStatuses(); + + $options = [['value' => '', 'label' => __(self::UNDEFINED_OPTION_LABEL)]]; foreach ($statuses as $code => $label) { - $options[] = array('value' => $code, 'label' => $label); + $options[] = ['value' => $code, 'label' => $label]; } return $options; } diff --git a/app/code/Magento/Sales/Model/ConverterInterface.php b/app/code/Magento/Sales/Model/ConverterInterface.php index 3bf8d21ef1c8859ffc2584f34842a77dca98b371..334aa991aa6e294fdf9dcab4e6dea403f0bda0f7 100644 --- a/app/code/Magento/Sales/Model/ConverterInterface.php +++ b/app/code/Magento/Sales/Model/ConverterInterface.php @@ -39,18 +39,18 @@ interface ConverterInterface /** * Decode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function decode(\Magento\Core\Model\AbstractModel $object, $filedName); + public function decode(\Magento\Model\AbstractModel $object, $filedName); /** * Encode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function encode(\Magento\Core\Model\AbstractModel $object, $filedName); + public function encode(\Magento\Model\AbstractModel $object, $filedName); } diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php index e2ee876d4e4601755391b74680dcb1f3422bdfd9..e7a52eaec6b942fa722f93b05d4fb048432251b6 100644 --- a/app/code/Magento/Sales/Model/Order.php +++ b/app/code/Magento/Sales/Model/Order.php @@ -632,7 +632,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory * @param Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory * @param Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -663,7 +663,7 @@ class Order extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Resource\Order\Shipment\CollectionFactory $shipmentCollectionFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\CollectionFactory $memoCollectionFactory, \Magento\Sales\Model\Resource\Order\Shipment\Track\CollectionFactory $trackCollectionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1268,7 +1268,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param bool $isCustomerNotified * @param bool $shouldProtectState * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _setState( $state, @@ -1280,7 +1280,7 @@ class Order extends \Magento\Sales\Model\AbstractModel // attempt to set the specified state if ($shouldProtectState) { if ($this->isStateProtected($state)) { - throw new \Magento\Core\Exception(__('The Order State "%1" must not be set manually.', $state)); + throw new \Magento\Model\Exception(__('The Order State "%1" must not be set manually.', $state)); } } $this->setData('state', $state); @@ -1389,12 +1389,12 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function hold() { if (!$this->canHold()) { - throw new \Magento\Core\Exception(__('A hold action is not available.')); + throw new \Magento\Model\Exception(__('A hold action is not available.')); } $this->setHoldBeforeState($this->getState()); $this->setHoldBeforeStatus($this->getStatus()); @@ -1406,12 +1406,12 @@ class Order extends \Magento\Sales\Model\AbstractModel * Attempt to unhold the order * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function unhold() { if (!$this->canUnhold()) { - throw new \Magento\Core\Exception(__('You cannot remove the hold.')); + throw new \Magento\Model\Exception(__('You cannot remove the hold.')); } $this->setState($this->getHoldBeforeState(), $this->getHoldBeforeStatus()); $this->setHoldBeforeState(null); @@ -1441,7 +1441,7 @@ class Order extends \Magento\Sales\Model\AbstractModel * @param string $comment * @param bool $graceful * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function registerCancellation($comment = '', $graceful = true) { @@ -1475,7 +1475,7 @@ class Order extends \Magento\Sales\Model\AbstractModel $this->_setState($cancelState, true, $comment); } elseif (!$graceful) { - throw new \Magento\Core\Exception(__('We cannot cancel this order.')); + throw new \Magento\Model\Exception(__('We cannot cancel this order.')); } return $this; } @@ -2341,10 +2341,10 @@ class Order extends \Magento\Sales\Model\AbstractModel /** * Add New object to related array * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function addRelatedObject(\Magento\Core\Model\AbstractModel $object) + public function addRelatedObject(\Magento\Model\AbstractModel $object) { $this->_relatedObjects[] = $object; return $this; @@ -2599,7 +2599,6 @@ class Order extends \Magento\Sales\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } } diff --git a/app/code/Magento/Sales/Model/Order/Address.php b/app/code/Magento/Sales/Model/Order/Address.php index 4973938f7b9a7c9c6eabf758614815430d121e3e..77466aa02b38ef898efe9a58ce67f4e40e8a5a51 100644 --- a/app/code/Magento/Sales/Model/Order/Address.php +++ b/app/code/Magento/Sales/Model/Order/Address.php @@ -98,7 +98,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -111,7 +111,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Creditmemo.php index a17e0c364c76e4a691c25d15c2f5d058427c42d0..51b0e516bc428ca37fc0764f50daf15ef5803890 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Order creditmemo model @@ -277,7 +277,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel * @param Creditmemo\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -297,7 +297,7 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Creditmemo\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Creditmemo\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1063,11 +1063,10 @@ class Creditmemo extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php index 1d5d7c335d87850089e22ff26b70c7a20718f3eb..8f7aa96a43a415db6b9e45f0e61e12869f9311d6 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php index f8b5761bb00c66a35f99984aabfcdb359509f7da..90bc82ac4e7f263397538784b8f85a0a199c005b 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Item.php @@ -92,7 +92,7 @@ namespace Magento\Sales\Model\Order\Creditmemo; * @method float getBaseHiddenTaxAmount() * @method \Magento\Sales\Model\Order\Creditmemo\Item setBaseHiddenTaxAmount(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -123,7 +123,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -131,7 +131,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -206,7 +206,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -222,7 +222,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $this->getOrderItem()->getQtyToRefund() || $this->getOrderItem()->isDummy()) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid quantity to refund item "%1".', $this->getName()) ); } diff --git a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php index ed3c865aaf7f13c5fb1aa2bb96854ec7d8956133..159a1fbe67041cb83899a5aff71516087930a827 100644 --- a/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php +++ b/app/code/Magento/Sales/Model/Order/Creditmemo/Total/Shipping.php @@ -58,7 +58,7 @@ class Shipping extends AbstractTotal /** * @param \Magento\Sales\Model\Order\Creditmemo $creditmemo * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function collect(\Magento\Sales\Model\Order\Creditmemo $creditmemo) { @@ -108,7 +108,7 @@ class Shipping extends AbstractTotal } } else { $baseAllowedAmount = $order->getBaseCurrency()->format($baseAllowedAmount, null, false); - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Maximum shipping amount allowed to refund is: %1', $baseAllowedAmount) ); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice.php b/app/code/Magento/Sales/Model/Order/Invoice.php index f14e00140ef336f138bf53867db74ea4158e631b..0a75ed42cdb2199d52cfc109bc4c601fa9097fca 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Invoice.php @@ -287,7 +287,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * @param Invoice\CommentFactory $invoiceCommentFactory * @param \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -307,7 +307,7 @@ class Invoice extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Invoice\CommentFactory $invoiceCommentFactory, \Magento\Sales\Model\Resource\Order\Invoice\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -739,12 +739,12 @@ class Invoice extends \Magento\Sales\Model\AbstractModel * Apply to order, order items etc. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function register() { if ($this->getId()) { - throw new \Magento\Core\Exception(__('We cannot register an existing invoice')); + throw new \Magento\Model\Exception(__('We cannot register an existing invoice')); } foreach ($this->getAllItems() as $item) { @@ -1073,11 +1073,10 @@ class Invoice extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php index 7cd47248a1813d675948807c117d04ffeb11cd0e..40b03529fd8a0ccbee8d1a15e408a21b5c41f52a 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Invoice/Item.php b/app/code/Magento/Sales/Model/Order/Invoice/Item.php index bb200ef3936e385b2fe5ac3c7c5b3c36a6069d21..135bc399de0a1d5ee7846d1708abc59cb7c5adab 100644 --- a/app/code/Magento/Sales/Model/Order/Invoice/Item.php +++ b/app/code/Magento/Sales/Model/Order/Invoice/Item.php @@ -92,7 +92,7 @@ namespace Magento\Sales\Model\Order\Invoice; * @method float getBaseHiddenTaxAmount() * @method \Magento\Sales\Model\Order\Invoice\Item setBaseHiddenTaxAmount(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -123,7 +123,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -131,7 +131,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -206,7 +206,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -224,7 +224,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $qtyToInvoice || $this->getOrderItem()->isDummy()) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We found an invalid quantity to invoice item "%1".', $this->getName()) ); } diff --git a/app/code/Magento/Sales/Model/Order/Item.php b/app/code/Magento/Sales/Model/Order/Item.php index 502a845198a8e5c8fb370c6c6903167197a0e2c9..860c3d07a23cb4863d01e04874a75752f6b8f8ad 100644 --- a/app/code/Magento/Sales/Model/Order/Item.php +++ b/app/code/Magento/Sales/Model/Order/Item.php @@ -188,7 +188,7 @@ namespace Magento\Sales\Model\Order; * @method float getBaseDiscountRefunded() * @method \Magento\Sales\Model\Order\Item setBaseDiscountRefunded(float $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { const STATUS_PENDING = 1; @@ -266,7 +266,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -275,7 +275,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Payment.php b/app/code/Magento/Sales/Model/Order/Payment.php index fb6a556ef20c715a6801726fd33fae9ef5323568..3828a0eb5f27cb8b505096f49537651fbcc95ade 100644 --- a/app/code/Magento/Sales/Model/Order/Payment.php +++ b/app/code/Magento/Sales/Model/Order/Payment.php @@ -215,7 +215,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory * @param \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -228,7 +228,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Sales\Model\Order\Payment\TransactionFactory $transactionFactory, \Magento\Sales\Model\Resource\Order\Payment\Transaction\CollectionFactory $transactionCollectionFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -415,7 +415,7 @@ class Payment extends \Magento\Payment\Model\Info * TODO: eliminate logic duplication with registerCaptureNotification() * * @param null|Invoice $invoice - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function capture($invoice) @@ -495,7 +495,7 @@ class Payment extends \Magento\Payment\Model\Info $this->getMethodInstance()->processInvoice($invoice, $this); return $this; } - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction "%1" cannot be captured yet.', $invoice->getTransactionId()) ); } @@ -708,7 +708,7 @@ class Payment extends \Magento\Payment\Model\Info * @param Creditmemo $creditmemo * @return $this * @throws \Exception - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function refund($creditmemo) { @@ -745,7 +745,7 @@ class Payment extends \Magento\Payment\Model\Info $creditmemo, $this ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if (!$captureTxn) { $e->setMessage( ' ' . __('If the invoice was created offline, try creating an offline credit memo.'), diff --git a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php index 1abf5f66a39409ba0656b64fa80ba49727cb8737..5272ffd24debbda3237e267dc248cd7c053f6152 100644 --- a/app/code/Magento/Sales/Model/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Order/Payment/Transaction.php @@ -49,7 +49,7 @@ namespace Magento\Sales\Model\Order\Payment; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Transaction extends \Magento\Core\Model\AbstractModel +class Transaction extends \Magento\Model\AbstractModel { /**#@+ * Supported transaction types @@ -175,7 +175,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param \Magento\Sales\Model\Order\PaymentFactory $paymentFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -185,7 +185,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel \Magento\Sales\Model\Order\PaymentFactory $paymentFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Stdlib\DateTime\DateTimeFactory $dateFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -238,14 +238,14 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $parentTxnId * @param string $txnId * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setParentTxnId($parentTxnId, $txnId = null) { $this->_verifyTxnId($parentTxnId); if (empty($txnId)) { if ('' == $this->getTxnId()) { - throw new \Magento\Core\Exception(__('The parent transaction ID must have a transaction ID.')); + throw new \Magento\Model\Exception(__('The parent transaction ID must have a transaction ID.')); } } else { $this->setTxnId($txnId); @@ -439,7 +439,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel return false; } return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // jam all logical exceptions, fallback to false } return false; @@ -515,12 +515,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * @param string $key * @param mixed $value * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setAdditionalInformation($key, $value) { if (is_object($value)) { - throw new \Magento\Core\Exception(__('Payment transactions disallow storing objects.')); + throw new \Magento\Model\Exception(__('Payment transactions disallow storing objects.')); } $info = $this->_getData('additional_information'); if (!$info) { @@ -572,7 +572,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param bool $shouldSave * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Exception */ public function close($shouldSave = true) @@ -581,7 +581,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel $this->_verifyThisTransactionExists(); } if (1 == $this->getIsClosed() && $this->_isFailsafe) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The transaction "%1" (%2) is already closed.', $this->getTxnId(), $this->getTxnType()) ); } @@ -666,7 +666,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param \Magento\Sales\Model\Order|null|boolean $order * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setOrder($order = null) { @@ -681,7 +681,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel } elseif (!$this->getId() || $this->getOrderId() == $order->getId()) { $this->_order = $order; } else { - throw new \Magento\Core\Exception(__('Set order for existing transactions not allowed')); + throw new \Magento\Model\Exception(__('Set order for existing transactions not allowed')); } return $this; @@ -730,7 +730,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * Load child transactions * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _loadChildren() { @@ -743,7 +743,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel $payment = $this->_verifyPaymentObject(true); $paymentId = $payment ? $payment->getId() : $this->_getData('payment_id'); if (!$paymentId) { - throw new \Magento\Core\Exception(__('At minimum, you need to set a payment ID.')); + throw new \Magento\Model\Exception(__('At minimum, you need to set a payment ID.')); } $this->setOrder(true); @@ -841,7 +841,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnType * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnType($txnType = null) { @@ -857,7 +857,7 @@ class Transaction extends \Magento\Core\Model\AbstractModel case self::TYPE_REFUND: break; default: - throw new \Magento\Core\Exception(__('We found an unsupported transaction type "%1".', $txnType)); + throw new \Magento\Model\Exception(__('We found an unsupported transaction type "%1".', $txnType)); } } @@ -867,13 +867,13 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param bool $dryRun * @return \Magento\Sales\Model\Order\Payment|null|false - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyPaymentObject($dryRun = false) { if (!$this->_paymentObject || !$this->getOrderId()) { if (!$dryRun) { - throw new \Magento\Core\Exception(__('Please set a proper payment object.')); + throw new \Magento\Model\Exception(__('Please set a proper payment object.')); } } return $this->_paymentObject; @@ -884,12 +884,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * * @param string $txnId * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyTxnId($txnId) { if (null !== $txnId && 0 == strlen($txnId)) { - throw new \Magento\Core\Exception(__('The Transaction ID field cannot be empty.')); + throw new \Magento\Model\Exception(__('The Transaction ID field cannot be empty.')); } } @@ -898,12 +898,12 @@ class Transaction extends \Magento\Core\Model\AbstractModel * TODO for more restriction we can check for data consistency * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _verifyThisTransactionExists() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('You can\'t do this without a transaction object.')); + throw new \Magento\Model\Exception(__('You can\'t do this without a transaction object.')); } $this->_verifyTxnType(); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php index 7fa65d8b3d98b4f87fadbece72f5e5ec8b1d664e..496d0641f9383b3828dc32bbbea51a9cd80be24b 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php @@ -93,11 +93,6 @@ abstract class AbstractPdf extends \Magento\Object */ protected $_coreStoreConfig; - /** - * @var \Magento\TranslateInterface - */ - protected $_translate; - /** * @var \Magento\Filesystem\Directory\WriteInterface */ @@ -123,16 +118,21 @@ abstract class AbstractPdf extends \Magento\Object */ protected $_pdfItemsFactory; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -141,24 +141,24 @@ abstract class AbstractPdf extends \Magento\Object \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, array $data = array() ) { $this->_paymentData = $paymentData; $this->_localeDate = $localeDate; $this->string = $string; $this->_coreStoreConfig = $coreStoreConfig; - $this->_translate = $translate; $this->_mediaDirectory = $filesystem->getDirectoryWrite(\Magento\App\Filesystem::MEDIA_DIR); $this->_rootDirectory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); $this->_pdfConfig = $pdfConfig; $this->_pdfTotalFactory = $pdfTotalFactory; $this->_pdfItemsFactory = $pdfItemsFactory; + $this->inlineTranslation = $inlineTranslation; parent::__construct($data); } @@ -709,7 +709,7 @@ abstract class AbstractPdf extends \Magento\Object */ protected function _beforeGetPdf() { - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); } /** @@ -719,7 +719,7 @@ abstract class AbstractPdf extends \Magento\Object */ protected function _afterGetPdf() { - $this->_translate->setTranslateInline(true); + $this->inlineTranslation->resume(); } /** @@ -767,7 +767,7 @@ abstract class AbstractPdf extends \Magento\Object * * @param string $type * @return \Magento\Sales\Model\Order\Pdf\Items\AbstractItems - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getRenderer($type) { @@ -776,7 +776,7 @@ abstract class AbstractPdf extends \Magento\Object } if (!isset($this->_renderers[$type])) { - throw new \Magento\Core\Exception(__('We found an invalid renderer model.')); + throw new \Magento\Model\Exception(__('We found an invalid renderer model.')); } if (is_null($this->_renderers[$type]['renderer'])) { @@ -885,13 +885,13 @@ abstract class AbstractPdf extends \Magento\Object /** * Retrieve PDF object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf */ protected function _getPdf() { if (!$this->_pdf instanceof \Zend_Pdf) { - throw new \Magento\Core\Exception(__('Please define the PDF object before using.')); + throw new \Magento\Model\Exception(__('Please define the PDF object before using.')); } return $this->_pdf; @@ -935,14 +935,14 @@ abstract class AbstractPdf extends \Magento\Object * @param \Zend_Pdf_Page $page * @param array $draw * @param array $pageSettings - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf_Page */ public function drawLineBlocks(\Zend_Pdf_Page $page, array $draw, array $pageSettings = array()) { foreach ($draw as $itemsProp) { if (!isset($itemsProp['lines']) || !is_array($itemsProp['lines'])) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We don\'t recognize the draw line data. Please define the "lines" array.') ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php index 10b8cdd952df394db1600e5cda2a4a7f923d6c6e..8fd9fad05c9642791dff2845a2103c33a1796e2c 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Creditmemo.php @@ -60,12 +60,12 @@ class Creditmemo extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Creditmemo extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php index ae09f3ef9eaaf526e9668138370c6b541df3f8f7..e3755c7e5fde3dadafc0261f0bf047cc710c2fe2 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Invoice.php @@ -44,12 +44,12 @@ class Invoice extends AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data @@ -60,12 +60,12 @@ class Invoice extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Invoice extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php index 59d6acbc25198f9190844e548bc8937dbcc77d2c..b91a0832f48ae5ccfb5aa5d6063717b3b0162d3a 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/AbstractItems.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Order\Pdf\Items; /** * Sales Order Pdf Items renderer Abstract */ -abstract class AbstractItems extends \Magento\Core\Model\AbstractModel +abstract class AbstractItems extends \Magento\Model\AbstractModel { /** * Order model @@ -40,7 +40,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Source model (invoice, shipment, creditmemo) * - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_source; @@ -88,7 +88,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\App\Filesystem $filesystem , * @param \Magento\Filter\FilterManager $filterManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -98,7 +98,7 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel \Magento\Tax\Helper\Data $taxData, \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -123,10 +123,10 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Set Source model * - * @param \Magento\Core\Model\AbstractModel $source + * @param \Magento\Model\AbstractModel $source * @return $this */ - public function setSource(\Magento\Core\Model\AbstractModel $source) + public function setSource(\Magento\Model\AbstractModel $source) { $this->_source = $source; return $this; @@ -171,13 +171,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve order object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order */ public function getOrder() { if (null === $this->_order) { - throw new \Magento\Core\Exception(__('The order object is not specified.')); + throw new \Magento\Model\Exception(__('The order object is not specified.')); } return $this->_order; } @@ -185,13 +185,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve source object * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\AbstractModel + * @throws \Magento\Model\Exception + * @return \Magento\Model\AbstractModel */ public function getSource() { if (null === $this->_source) { - throw new \Magento\Core\Exception(__('The source object is not specified.')); + throw new \Magento\Model\Exception(__('The source object is not specified.')); } return $this->_source; } @@ -199,13 +199,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve item object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Object */ public function getItem() { if (null === $this->_item) { - throw new \Magento\Core\Exception(__('An item object is not specified.')); + throw new \Magento\Model\Exception(__('An item object is not specified.')); } return $this->_item; } @@ -213,13 +213,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve Pdf model * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order\Pdf\AbstractPdf */ public function getPdf() { if (null === $this->_pdf) { - throw new \Magento\Core\Exception(__('A PDF object is not specified.')); + throw new \Magento\Model\Exception(__('A PDF object is not specified.')); } return $this->_pdf; } @@ -227,13 +227,13 @@ abstract class AbstractItems extends \Magento\Core\Model\AbstractModel /** * Retrieve Pdf page object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Zend_Pdf_Page */ public function getPage() { if (null === $this->_pdfPage) { - throw new \Magento\Core\Exception(__('A PDF page object is not specified.')); + throw new \Magento\Model\Exception(__('A PDF page object is not specified.')); } return $this->_pdfPage; } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php index bdf64655d3c8bcedfb4c4dd0437a61a3512c91d9..ec21d8430da3b21500d5cd4dce365797c4b2c50c 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php @@ -44,7 +44,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultCreditmemo extends \Magento\Sales\Model\Order\Pdf\Items\AbstractIte \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php index efed464d8825c023b38199d30169defa98bd830d..b25083fdca25885304ca52f300d4f1ccb075303b 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php @@ -44,7 +44,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultInvoice extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php index 78305852952c20642774f6d53d9dc935cf79833e..b1b52f57b278e9db5378a3ce6a9384c609689f1a 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php @@ -44,7 +44,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems * @param \Magento\App\Filesystem $filesystem * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\String $string - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -55,7 +55,7 @@ class DefaultShipment extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems \Magento\App\Filesystem $filesystem, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\String $string, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php index 8b704cc57de5086cfa93b13bbe47d0be1d6df9fb..3cbba9b75d978e9cab9fa4c441be531808c38454 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Shipment.php @@ -44,12 +44,12 @@ class Shipment extends AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Locale\ResolverInterface $localeResolver * @param array $data @@ -60,12 +60,12 @@ class Shipment extends AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Locale\ResolverInterface $localeResolver, array $data = array() @@ -76,12 +76,12 @@ class Shipment extends AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php b/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php index 1efb105b6faeaca6af898d2451701507dfef9457..7d982bdf7593f179b65acf3cddbbcf16ad9e01cd 100644 --- a/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php +++ b/app/code/Magento/Sales/Model/Order/Pdf/Total/Factory.php @@ -51,13 +51,13 @@ class Factory * @param string|null $class * @param array $arguments * @return \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create($class = null, $arguments = array()) { $class = $class ?: $this->_defaultTotalModel; if (!is_a($class, 'Magento\Sales\Model\Order\Pdf\Total\DefaultTotal', true)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( "The PDF total model {$class} must be or extend " . "\\Magento\\Sales\\Model\\Order\\Pdf\\Total\\DefaultTotal." diff --git a/app/code/Magento/Sales/Model/Order/Shipment.php b/app/code/Magento/Sales/Model/Order/Shipment.php index 8b6671395c80b754b89abc4b28b6879b82297941..e06df0dca3759104c63451657c3b234c98f93134 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment.php @@ -202,7 +202,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * @param Shipment\CommentFactory $commentFactory * @param \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -220,7 +220,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel \Magento\Sales\Model\Order\Shipment\CommentFactory $commentFactory, \Magento\Sales\Model\Resource\Order\Shipment\Comment\CollectionFactory $commentCollectionFactory, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -325,12 +325,12 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * Apply to order, order items etc. * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function register() { if ($this->getId()) { - throw new \Magento\Core\Exception(__('We cannot register an existing shipment')); + throw new \Magento\Model\Exception(__('We cannot register an existing shipment')); } $totalQty = 0; @@ -475,7 +475,7 @@ class Shipment extends \Magento\Sales\Model\AbstractModel /** * Track saving is implemented in _afterSave() - * This enforces \Magento\Core\Model\AbstractModel::save() not to skip _afterSave() + * This enforces \Magento\Model\AbstractModel::save() not to skip _afterSave() */ $this->_hasDataChanges = true; @@ -738,12 +738,12 @@ class Shipment extends \Magento\Sales\Model\AbstractModel * Before object save * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { if ((!$this->getId() || null !== $this->_items) && !count($this->getAllItems())) { - throw new \Magento\Core\Exception(__('We cannot create an empty shipment.')); + throw new \Magento\Model\Exception(__('We cannot create an empty shipment.')); } if (!$this->getOrderId() && $this->getOrder()) { @@ -755,11 +755,10 @@ class Shipment extends \Magento\Sales\Model\AbstractModel } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _beforeDelete() { - $this->_protectFromNonAdmin(); return parent::_beforeDelete(); } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php index a9d5f6bc14b971850395ec1532c631a308c6daf1..7d3ec25edc348b8040a358bf06fc32ea3ab14466 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Comment.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Comment.php @@ -59,7 +59,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class Comment extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Item.php b/app/code/Magento/Sales/Model/Order/Shipment/Item.php index 8650f73e8ecc24c1a034436464c8e7b1d45d8789..15667539a0acd11eb49bdde190709c979a64355d 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Item.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Item.php @@ -50,7 +50,7 @@ namespace Magento\Sales\Model\Order\Shipment; * @method string getSku() * @method \Magento\Sales\Model\Order\Shipment\Item setSku(string $value) */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * @var string @@ -81,7 +81,7 @@ class Item extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Sales\Model\Order\ItemFactory $orderItemFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -89,7 +89,7 @@ class Item extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Sales\Model\Order\ItemFactory $orderItemFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -164,7 +164,7 @@ class Item extends \Magento\Core\Model\AbstractModel * * @param float $qty * @return \Magento\Sales\Model\Order\Invoice\Item - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setQty($qty) { @@ -180,7 +180,7 @@ class Item extends \Magento\Core\Model\AbstractModel if ($qty <= $this->getOrderItem()->getQtyToShip() || $this->getOrderItem()->isDummy(true)) { $this->setData('qty', $qty); } else { - throw new \Magento\Core\Exception(__('We found an invalid qty to ship for item "%1".', $this->getName())); + throw new \Magento\Model\Exception(__('We found an invalid qty to ship for item "%1".', $this->getName())); } return $this; } diff --git a/app/code/Magento/Sales/Model/Order/Shipment/Track.php b/app/code/Magento/Sales/Model/Order/Shipment/Track.php index ef835c901d4a932c255e2dffcd732dbd634f3b10..71f30fccef1e1ecfb1e1f7a44e361383961fb34b 100644 --- a/app/code/Magento/Sales/Model/Order/Shipment/Track.php +++ b/app/code/Magento/Sales/Model/Order/Shipment/Track.php @@ -90,7 +90,7 @@ class Track extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -101,7 +101,7 @@ class Track extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Status.php b/app/code/Magento/Sales/Model/Order/Status.php index 228e55859722bbc6f145b4118e14b10d57e82bed..dccf30e00444c820a7a362b1ebfd49940526f0f3 100644 --- a/app/code/Magento/Sales/Model/Order/Status.php +++ b/app/code/Magento/Sales/Model/Order/Status.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Order; -class Status extends \Magento\Core\Model\AbstractModel +class Status extends \Magento\Model\AbstractModel { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -36,7 +36,7 @@ class Status extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -44,7 +44,7 @@ class Status extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Status/History.php b/app/code/Magento/Sales/Model/Order/Status/History.php index 1bf6d3112bea3aa9f05a329484cc25e865a4566e..754ead6f62d8173f9723dc942f262a81dd6dc74b 100644 --- a/app/code/Magento/Sales/Model/Order/Status/History.php +++ b/app/code/Magento/Sales/Model/Order/Status/History.php @@ -74,7 +74,7 @@ class History extends \Magento\Sales\Model\AbstractModel * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -84,7 +84,7 @@ class History extends \Magento\Sales\Model\AbstractModel \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Order/Tax.php b/app/code/Magento/Sales/Model/Order/Tax.php index 4b6566f538aa275883e3e36a4b2f54e788cb1548..fd356b42ed4920255505dd4bfc47338005411b45 100644 --- a/app/code/Magento/Sales/Model/Order/Tax.php +++ b/app/code/Magento/Sales/Model/Order/Tax.php @@ -56,7 +56,7 @@ namespace Magento\Sales\Model\Order; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php index bd88a70b83a814097c8fd94bf3cc1fcbe416ad79..cb33393baf0c5054c7529225ce55b8955e1b86b4 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -81,13 +81,13 @@ class Base extends \Magento\Sales\Model\Config\Ordered * @param string $totalCode * @param array $totalConfig * @return \Magento\Sales\Model\Order\Total\AbstractTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initModelInstance($class, $totalCode, $totalConfig) { $model = $this->_orderTotalFactory->create($class); if (!$model instanceof \Magento\Sales\Model\Order\Total\AbstractTotal) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The total model should be extended from \Magento\Sales\Model\Order\Total\AbstractTotal.') ); } diff --git a/app/code/Magento/Sales/Model/Payment/Method/Converter.php b/app/code/Magento/Sales/Model/Payment/Method/Converter.php index 0b2afd9fdaefdde90e19bc406b3177e309044455..029aa55efc4816b59aae59cb4fc644650def2cd7 100644 --- a/app/code/Magento/Sales/Model/Payment/Method/Converter.php +++ b/app/code/Magento/Sales/Model/Payment/Method/Converter.php @@ -62,11 +62,11 @@ class Converter /** * Check if specified field is encrypted * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return bool */ - protected function _shouldBeEncrypted(\Magento\Core\Model\AbstractModel $object, $filedName) + protected function _shouldBeEncrypted(\Magento\Model\AbstractModel $object, $filedName) { $method = $object->getData('method'); return isset($this->_encryptFields[$method][$filedName]) && $this->_encryptFields[$method][$filedName]; @@ -75,11 +75,11 @@ class Converter /** * Decode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function decode(\Magento\Core\Model\AbstractModel $object, $filedName) + public function decode(\Magento\Model\AbstractModel $object, $filedName) { $value = $object->getData($filedName); @@ -93,11 +93,11 @@ class Converter /** * Encode data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $filedName * @return mixed */ - public function encode(\Magento\Core\Model\AbstractModel $object, $filedName) + public function encode(\Magento\Model\AbstractModel $object, $filedName) { $value = $object->getData($filedName); diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index 9ac153386b669ea4bd215501d6c02a1388b40447..c8ef7835159d1a35e0442d92100a7e333218e8a4 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -134,7 +134,7 @@ use Magento\Customer\Service\V1\CustomerGroupServiceInterface; * @method bool|null getIsPersistent() * @method Quote setIsPersistent(bool $value) */ -class Quote extends \Magento\Core\Model\AbstractModel +class Quote extends \Magento\Model\AbstractModel { /** * Checkout login method key @@ -321,7 +321,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\Converter $converter * @param \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService * @param \Magento\Customer\Model\Address\Converter $addressConverter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -347,7 +347,7 @@ class Quote extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\Converter $converter, \Magento\Customer\Service\V1\CustomerAddressServiceInterface $addressService, \Magento\Customer\Model\Address\Converter $addressConverter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -1234,7 +1234,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * * @param \Magento\Sales\Model\Quote\Item $item * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addItem(\Magento\Sales\Model\Quote\Item $item) { @@ -1247,7 +1247,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * Proper solution is to submit items one by one with customer confirmation each time. */ if ($item->isNominal() && $this->hasItems() || $this->hasNominalItems()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Sorry, but items with payment agreements must be ordered one at a time To continue, please remove or buy the other items in your cart, then order this item by itself.' ) @@ -1270,7 +1270,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param null|float|\Magento\Object $request * @param null|string $processMode * @return \Magento\Sales\Model\Quote\Item|string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addProductAdvanced(\Magento\Catalog\Model\Product $product, $request = null, $processMode = null) { @@ -1281,7 +1281,7 @@ class Quote extends \Magento\Core\Model\AbstractModel $request = new \Magento\Object(array('qty' => $request)); } if (!$request instanceof \Magento\Object) { - throw new \Magento\Core\Exception(__('We found an invalid request for adding product to quote.')); + throw new \Magento\Model\Exception(__('We found an invalid request for adding product to quote.')); } $cartCandidates = $product->getTypeInstance()->prepareForCartAdvanced($request, $product, $processMode); @@ -1338,7 +1338,7 @@ class Quote extends \Magento\Core\Model\AbstractModel } } if (!empty($errors)) { - throw new \Magento\Core\Exception(implode("\n", $errors)); + throw new \Magento\Model\Exception(implode("\n", $errors)); } $this->_eventManager->dispatch('sales_quote_product_add_after', array('items' => $items)); @@ -1421,7 +1421,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param \Magento\Object $buyRequest * @param null|array|\Magento\Object $params * @return \Magento\Sales\Model\Quote\Item - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * * @see \Magento\Catalog\Helper\Product::addParamsToBuyRequest() */ @@ -1429,7 +1429,7 @@ class Quote extends \Magento\Core\Model\AbstractModel { $item = $this->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__('This is the wrong quote item id to update configuration.')); + throw new \Magento\Model\Exception(__('This is the wrong quote item id to update configuration.')); } $productId = $item->getProduct()->getId(); @@ -1449,7 +1449,7 @@ class Quote extends \Magento\Core\Model\AbstractModel $resultItem = $this->addProduct($product, $buyRequest); if (is_string($resultItem)) { - throw new \Magento\Core\Exception($resultItem); + throw new \Magento\Model\Exception($resultItem); } if ($resultItem->getParentItem()) { diff --git a/app/code/Magento/Sales/Model/Quote/Address.php b/app/code/Magento/Sales/Model/Quote/Address.php index fd6b34559927e7379f7c2c86c938c229dd365e41..2aab04ed40734ba4f1c42796d24f72a1d9ac4cc4 100644 --- a/app/code/Magento/Sales/Model/Quote/Address.php +++ b/app/code/Magento/Sales/Model/Quote/Address.php @@ -285,7 +285,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress * @param CustomerAddressBuilder $customerAddressBuilder * @param CustomerAddressServiceInterface $customerAddressService * @param \Magento\Customer\Model\Address\Converter $addressConverter - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -312,7 +312,7 @@ class Address extends \Magento\Customer\Model\Address\AbstractAddress CustomerAddressBuilder $customerAddressBuilder, CustomerAddressServiceInterface $customerAddressService, \Magento\Customer\Model\Address\Converter $addressConverter, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php index 49138e482003920c1e0756009daf4638d8a4d559..2815479a3021ca23277765f0236d3d28ae143b8a 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php +++ b/app/code/Magento/Sales/Model/Quote/Address/AbstractCarrierInterface.php @@ -84,7 +84,7 @@ interface AbstractCarrierInterface /** * @param \Magento\Sales\Model\Quote\Address\RateRequest $request - * @return $this|bool|false|\Magento\Core\Model\AbstractModel + * @return $this|bool|false|\Magento\Model\AbstractModel */ public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request); diff --git a/app/code/Magento/Sales/Model/Quote/Address/Rate.php b/app/code/Magento/Sales/Model/Quote/Address/Rate.php index 4af3bb36d0a40355b2cca2b0b70febb77653af0c..ccba4d040b96155d6fc4447853084068c5f24acc 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Rate.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Rate.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Quote\Address; -use Magento\Core\Model\AbstractModel; +use \Magento\Model\AbstractModel; /** * @method \Magento\Sales\Model\Resource\Quote\Address\Rate _getResource() diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php index 5fe47831ef82a51a64057e19764fb4c837ef63d9..55409acdc2904115d3abddcd082465279f50584f 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/AbstractTotal.php @@ -140,12 +140,12 @@ abstract class AbstractTotal * Get quote address object * * @return \Magento\Sales\Model\Quote\Address - * @throws \Magento\Core\Exception if address not declared + * @throws \Magento\Model\Exception if address not declared */ protected function _getAddress() { if ($this->_address === null) { - throw new \Magento\Core\Exception(__('The address model is not defined.')); + throw new \Magento\Model\Exception(__('The address model is not defined.')); } return $this->_address; } diff --git a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php index 3c16844ae6eaca963862a10df61f370c58d1256e..401dc1339b64ca08e35a1ea7249cc9a218d70f98 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php @@ -134,13 +134,13 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * @param string $totalCode * @param array $totalConfig * @return \Magento\Sales\Model\Quote\Address\Total\AbstractTotal - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _initModelInstance($class, $totalCode, $totalConfig) { $model = $this->_totalFactory->create($class); if (!$model instanceof \Magento\Sales\Model\Quote\Address\Total\AbstractTotal) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'The address total model should be extended from \Magento\Sales\Model\Quote\Address\Total\AbstractTotal.' ) @@ -159,7 +159,7 @@ class Collector extends \Magento\Sales\Model\Config\Ordered * * @return $this */ - protected function _initRetrievers() + private function _initRetrievers() { $sorts = $this->_coreStoreConfig->getConfig(self::XML_PATH_SALES_TOTALS_SORT, $this->_store); foreach ($sorts as $code => $sortOrder) { diff --git a/app/code/Magento/Sales/Model/Quote/Item.php b/app/code/Magento/Sales/Model/Quote/Item.php index fbef7894563a12568147d40c517561bb105cc9cc..9c9b552bba1c5db87e62ea64c6f39b5c7ff9a791 100644 --- a/app/code/Magento/Sales/Model/Quote/Item.php +++ b/app/code/Magento/Sales/Model/Quote/Item.php @@ -206,7 +206,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * @param \Magento\Sales\Model\Status\ListFactory $statusListFactory * @param \Magento\Locale\FormatInterface $localeFormat * @param \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -219,7 +219,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem \Magento\Sales\Model\Status\ListFactory $statusListFactory, \Magento\Locale\FormatInterface $localeFormat, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -632,7 +632,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * * @param \Magento\Sales\Model\Quote\Item\Option|\Magento\Object $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addOption($option) { @@ -649,7 +649,7 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem } elseif ($option instanceof \Magento\Sales\Model\Quote\Item\Option) { $option->setItem($this); } else { - throw new \Magento\Core\Exception(__('We found an invalid item option format.')); + throw new \Magento\Model\Exception(__('We found an invalid item option format.')); } $exOption = $this->getOptionByCode($option->getCode()); @@ -710,14 +710,14 @@ class Item extends \Magento\Sales\Model\Quote\Item\AbstractItem * * @param \Magento\Sales\Model\Quote\Item\Option $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _addOptionCode($option) { if (!isset($this->_optionsByCode[$option->getCode()])) { $this->_optionsByCode[$option->getCode()] = $option; } else { - throw new \Magento\Core\Exception(__('An item option with code %1 already exists.', $option->getCode())); + throw new \Magento\Model\Exception(__('An item option with code %1 already exists.', $option->getCode())); } return $this; } diff --git a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php index dad68dc86743a658f5e490fcc38a5580e27975fa..9235a6e3136766d85bdb6affca21e74ba1fe6faa 100644 --- a/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php +++ b/app/code/Magento/Sales/Model/Quote/Item/AbstractItem.php @@ -54,7 +54,7 @@ use Magento\Sales\Model\Quote\Item; * @method int[] getAppliedRuleIds() * @method \Magento\Sales\Model\Quote\Item\AbstractItem setAppliedRuleIds(array $ruleIds) */ -abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements +abstract class AbstractItem extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface { /** @@ -88,7 +88,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Catalog\Model\ProductFactory $productFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -96,7 +96,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -318,7 +318,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements try { $this->setQty($qty); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setHasError(true); $this->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -328,7 +328,7 @@ abstract class AbstractItem extends \Magento\Core\Model\AbstractModel implements try { $this->getProduct()->getTypeInstance()->checkProductBuyState($this->getProduct()); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->setHasError(true)->setMessage($e->getMessage()); $this->getQuote()->setHasError( true diff --git a/app/code/Magento/Sales/Model/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Quote/Item/Option.php index aa3240311449364f218382c17feeb97802560fea..8fb48d48884c6c6cc98ffcb7cc96264275559f51 100644 --- a/app/code/Magento/Sales/Model/Quote/Item/Option.php +++ b/app/code/Magento/Sales/Model/Quote/Item/Option.php @@ -38,7 +38,7 @@ namespace Magento\Sales\Model\Quote\Item; * @method \Magento\Sales\Model\Quote\Item\Option setCode(string $value) * @method \Magento\Sales\Model\Quote\Item\Option setValue(string $value) */ -class Option extends \Magento\Core\Model\AbstractModel implements +class Option extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface { /** diff --git a/app/code/Magento/Sales/Model/Quote/Payment.php b/app/code/Magento/Sales/Model/Quote/Payment.php index 1e163a5be9b053d54f7fb97fa0a904f3c2f211e3..4d0a13f29e969da085fa613590c3abb507f2729c 100644 --- a/app/code/Magento/Sales/Model/Quote/Payment.php +++ b/app/code/Magento/Sales/Model/Quote/Payment.php @@ -93,7 +93,7 @@ class Payment extends \Magento\Payment\Model\Info * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -103,7 +103,7 @@ class Payment extends \Magento\Payment\Model\Info \Magento\Payment\Helper\Data $paymentData, \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Payment\Model\Checks\SpecificationFactory $methodSpecificationFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -151,7 +151,7 @@ class Payment extends \Magento\Payment\Model\Info * * @param array $data * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function importData(array $data) { @@ -179,7 +179,7 @@ class Payment extends \Magento\Payment\Model\Info $this->getQuote() ) ) { - throw new \Magento\Core\Exception(__('The requested Payment Method is not available.')); + throw new \Magento\Model\Exception(__('The requested Payment Method is not available.')); } $method->assignData($data); @@ -202,7 +202,7 @@ class Payment extends \Magento\Payment\Model\Info } try { $method = $this->getMethodInstance(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { return parent::_beforeSave(); } $method->prepareSave(); diff --git a/app/code/Magento/Sales/Model/Resource/AbstractResource.php b/app/code/Magento/Sales/Model/Resource/AbstractResource.php index d0fa595d64768863cdcfaa6a26f09fb4481448fc..22dd41d55b3355c1cdf8d007b3d165679e8ea715 100644 --- a/app/code/Magento/Sales/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Sales/Model/Resource/AbstractResource.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\AbstractDb +abstract class AbstractResource extends \Magento\Model\Resource\Db\AbstractDb { /** * Data converter object @@ -59,10 +59,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $object) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $object) { $currentTime = $this->dateTime->now(); if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) { @@ -86,10 +86,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { parent::_beforeSave($object); @@ -104,10 +104,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if (true == $this->_shouldBeConverted()) { foreach ($object->getData() as $fieldName => $fieldValue) { @@ -120,10 +120,10 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { if (true == $this->_shouldBeConverted()) { foreach ($object->getData() as $fieldName => $fieldValue) { diff --git a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php index 875a681eff33f701bada134ce0f1f0405497ad69..5336327dfc25c93544ed3c7d7ed0909179daaaf3 100644 --- a/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Collection/AbstractCollection.php @@ -32,14 +32,14 @@ namespace Magento\Sales\Model\Resource\Collection; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +abstract class AbstractCollection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Check if $attribute is \Magento\Eav\Model\Entity\Attribute and convert to string field name * * @param string|\Magento\Eav\Model\Entity\Attribute $attribute * @return string - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _attributeToField($attribute) { @@ -50,7 +50,7 @@ abstract class AbstractCollection extends \Magento\Core\Model\Resource\Db\Collec $field = $attribute->getAttributeCode(); } if (!$field) { - throw new \Magento\Core\Exception(__('We cannot determine the field name.')); + throw new \Magento\Model\Exception(__('We cannot determine the field name.')); } return $field; } diff --git a/app/code/Magento/Sales/Model/Resource/Helper.php b/app/code/Magento/Sales/Model/Resource/Helper.php index 371caba1fe51d9cacc98eb6d0bce6caae7dc2e2c..503f30206f1bec34df4fefc3787c7e4aa99172c5 100644 --- a/app/code/Magento/Sales/Model/Resource/Helper.php +++ b/app/code/Magento/Sales/Model/Resource/Helper.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource; /** * Sales Mysql resource helper model */ -class Helper extends \Magento\Core\Model\Resource\Helper implements HelperInterface +class Helper extends \Magento\DB\Helper implements HelperInterface { /** * @var \Magento\Reports\Model\Resource\Helper diff --git a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php index 811160d32987a2e9f31da6777aef2d9f910d92fa..88ee734ab871f24747aec7f92bccc5e9dccd2946 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php +++ b/app/code/Magento/Sales/Model/Resource/Order/AbstractOrder.php @@ -123,14 +123,14 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou * @param array $joinCondition * @param string $column * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addVirtualGridColumn($alias, $table, $joinCondition, $column) { $table = $this->getTable($table); if (!in_array($alias, $this->getGridColumns())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please specify a valid grid column alias name that exists in the grid table.') ); } @@ -304,11 +304,11 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Before save object attribute * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this */ - protected function _beforeSaveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + protected function _beforeSaveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($this->_eventObject && $this->_eventPrefix) { $this->_eventManager->dispatch( @@ -322,11 +322,11 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * After save object attribute * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this */ - protected function _afterSaveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + protected function _afterSaveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($this->_eventObject && $this->_eventPrefix) { $this->_eventManager->dispatch( @@ -340,12 +340,12 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $attribute * @return $this * @throws \Exception */ - public function saveAttribute(\Magento\Core\Model\AbstractModel $object, $attribute) + public function saveAttribute(\Magento\Model\AbstractModel $object, $attribute) { if ($attribute instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) { $attribute = $attribute->getAttributeCode(); @@ -386,10 +386,10 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { if ($this->_useIncrementId && !$object->getIncrementId()) { /* @var $entityType \Magento\Eav\Model\Entity\Type */ @@ -403,7 +403,7 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Update field in table if model have been already saved * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param array $data * @return $this */ @@ -437,10 +437,10 @@ abstract class AbstractOrder extends \Magento\Sales\Model\Resource\AbstractResou /** * Save object data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if (!$object->getForceObjectSave()) { parent::save($object); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Address.php b/app/code/Magento/Sales/Model/Resource/Order/Address.php index f2f0fede4ee18c15e8a2b88b1df7d488036c4412..a577d1dceb3b42d284f485e2e1584bc13809d3f5 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Address.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Address.php @@ -96,10 +96,10 @@ class Address extends AbstractOrder /** * Update related grid table after object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @param \Magento\Model\AbstractModel|\Magento\Object $object + * @return \Magento\Model\Resource\Db\AbstractDb */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $resource = parent::_afterSave($object); if ($object->hasDataChanges() && $object->getOrder()) { diff --git a/app/code/Magento/Sales/Model/Resource/Order/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Collection.php index 3cfffd5282349cbb52ffc0c3a864dc663b573048..fdd1d301e762f8597e6f01a1ddab3d059318163a 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Collection.php @@ -49,7 +49,7 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec protected $_eventObject = 'order_collection'; /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_coreResourceHelper; @@ -58,18 +58,18 @@ class Collection extends \Magento\Sales\Model\Resource\Collection\AbstractCollec * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Resource\Helper $coreResourceHelper + * @param \Magento\DB\Helper $coreResourceHelper * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Resource\Helper $coreResourceHelper, + \Magento\DB\Helper $coreResourceHelper, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_coreResourceHelper = $coreResourceHelper; diff --git a/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php b/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php index f6ebf20e23b60433616b81d9bf388fcd32dcb4b8..2da874e2bed96333c1e7b2a25a043ccca084f2ee 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Comment/Collection/AbstractCollection.php @@ -37,12 +37,12 @@ abstract class AbstractCollection extends \Magento\Sales\Model\Resource\Collecti /** * Set filter on comments by their parent item * - * @param \Magento\Core\Model\AbstractModel|int $parent + * @param \Magento\Model\AbstractModel|int $parent * @return $this */ public function setParentFilter($parent) { - if ($parent instanceof \Magento\Core\Model\AbstractModel) { + if ($parent instanceof \Magento\Model\AbstractModel) { $parent = $parent->getId(); } return $this->addFieldToFilter('parent_id', $parent); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php index 85c9d890139213a3724418e03ff2ff220412ecfa..88aabc7198182905fa277fc75730016ba7761f08 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Collection.php @@ -56,7 +56,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Payment\Method\Converter $converter * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -65,7 +65,7 @@ class Collection extends \Magento\Sales\Model\Resource\Order\Collection\Abstract \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Payment\Method\Converter $converter, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_converter = $converter; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php index eed4b27bf03328b9d4949241f9690c4dc4f3591e..6b8b37a381aae7106ffafbcd81a7ca5fc06788d9 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Payment/Transaction.php @@ -149,9 +149,9 @@ class Transaction extends \Magento\Sales\Model\Resource\Order\AbstractOrder * * @param \Magento\Sales\Model\Order\Payment\Transaction $transaction * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $transaction) + protected function _beforeSave(\Magento\Model\AbstractModel $transaction) { $parentTxnId = $transaction->getData('parent_txn_id'); $txnId = $transaction->getData('txn_id'); @@ -161,7 +161,7 @@ class Transaction extends \Magento\Sales\Model\Resource\Order\AbstractOrder if ($parentTxnId) { if (!$txnId || !$orderId || !$paymentId) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We don\'t have enough information to save the parent transaction ID.') ); } diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status.php b/app/code/Magento/Sales/Model/Resource/Order/Status.php index ed588e9e6457eb096cd42b832163465360f40821..6d91bcbc42576d7b7c1b74a06d21178621bd9bc2 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status.php @@ -25,7 +25,7 @@ */ namespace Magento\Sales\Model\Resource\Order; -use Magento\Core\Exception; +use Magento\Model\Exception; /** * Order status resource model @@ -34,7 +34,7 @@ use Magento\Core\Exception; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Status extends \Magento\Core\Model\Resource\Db\AbstractDb +class Status extends \Magento\Model\Resource\Db\AbstractDb { /** * Status labels table @@ -68,7 +68,7 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) @@ -98,10 +98,10 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Store labels getter * - * @param \Magento\Core\Model\AbstractModel $status + * @param \Magento\Model\AbstractModel $status * @return array */ - public function getStoreLabels(\Magento\Core\Model\AbstractModel $status) + public function getStoreLabels(\Magento\Model\AbstractModel $status) { $select = $this->_getWriteAdapter()->select()->from( $this->_labelsTable, @@ -116,10 +116,10 @@ class Status extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save status labels per store * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { if ($object->hasStoreLabels()) { $labels = $object->getStoreLabels(); diff --git a/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php index 3281a01646509ee4baabf96933449f3b9a176358..7dfdb45f4650516c29d181b04d3709ed1294ec84 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Status/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order\Status; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Internal constructor diff --git a/app/code/Magento/Sales/Model/Resource/Order/Tax.php b/app/code/Magento/Sales/Model/Resource/Order/Tax.php index 2621bdc0042c8b76957676c293321c220b8c8a90..5dfb38988786589cd55f6d55b2e3088a9af1829b 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Tax.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * Model initialization diff --git a/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php b/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php index 0ec4a83d374a617a59c3724eb1b7ab1220048584..a0b8b62b2d06ba8ab67e8c169d7daf9acb366e55 100644 --- a/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Order/Tax/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Order\Tax; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Model initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote.php b/app/code/Magento/Sales/Model/Resource/Quote.php index 86315534a03fad213dd17b13b9900df4ad029fc9..f91148fa76fcab5ab3d78d56faf5ac13d49b68e7 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote.php +++ b/app/code/Magento/Sales/Model/Resource/Quote.php @@ -64,7 +64,7 @@ class Quote extends AbstractResource * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php index c8ac0bec8a40fffa5ae10dc69d6342a1c9197e81..ab6add06a2cf793d9e87b8523d7c0b533ffa63e7 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Event prefix diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php index 5a2b2865b1c927106d0837778a64b4d270efc44f..97c29adde616b49a93ae27a229041d5cfb13be37 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php index 33bcf0b1b407e3105b6dfcf4bb1602525da74f8c..0c443ff57f9efc1e49495e4427cbab94d892d52c 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Address/Rate/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Address\Rate; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Whether to load fixed items only @@ -48,7 +48,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -57,7 +57,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Quote\Address\CarrierFactoryInterface $carrierFactory, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_carrierFactory = $carrierFactory; diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Collection.php index 1dd818e1f4f5d2b271e4e080f9fe857b37013d57..6dbf74fda590e386068553039a6fa404c67a9fa2 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php index 4dc759dd3997d9fcc6142088346110e2a46c1ff2..c1104e0d42d3e6b6aa344ccf74efc38867e9d2ff 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource\Quote\Item; /** * Quote item resource collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection quote instance @@ -68,7 +68,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param \Magento\Sales\Model\Quote\Config $quoteConfig * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -79,7 +79,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, \Magento\Sales\Model\Quote\Config $quoteConfig, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_itemOptionCollectionFactory = $itemOptionCollectionFactory; diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php index 0c86a58a15a8b573d92052fb7c66662b864be0a8..16bf507e9ec14e5b3b3427a3753676466c574a40 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource\Quote\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * Main table and field initialization diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php index fec5db123f8eaffb0385ffbf7f0fc6e64b830080..12317cf9273ec7daad891307c6f13caa60437b4b 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Item/Option/Collection.php @@ -34,7 +34,7 @@ use Magento\Sales\Model\Quote\Item; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Array of option ids grouped by item id diff --git a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php index a263d08cade01a78e2b7d363d6f38c2effd3d4b1..d51b24729236f16ec45aa5924c07dc125ba9e9a5 100644 --- a/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php +++ b/app/code/Magento/Sales/Model/Resource/Quote/Payment/Collection.php @@ -28,7 +28,7 @@ namespace Magento\Sales\Model\Resource\Quote\Payment; /** * Quote payments collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Sales\Model\Payment\Method\Converter @@ -42,7 +42,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Sales\Model\Payment\Method\Converter $converter * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -51,7 +51,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Sales\Model\Payment\Method\Converter $converter, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_converter = $converter; diff --git a/app/code/Magento/Sales/Model/Resource/Report.php b/app/code/Magento/Sales/Model/Resource/Report.php index bffc8c5a144f536a29d265f1fee28404e0044087..b2161eae0d3f253136d5cd413926451d0fd1ca99 100644 --- a/app/code/Magento/Sales/Model/Resource/Report.php +++ b/app/code/Magento/Sales/Model/Resource/Report.php @@ -32,7 +32,7 @@ namespace Magento\Sales\Model\Resource; * @package Magento_Sales * @author Magento Core Team <core@magentocommerce.com> */ -class Report extends \Magento\Core\Model\Resource\Db\AbstractDb +class Report extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Sales/Model/Service/Quote.php b/app/code/Magento/Sales/Model/Service/Quote.php index 88fa030eaa6fe59e84b9893e515c58d286fd0eb8..fd453a22aab814bf7cc429b78935cea7ea38bb85 100755 --- a/app/code/Magento/Sales/Model/Service/Quote.php +++ b/app/code/Magento/Sales/Model/Service/Quote.php @@ -82,7 +82,7 @@ class Quote protected $_customerSession; /** - * @var \Magento\Core\Model\Resource\TransactionFactory + * @var \Magento\DB\TransactionFactory */ protected $_transactionFactory; @@ -118,7 +118,7 @@ class Quote * @param \Magento\Sales\Model\Quote $quote * @param \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Core\Model\Resource\TransactionFactory $transactionFactory + * @param \Magento\DB\TransactionFactory $transactionFactory * @param CustomerAccountServiceInterface $customerAccountService * @param CustomerAddressServiceInterface $customerAddressService * @param AddressBuilder $customerAddressBuilder @@ -130,7 +130,7 @@ class Quote \Magento\Sales\Model\Quote $quote, \Magento\Sales\Model\Convert\QuoteFactory $convertQuoteFactory, \Magento\Customer\Model\Session $customerSession, - \Magento\Core\Model\Resource\TransactionFactory $transactionFactory, + \Magento\DB\TransactionFactory $transactionFactory, CustomerAccountServiceInterface $customerAccountService, CustomerAddressServiceInterface $customerAddressService, AddressBuilder $customerAddressBuilder, @@ -410,10 +410,6 @@ class Quote ); throw $e; } - $this->_eventManager->dispatch( - 'sales_model_service_quote_submit_after', - array('order' => $order, 'quote' => $quote) - ); $this->_order = $order; return $order; } @@ -516,7 +512,7 @@ class Quote * Validate quote data before converting to order * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validate() { @@ -524,26 +520,26 @@ class Quote $address = $this->getQuote()->getShippingAddress(); $addressValidation = $address->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please check the shipping address information. %1', implode(' ', $addressValidation)) ); } $method = $address->getShippingMethod(); $rate = $address->getShippingRateByCode($method); if (!$this->getQuote()->isVirtual() && (!$method || !$rate)) { - throw new \Magento\Core\Exception(__('Please specify a shipping method.')); + throw new \Magento\Model\Exception(__('Please specify a shipping method.')); } } $addressValidation = $this->getQuote()->getBillingAddress()->validate(); if ($addressValidation !== true) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please check the billing address information. %1', implode(' ', $addressValidation)) ); } if (!$this->getQuote()->getPayment()->getMethod()) { - throw new \Magento\Core\Exception(__('Please select a valid payment method.')); + throw new \Magento\Model\Exception(__('Please select a valid payment method.')); } return $this; diff --git a/app/code/Magento/Sales/etc/di.xml b/app/code/Magento/Sales/etc/di.xml index c0c1b5e76afe497b509764a85330e841b8a97f96..e6599110d75376c674a698744a212367a7080209 100644 --- a/app/code/Magento/Sales/etc/di.xml +++ b/app/code/Magento/Sales/etc/di.xml @@ -69,4 +69,14 @@ </argument> </arguments> </type> + <type name="Magento\Model\ActionValidator\RemoveAction"> + <arguments> + <argument name="protectedModels" xsi:type="array"> + <item name="salesOrder" xsi:type="string">Magento\Sales\Model\Order</item> + <item name="salesOrderCreditmemo" xsi:type="string">Magento\Sales\Model\Order\Creditmemo</item> + <item name="salesOrderInvoice" xsi:type="string">Magento\Sales\Model\Order\Invoice</item> + <item name="salesOrderShipment" xsi:type="string">Magento\Sales\Model\Order\Shipment</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php index 9c83226309c568e46075c42df1100ff7dcd71036..6e9b76239cd407b33b4b4412d9520243e7fb7f81 100644 --- a/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php +++ b/app/code/Magento/SalesRule/Controller/Adminhtml/Promo/Quote.php @@ -186,7 +186,7 @@ class Quote extends \Magento\Backend\App\Action if ($id) { $model->load($id); if ($id != $model->getId()) { - throw new \Magento\Core\Exception(__('The wrong rule is specified.')); + throw new \Magento\Model\Exception(__('The wrong rule is specified.')); } } @@ -233,7 +233,7 @@ class Quote extends \Magento\Backend\App\Action } $this->_redirect('sales_rule/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $id = (int)$this->getRequest()->getParam('rule_id'); if (!empty($id)) { @@ -271,7 +271,7 @@ class Quote extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The rule has been deleted.')); $this->_redirect('sales_rule/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError( @@ -492,7 +492,7 @@ class Quote extends \Magento\Backend\App\Action $this->_view->getLayout()->initMessages(); $result['messages'] = $this->_view->getLayout()->getMessagesBlock()->getGroupedHtml(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result['error'] = $e->getMessage(); } catch (\Exception $e) { $result['error'] = __( diff --git a/app/code/Magento/SalesRule/Model/Coupon.php b/app/code/Magento/SalesRule/Model/Coupon.php index 23cf86b4a1296c400c432de19e7dc6aefadd9233..5f89e4d5c902892b76208c80ff1bfcc3247c5da3 100644 --- a/app/code/Magento/SalesRule/Model/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Coupon.php @@ -47,7 +47,7 @@ namespace Magento\SalesRule\Model; * @method int getType() * @method \Magento\SalesRule\Model\Coupon setType(int $value) */ -class Coupon extends \Magento\Core\Model\AbstractModel +class Coupon extends \Magento\Model\AbstractModel { /** * Coupon's owner rule instance diff --git a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php index 23273b387bc414b501bc8cf27a63d41f87910f34..001f9d6ba9c3c62778034ad49b8eceba5ae1ddd9 100644 --- a/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php +++ b/app/code/Magento/SalesRule/Model/Coupon/Massgenerator.php @@ -34,7 +34,7 @@ namespace Magento\SalesRule\Model\Coupon; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Massgenerator extends \Magento\Core\Model\AbstractModel implements +class Massgenerator extends \Magento\Model\AbstractModel implements \Magento\SalesRule\Model\Coupon\CodegeneratorInterface { /** @@ -79,7 +79,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements * @param \Magento\SalesRule\Model\CouponFactory $couponFactory * @param \Magento\Stdlib\DateTime\DateTime $date * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -90,7 +90,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\Stdlib\DateTime\DateTime $date, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -161,7 +161,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements /** * Generate Coupons Pool * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function generatePool() @@ -195,7 +195,7 @@ class Massgenerator extends \Magento\Core\Model\AbstractModel implements $attempt = 0; do { if ($attempt >= $maxAttempts) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('We cannot create the requested Coupon Qty. Please check your settings and try again.') ); } diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon.php b/app/code/Magento/SalesRule/Model/Resource/Coupon.php index e41c343bdeb398eeaecac031792a0700be41dbfa..9bbf7e3559f2c6fab20b8fbae0140a9dec8d11d4 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * SalesRule Resource Coupon @@ -34,7 +34,7 @@ use Magento\Core\Model\AbstractModel; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Coupon extends \Magento\Core\Model\Resource\Db\AbstractDb +class Coupon extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor adds unique fields diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php index 866b2b5395be8759f19109325ab059c3ea998601..0a7c5125bda1a07df73df34392be7d58aa406af3 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Collection.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource\Coupon; -use Magento\Core\Model\Resource\Db\Collection\AbstractCollection; +use Magento\Model\Resource\Db\Collection\AbstractCollection; use Magento\Backend\Block\Widget\Grid\Column; use Magento\SalesRule\Model\Rule; diff --git a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php index dabbf0a0fcf41331543e2a277e4fc457a935504e..18f8dc6cc57bac4a29f3ad225176eb6fa50ba734 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php +++ b/app/code/Magento/SalesRule/Model/Resource/Coupon/Usage.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Coupon; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Usage extends \Magento\Core\Model\Resource\Db\AbstractDb +class Usage extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor @@ -104,7 +104,7 @@ class Usage extends \Magento\Core\Model\Resource\Db\AbstractDb $object->setData($data); } } - if ($object instanceof \Magento\Core\Model\AbstractModel) { + if ($object instanceof \Magento\Model\AbstractModel) { $this->_afterLoad($object); } return $this; diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule.php b/app/code/Magento/SalesRule/Model/Resource/Rule.php index 852115887b80a5a4378f1c80376b6b9f6be509d5..c864da287b325a329582b76c9b9b9becb8816568 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule.php @@ -25,7 +25,7 @@ */ namespace Magento\SalesRule\Model\Resource; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; /** * Sales Rule resource model diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php index 911a75799c22d3f3c8b14b90ef315256df84a0ac..bf38d356c03227eeb6cecfcaa5531c70d3874c74 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Collection.php @@ -64,7 +64,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Stdlib\DateTime\DateTime $date * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -73,7 +73,7 @@ class Collection extends \Magento\Rule\Model\Resource\Rule\Collection\AbstractCo \Magento\Event\ManagerInterface $eventManager, \Magento\Stdlib\DateTime\DateTime $date, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); $this->_date = $date; diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php index 50f387a1ee87bb836e5e64e35afa2b9c49b53272..ee72b972dac2accfb4bef3bb706c7b23918b1292 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Rule; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\Resource\Db\AbstractDb +class Customer extends \Magento\Model\Resource\Db\AbstractDb { /** * Constructor diff --git a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php index b56263f4905ec5a03bc5d0a3745d39373d8fab9d..264ec080061aa1b0b4cf072951a8cbe9f33cd3b2 100644 --- a/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php +++ b/app/code/Magento/SalesRule/Model/Resource/Rule/Customer/Collection.php @@ -32,7 +32,7 @@ namespace Magento\SalesRule\Model\Resource\Rule\Customer; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Collection constructor diff --git a/app/code/Magento/SalesRule/Model/Rule.php b/app/code/Magento/SalesRule/Model/Rule.php index f5124c4aeb09d3bc1f81d42cf9a5db40498cc04c..bc164513f1cc0e85ddfd54fc6222bed396467d53 100644 --- a/app/code/Magento/SalesRule/Model/Rule.php +++ b/app/code/Magento/SalesRule/Model/Rule.php @@ -210,7 +210,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF * @param \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -225,7 +225,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel \Magento\SalesRule\Model\Rule\Condition\Product\CombineFactory $condProdCombineF, \Magento\SalesRule\Model\Resource\Coupon\Collection $couponCollection, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -463,7 +463,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel * @param bool $saveNewlyCreated Whether or not to save newly created coupon * @param int $saveAttemptCount Number of attempts to save newly created coupon * @return \Magento\SalesRule\Model\Coupon|null - * @throws \Exception|\Magento\Core\Exception + * @throws \Exception|\Magento\Model\Exception */ public function acquireCoupon($saveNewlyCreated = true, $saveAttemptCount = 10) { @@ -498,7 +498,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel try { $coupon->save(); } catch (\Exception $e) { - if ($e instanceof \Magento\Core\Exception || $coupon->getId()) { + if ($e instanceof \Magento\Model\Exception || $coupon->getId()) { throw $e; } $coupon->setCode( @@ -511,7 +511,7 @@ class Rule extends \Magento\Rule\Model\AbstractModel } } if (!$ok) { - throw new \Magento\Core\Exception(__('Can\'t acquire coupon.')); + throw new \Magento\Model\Exception(__('Can\'t acquire coupon.')); } return $coupon; diff --git a/app/code/Magento/SalesRule/Model/Rule/Customer.php b/app/code/Magento/SalesRule/Model/Rule/Customer.php index c518d47ec5ec3a74eb4b1bac3904315b4c1bd632..fb9a3b7a48270d2222c179834910aecfde8fd28f 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Customer.php +++ b/app/code/Magento/SalesRule/Model/Rule/Customer.php @@ -41,7 +41,7 @@ namespace Magento\SalesRule\Model\Rule; * @package Magento_SalesRule * @author Magento Core Team <core@magentocommerce.com> */ -class Customer extends \Magento\Core\Model\AbstractModel +class Customer extends \Magento\Model\AbstractModel { /** * Constructor diff --git a/app/code/Magento/SalesRule/Model/Validator.php b/app/code/Magento/SalesRule/Model/Validator.php index 5e3fc61af08f80c08c437183d96bed9f0073898e..8a82a78ec3766da446a635dc5fd94e20b025bf5a 100644 --- a/app/code/Magento/SalesRule/Model/Validator.php +++ b/app/code/Magento/SalesRule/Model/Validator.php @@ -40,7 +40,7 @@ use Magento\Sales\Model\Quote\Address; * @method mixed getCustomerGroupId() * @method \Magento\SalesRule\Model\Validator setCustomerGroupId($id) */ -class Validator extends \Magento\Core\Model\AbstractModel +class Validator extends \Magento\Model\AbstractModel { /** * Rule source collection @@ -129,7 +129,7 @@ class Validator extends \Magento\Core\Model\AbstractModel * @param \Magento\SalesRule\Model\CouponFactory $couponFactory * @param \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory * @param \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -142,7 +142,7 @@ class Validator extends \Magento\Core\Model\AbstractModel \Magento\SalesRule\Model\CouponFactory $couponFactory, \Magento\SalesRule\Model\Rule\CustomerFactory $customerFactory, \Magento\SalesRule\Model\Rule\Action\Discount\CalculatorFactory $calculatorFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -773,12 +773,12 @@ class Validator extends \Magento\Core\Model\AbstractModel /** * @param int $key * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getRuleItemTotalsInfo($key) { if (empty($this->_rulesItemTotals[$key])) { - throw new \Magento\Core\Exception(__('Item totals are not set for the rule.')); + throw new \Magento\Model\Exception(__('Item totals are not set for the rule.')); } return $this->_rulesItemTotals[$key]; diff --git a/app/code/Magento/Sendfriend/Controller/Product.php b/app/code/Magento/Sendfriend/Controller/Product.php index b3f8e653036400d3e80d2be23025f0c22c053774..722509b8813f8bc6e3d3cffd555b5761ab7e58e3 100644 --- a/app/code/Magento/Sendfriend/Controller/Product.php +++ b/app/code/Magento/Sendfriend/Controller/Product.php @@ -240,7 +240,7 @@ class Product extends \Magento\App\Action\Action $this->messageManager->addError(__('We found some problems with the data.')); } } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Some emails were not sent.')); diff --git a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php index 1d4eb4028e877a46027423cbf594005defbc5fb4..5c470a58e6d08d60ffeda73867db04354cd96754 100644 --- a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend.php @@ -32,7 +32,7 @@ namespace Magento\Sendfriend\Model\Resource; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Sendfriend extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sendfriend extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and table diff --git a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php index 23b1bae0a5ee331d862201bf987ac3f5f8da95b4..91f3ae54fbe2c4659370b7d2cd223b26c1206c18 100644 --- a/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php +++ b/app/code/Magento/Sendfriend/Model/Resource/Sendfriend/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Sendfriend\Model\Resource\Sendfriend; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init resource collection diff --git a/app/code/Magento/Sendfriend/Model/Sendfriend.php b/app/code/Magento/Sendfriend/Model/Sendfriend.php index d41f8db64d54ea2cd061e0323292c641580d558a..da257a10f5a504c93d078236d100f0fd99ee63e8 100644 --- a/app/code/Magento/Sendfriend/Model/Sendfriend.php +++ b/app/code/Magento/Sendfriend/Model/Sendfriend.php @@ -25,7 +25,7 @@ */ namespace Magento\Sendfriend\Model; -use Magento\Core\Exception as CoreException; +use Magento\Model\Exception as CoreException; /** * SendFriend Log @@ -41,7 +41,7 @@ use Magento\Core\Exception as CoreException; * @package Magento_Sendfriend * @author Magento Core Team <core@magentocommerce.com> */ -class Sendfriend extends \Magento\Core\Model\AbstractModel +class Sendfriend extends \Magento\Model\AbstractModel { /** * Recipient Names @@ -114,16 +114,21 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel */ protected $_escaper; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder - * @param \Magento\TranslateInterface $translate * @param \Magento\Catalog\Helper\Image $catalogImage * @param \Magento\Sendfriend\Helper\Data $sendfriendData * @param \Magento\Escaper $escaper - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -132,20 +137,20 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Mail\Template\TransportBuilder $transportBuilder, - \Magento\TranslateInterface $translate, \Magento\Catalog\Helper\Image $catalogImage, \Magento\Sendfriend\Helper\Data $sendfriendData, \Magento\Escaper $escaper, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Translate\Inline\StateInterface $inlineTranslation, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; - $this->_translate = $translate; $this->_catalogImage = $catalogImage; $this->_sendfriendData = $sendfriendData; $this->_escaper = $escaper; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $registry, $resource, $resourceCollection, $data); } @@ -166,13 +171,12 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel public function send() { if ($this->isExceedLimit()) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('You\'ve met your limit of %1 sends in an hour.', $this->getMaxSendsToFriend()) ); } - $translate = $this->_translate->getTranslateInline(); - $this->_translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); $message = nl2br(htmlspecialchars($this->getSender()->getMessage())); $sender = array( @@ -209,7 +213,9 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); } - $this->_translate->setTranslateInline($translate); + + $this->inlineTranslation->resume(); + $this->_incrementSentCount(); return $this; @@ -277,14 +283,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Cookie instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Stdlib\Cookie */ public function getCookie() { $cookie = $this->_getData('_cookie'); if (!$cookie instanceof \Magento\Stdlib\Cookie) { - throw new \Magento\Core\Exception(__('Please define a correct Cookie instance.')); + throw new \Magento\Model\Exception(__('Please define a correct Cookie instance.')); } return $cookie; } @@ -402,14 +408,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Product instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Catalog\Model\Product */ public function getProduct() { $product = $this->_getData('_product'); if (!$product instanceof \Magento\Catalog\Model\Product) { - throw new \Magento\Core\Exception(__('Please define a correct Product instance.')); + throw new \Magento\Model\Exception(__('Please define a correct Product instance.')); } return $product; } @@ -432,14 +438,14 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel /** * Retrieve Sender Information Object * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Object */ public function getSender() { $sender = $this->_getData('_sender'); if (!$sender instanceof \Magento\Object) { - throw new \Magento\Core\Exception(__('Please define the correct Sender information.')); + throw new \Magento\Model\Exception(__('Please define the correct Sender information.')); } return $sender; } @@ -590,8 +596,8 @@ class Sendfriend extends \Magento\Core\Model\AbstractModel */ public function register() { - if (!$this->_coreRegistry->registry('send_to_friend_model')) { - $this->_coreRegistry->register('send_to_friend_model', $this); + if (!$this->_registry->registry('send_to_friend_model')) { + $this->_registry->register('send_to_friend_model', $this); } return $this; } diff --git a/app/code/Magento/Service/Exception.php b/app/code/Magento/Service/Exception.php index 3fc43d9f3404175c3d7b21b1660317db6b030e0d..9173ba42eac47c7a81f88b9781e087b11152906a 100644 --- a/app/code/Magento/Service/Exception.php +++ b/app/code/Magento/Service/Exception.php @@ -25,7 +25,7 @@ */ namespace Magento\Service; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { /** @var array */ protected $_parameters; diff --git a/app/code/Magento/Service/etc/module.xml b/app/code/Magento/Service/etc/module.xml index 128941add1d609311cd6fb4b5cb1d409bc7b8678..38cd40bff9e57e44907022d58309d9231bb33c33 100644 --- a/app/code/Magento/Service/etc/module.xml +++ b/app/code/Magento/Service/etc/module.xml @@ -24,12 +24,5 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> - <module name="Magento_Service" version="1.0.0.0" active="true"> - <sequence> - <module name="Magento_Core"/> - </sequence> - <depends> - <module name="Magento_Core"/> - </depends> - </module> + <module name="Magento_Service" version="1.0.0.0" active="true" /> </config> diff --git a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php index 28e4d7ad1d9d9b4c0c9b70a347c6002dd8ec66d2..674845c9ff85697a6bb88b680c63292590e93a82 100644 --- a/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php +++ b/app/code/Magento/Shipping/Controller/Adminhtml/Order/Shipment.php @@ -88,7 +88,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip /** * Initialize shipment model instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Sales\Model\Order\Shipment|bool */ protected function _initShipment() @@ -136,7 +136,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip if ($tracks) { foreach ($tracks as $data) { if (empty($data['number'])) { - throw new \Magento\Core\Exception(__('Please enter a tracking number.')); + throw new \Magento\Model\Exception(__('Please enter a tracking number.')); } $track = $this->_objectManager->create('Magento\Sales\Model\Order\Shipment\Track')->addData($data); $shipment->addTrack($track); @@ -158,7 +158,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip { $shipment->getOrder()->setIsInProcess(true); $transactionSave = $this->_objectManager->create( - 'Magento\Core\Model\Resource\Transaction' + 'Magento\DB\Transaction' )->addObject( $shipment )->addObject( @@ -284,7 +284,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $isNeedCreateLabel ? $shipmentCreatedMessage . ' ' . $labelCreatedMessage : $shipmentCreatedMessage ); $this->_objectManager->get('Magento\Backend\Model\Session')->getCommentText(true); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($isNeedCreateLabel) { $responseAjax->setError(true); $responseAjax->setMessage($e->getMessage()); @@ -332,7 +332,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip } $this->messageManager->addSuccess(__('You sent the shipment.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Cannot send shipment information.')); @@ -344,7 +344,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Add new tracking number action * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addTrackAction() { @@ -353,10 +353,10 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $number = $this->getRequest()->getPost('number'); $title = $this->getRequest()->getPost('title'); if (empty($carrier)) { - throw new \Magento\Core\Exception(__('Please specify a carrier.')); + throw new \Magento\Model\Exception(__('Please specify a carrier.')); } if (empty($number)) { - throw new \Magento\Core\Exception(__('Please enter a tracking number.')); + throw new \Magento\Model\Exception(__('Please enter a tracking number.')); } $shipment = $this->_initShipment(); if ($shipment) { @@ -379,7 +379,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip 'message' => __('Cannot initialize shipment for adding tracking number.') ); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $response = array('error' => true, 'message' => __('Cannot add tracking number.')); @@ -435,7 +435,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->getRequest()->setParam('shipment_id', $this->getRequest()->getParam('id')); $data = $this->getRequest()->getPost('comment'); if (empty($data['comment'])) { - throw new \Magento\Core\Exception(__("The comment text field cannot be empty.")); + throw new \Magento\Model\Exception(__("The comment text field cannot be empty.")); } $shipment = $this->_initShipment(); $shipment->addComment( @@ -448,7 +448,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->_view->loadLayout(false); $response = $this->_view->getLayout()->getBlock('shipment_comments')->toHtml(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response = array('error' => true, 'message' => $e->getMessage()); $response = $this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($response); } catch (\Exception $e) { @@ -462,7 +462,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip * Create shipping label for specific shipment with validation. * * @param \Magento\Sales\Model\Order\Shipment $shipment - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return bool */ protected function _createShippingLabel(\Magento\Sales\Model\Order\Shipment $shipment) @@ -482,7 +482,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $shipment ); if ($response->hasErrors()) { - throw new \Magento\Core\Exception($response->getErrors()); + throw new \Magento\Model\Exception($response->getErrors()); } if (!$response->hasInfo()) { return false; @@ -537,7 +537,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip $this->messageManager->addSuccess(__('You created the shipping label.')); $response->setOk(true); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $response->setError(true); $response->setMessage($e->getMessage()); } catch (\Exception $e) { @@ -585,7 +585,7 @@ class Shipment extends \Magento\Sales\Controller\Adminhtml\Shipment\AbstractShip 'application/pdf' ); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->_objectManager->get('Magento\Logger')->logException($e); diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php index 4b05ad7bd5a9f175ebbb83b811f937625e75c9d7..0917ea8b89095fc99f7a6a580fdda7adc0ae4e62 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrier.php @@ -275,7 +275,7 @@ abstract class AbstractCarrier extends \Magento\Object implements AbstractCarrie /** * @param \Magento\Sales\Model\Quote\Address\RateRequest $request - * @return $this|bool|false|\Magento\Core\Model\AbstractModel + * @return $this|bool|false|\Magento\Model\AbstractModel */ public function checkAvailableShipCountries(\Magento\Sales\Model\Quote\Address\RateRequest $request) { diff --git a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php index ba94ee15e533615ebef340f0b974190a56386fc4..9d9cdd0634cb2c4777ea1cbfea9d8b47c726d9f8 100644 --- a/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php +++ b/app/code/Magento/Shipping/Model/Carrier/AbstractCarrierOnline.php @@ -23,7 +23,7 @@ */ namespace Magento\Shipping\Model\Carrier; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Sales\Model\Quote\Address\RateRequest; use Magento\Sales\Model\Quote\Address\RateResult\Error; use Magento\Shipping\Model\Shipment\Request; diff --git a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php index e02d2e73a810ae12a123ea242cb7d5677d9c4727..37234cbc20696cfe1f161d8bc7dfb2f67787c7f6 100644 --- a/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php +++ b/app/code/Magento/Shipping/Model/Order/Pdf/Packaging.php @@ -53,12 +53,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig - * @param \Magento\TranslateInterface $translate * @param \Magento\App\Filesystem $filesystem * @param \Magento\Sales\Model\Order\Pdf\Config $pdfConfig * @param \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory * @param \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\Shipping\Helper\Carrier $carrierHelper * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\View\LayoutInterface $layout @@ -71,12 +71,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf \Magento\Payment\Helper\Data $paymentData, \Magento\Stdlib\String $string, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, - \Magento\TranslateInterface $translate, \Magento\App\Filesystem $filesystem, \Magento\Sales\Model\Order\Pdf\Config $pdfConfig, \Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory, \Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, Carrier $carrierHelper, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, @@ -92,12 +92,12 @@ class Packaging extends \Magento\Sales\Model\Order\Pdf\AbstractPdf $paymentData, $string, $coreStoreConfig, - $translate, $filesystem, $pdfConfig, $pdfTotalFactory, $pdfItemsFactory, $localeDate, + $inlineTranslation, $data ); } diff --git a/app/code/Magento/Shipping/Model/Order/Track.php b/app/code/Magento/Shipping/Model/Order/Track.php index 158d3c6c2a0e9b1faddc62acb7a6a197df0e3acb..3ae690d75a9db8b88bdab8440fd39aac8462c1b2 100644 --- a/app/code/Magento/Shipping/Model/Order/Track.php +++ b/app/code/Magento/Shipping/Model/Order/Track.php @@ -62,7 +62,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory * @param \Magento\Shipping\Model\CarrierFactory $carrierFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data * @@ -76,7 +76,7 @@ class Track extends \Magento\Sales\Model\Order\Shipment\Track \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Order\ShipmentFactory $shipmentFactory, \Magento\Shipping\Model\CarrierFactory $carrierFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 2daf195de20360ab5cb677eb0598175b15f61ba8..a3d2e77ca165f0de06f85ae4f9a17bcf8bac6958 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -85,7 +85,7 @@ class Labels extends \Magento\Shipping\Model\Shipping * * @param Shipment $orderShipment * @return \Magento\Object - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function requestToShipment(Shipment $orderShipment) { @@ -97,7 +97,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $shipmentCarrier = $this->_carrierFactory->create($order->getShippingMethod(true)->getCarrierCode()); $baseCurrencyCode = $this->_storeManager->getStore($shipmentStoreId)->getBaseCurrencyCode(); if (!$shipmentCarrier) { - throw new \Magento\Core\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); + throw new \Magento\Model\Exception('Invalid carrier: ' . $shippingMethod->getCarrierCode()); } $shipperRegionCode = $this->_coreStoreConfig->getConfig(Shipment::XML_PATH_STORE_REGION_ID, $shipmentStoreId); if (is_numeric($shipperRegionCode)) { @@ -129,7 +129,7 @@ class Labels extends \Magento\Shipping\Model\Shipping $shipmentStoreId ) ) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'We don\'t have enough information to create shipping labels. Please make sure your store information and settings are complete.' ) diff --git a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php index 698b03a3f57257ac08e6b7bc28bdfa760524d0cf..5c1c4b9f560e79277b1b3134533ed0d4215e0f1a 100644 --- a/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php +++ b/app/code/Magento/Sitemap/Controller/Adminhtml/Sitemap.php @@ -301,7 +301,7 @@ class Sitemap extends \Magento\Backend\App\Action $this->messageManager->addSuccess( __('The sitemap "%1" has been generated.', $sitemap->getSitemapFilename()) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('Something went wrong generating the sitemap.')); diff --git a/app/code/Magento/Sitemap/Model/Observer.php b/app/code/Magento/Sitemap/Model/Observer.php index 368300de98e21864e75bbd57d8a428210ce1dce3..ee0a80569fe1ec480748e7b2761f940a90110cb7 100644 --- a/app/code/Magento/Sitemap/Model/Observer.php +++ b/app/code/Magento/Sitemap/Model/Observer.php @@ -75,34 +75,34 @@ class Observer protected $_transportBuilder; /** - * @var \Magento\TranslateInterface + * @var \Magento\Core\Model\StoreManagerInterface */ - protected $_translateModel; + protected $_storeManager; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\Translate\Inline\StateInterface */ - protected $_storeManager; + protected $inlineTranslation; /** * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param Resource\Sitemap\CollectionFactory $collectionFactory - * @param \Magento\TranslateInterface $translateModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Sitemap\Model\Resource\Sitemap\CollectionFactory $collectionFactory, - \Magento\TranslateInterface $translateModel, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_collectionFactory = $collectionFactory; - $this->_translateModel = $translateModel; $this->_storeManager = $storeManager; $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; } /** @@ -133,8 +133,7 @@ class Observer } if ($errors && $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_RECIPIENT)) { - $translate = $this->_translateModel->getTranslateInline(); - $this->_translateModel->setTranslateInline(false); + $this->inlineTranslation->suspend(); $this->_transportBuilder->setTemplateIdentifier( $this->_coreStoreConfig->getConfig(self::XML_PATH_ERROR_TEMPLATE) @@ -153,7 +152,7 @@ class Observer $transport = $this->_transportBuilder->getTransport(); $transport->sendMessage(); - $this->_translateModel->setTranslateInline($translate); + $this->inlineTranslation->resume(); } } } diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php index 2ed955eddecf3145373a0efcdf7bb2665a93ddd6..c2abe1e58f99a4646eca83221e2b2f4e027c8d86 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Category.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Catalog; * * @author Magento Core Team <core@magentocommerce.com> */ -class Category extends \Magento\Core\Model\Resource\Db\AbstractDb +class Category extends \Magento\Model\Resource\Db\AbstractDb { /** * Collection Zend Db select diff --git a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php index d93916921a112909739ecf039f79f9e32013d410..14b7f774cf5fa4abdfecc056d7d0b5e86e1cc07e 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php +++ b/app/code/Magento/Sitemap/Model/Resource/Catalog/Product.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Catalog; * * @author Magento Core Team <core@magentocommerce.com> */ -class Product extends \Magento\Core\Model\Resource\Db\AbstractDb +class Product extends \Magento\Model\Resource\Db\AbstractDb { const NOT_SELECTED_IMAGE = 'no_selection'; diff --git a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php index 9bbddafa25e0e89c97fd6a0a9754c22b249c5b0e..d5bd7e03aadd3ee406368e817a48081be4232b65 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php +++ b/app/code/Magento/Sitemap/Model/Resource/Cms/Page.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Cms; * * @author Magento Core Team <core@magentocommerce.com> */ -class Page extends \Magento\Core\Model\Resource\Db\AbstractDb +class Page extends \Magento\Model\Resource\Db\AbstractDb { /** * Init resource model (catalog/category) diff --git a/app/code/Magento/Sitemap/Model/Resource/Sitemap.php b/app/code/Magento/Sitemap/Model/Resource/Sitemap.php index 8ca469b82197f744bb66ed8d3cb72ea69d1b2888..ada1a609e6b20c5e61f1b87194039b9ffc82a7a4 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Resource/Sitemap.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource; * * @author Magento Core Team <core@magentocommerce.com> */ -class Sitemap extends \Magento\Core\Model\Resource\Db\AbstractDb +class Sitemap extends \Magento\Model\Resource\Db\AbstractDb { /** * Init resource model diff --git a/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php b/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php index 1f420341a7836f8a0c1cf859acbe6b5a96621f61..998e10cad9ff82b065bf138827eee8ac5b8fb612 100644 --- a/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php +++ b/app/code/Magento/Sitemap/Model/Resource/Sitemap/Collection.php @@ -30,7 +30,7 @@ namespace Magento\Sitemap\Model\Resource\Sitemap; * * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Init collection diff --git a/app/code/Magento/Sitemap/Model/Sitemap.php b/app/code/Magento/Sitemap/Model/Sitemap.php index 070d1e091d292355c22e98b0199c6e1ea98dfa70..84870f3c64f3521a1755d5c3b73d137c346f242b 100644 --- a/app/code/Magento/Sitemap/Model/Sitemap.php +++ b/app/code/Magento/Sitemap/Model/Sitemap.php @@ -41,7 +41,7 @@ namespace Magento\Sitemap\Model; * @method int getStoreId() * @method \Magento\Sitemap\Model\Sitemap setStoreId(int $value) */ -class Sitemap extends \Magento\Core\Model\AbstractModel +class Sitemap extends \Magento\Model\AbstractModel { const OPEN_TAG_KEY = 'start'; @@ -172,7 +172,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\RequestInterface $request * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -189,7 +189,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\RequestInterface $request, \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -220,14 +220,14 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Get file handler * * @return \Magento\Filesystem\File\WriteInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getStream() { if ($this->_stream) { return $this->_stream; } else { - throw new \Magento\Core\Exception(__('File handler unreachable')); + throw new \Magento\Model\Exception(__('File handler unreachable')); } } @@ -289,8 +289,8 @@ class Sitemap extends \Magento\Core\Model\AbstractModel /** * Check sitemap file location and permissions * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Core\Exception + * @return \Magento\Model\AbstractModel + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -300,13 +300,13 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Check path is allow */ if ($path && preg_match('#\.\.[\\\/]#', $path)) { - throw new \Magento\Core\Exception(__('Please define a correct path.')); + throw new \Magento\Model\Exception(__('Please define a correct path.')); } /** * Check exists and writable path */ if (!$this->_directory->isExist($path)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please create the specified folder "%1" before saving the sitemap.', $this->_escaper->escapeHtml($this->getSitemapPath()) @@ -315,7 +315,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel } if (!$this->_directory->isWritable($path)) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('Please make sure that "%1" is writable by the web-server.', $this->getSitemapPath()) ); } @@ -323,7 +323,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * Check allow filename */ if (!preg_match('#^[a-zA-Z0-9_\.]+$#', $this->getSitemapFilename())) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in the filename. No spaces or other characters are allowed.' ) @@ -523,7 +523,7 @@ class Sitemap extends \Magento\Core\Model\AbstractModel * @param null|string $fileName * @param string $type * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _createSitemap($fileName = null, $type = self::TYPE_URL) { diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php index 0243046c5d2cddcad47a7fefacea0b3a2ce18f5c..c44192a20cbd10f5fda4254fe6bcf6c926fd8047 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rate.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rate.php @@ -132,7 +132,7 @@ class Rate extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The tax rate has been saved.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($ratePost); $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -166,7 +166,7 @@ class Rate extends \Magento\Backend\App\Action 'code' => $rate->getCode() ) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -275,7 +275,7 @@ class Rate extends \Magento\Backend\App\Action $this->messageManager->addSuccess(__('The tax rate has been deleted.')); $this->getResponse()->setRedirect($this->getUrl("*/*/")); return true; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong deleting this rate.')); @@ -312,7 +312,7 @@ class Rate extends \Magento\Backend\App\Action )->jsonEncode( array('success' => true, 'error_message' => '') ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -408,7 +408,7 @@ class Rate extends \Magento\Backend\App\Action $importHandler->importFromCsvFile($this->getRequest()->getFiles('import_rates_file')); $this->messageManager->addSuccess(__('The tax rate has been imported.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Invalid file upload attempt')); diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php index daab190806e432cdf907dc6829c341c84cb35f36..1d39bb8b3f90c345e4b657fe857e0b6ec015b1ad 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Rule.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Rule.php @@ -132,7 +132,7 @@ class Rule extends \Magento\Backend\App\Action $this->_redirect('tax/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong saving this tax rule.')); @@ -165,7 +165,7 @@ class Rule extends \Magento\Backend\App\Action $this->_redirect('tax/*/'); return; - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('Something went wrong deleting this tax rule.')); diff --git a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php index aff2295fb2e5dda36c5045ea443efab4aa52959e..59a670231ee7b791e8c35075975b71434c3a7cc7 100644 --- a/app/code/Magento/Tax/Controller/Adminhtml/Tax.php +++ b/app/code/Magento/Tax/Controller/Adminhtml/Tax.php @@ -60,7 +60,7 @@ class Tax extends \Magento\Backend\App\Action 'class_name' => $class->getClassName() ) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -99,7 +99,7 @@ class Tax extends \Magento\Backend\App\Action )->jsonEncode( array('success' => true, 'error_message' => '') ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $responseContent = $this->_objectManager->get( 'Magento\Core\Helper\Data' )->jsonEncode( @@ -120,7 +120,7 @@ class Tax extends \Magento\Backend\App\Action * * @param string $classType * @return string processed class type - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processClassType($classType) { @@ -129,7 +129,7 @@ class Tax extends \Magento\Backend\App\Action \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_PRODUCT ); if (!in_array($classType, $validClassTypes)) { - throw new \Magento\Core\Exception(__('Invalid type of tax class specified.')); + throw new \Magento\Model\Exception(__('Invalid type of tax class specified.')); } return $classType; } @@ -139,13 +139,13 @@ class Tax extends \Magento\Backend\App\Action * * @param string $className * @return string processed class name - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _processClassName($className) { $className = trim($this->_objectManager->get('Magento\Escaper')->escapeHtml($className)); if ($className == '') { - throw new \Magento\Core\Exception(__('Invalid name of tax class specified.')); + throw new \Magento\Model\Exception(__('Invalid name of tax class specified.')); } return $className; } diff --git a/app/code/Magento/Tax/Exception.php b/app/code/Magento/Tax/Exception.php index 7a464a47c2378b07d9a6ec7a9d63da89f1fb95e0..a952e07d0804b8778f24ee017c103439e304bc54 100644 --- a/app/code/Magento/Tax/Exception.php +++ b/app/code/Magento/Tax/Exception.php @@ -25,6 +25,6 @@ */ namespace Magento\Tax; -class Exception extends \Magento\Core\Exception +class Exception extends \Magento\Model\Exception { } diff --git a/app/code/Magento/Tax/Model/Calculation.php b/app/code/Magento/Tax/Model/Calculation.php index 15a3fd5ba42a288d2e7821618a003785427a479c..81df6986bf783109d07c1f39384c100c2afa8783 100644 --- a/app/code/Magento/Tax/Model/Calculation.php +++ b/app/code/Magento/Tax/Model/Calculation.php @@ -34,7 +34,7 @@ use Magento\Exception\NoSuchEntityException; /** * Tax Calculation Model */ -class Calculation extends \Magento\Core\Model\AbstractModel +class Calculation extends \Magento\Model\AbstractModel { const CALC_TAX_BEFORE_DISCOUNT_ON_EXCL = '0_0'; diff --git a/app/code/Magento/Tax/Model/Calculation/Rate.php b/app/code/Magento/Tax/Model/Calculation/Rate.php index b499ec2c18263ed377b6cc782c179ad59f5a7499..ca25ab6f9837c2f8c4de42ff90989bcef83a1780 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate.php @@ -48,7 +48,7 @@ */ namespace Magento\Tax\Model\Calculation; -class Rate extends \Magento\Core\Model\AbstractModel +class Rate extends \Magento\Model\AbstractModel { /** * @var mixed @@ -75,7 +75,7 @@ class Rate extends \Magento\Core\Model\AbstractModel * @param \Magento\Registry $registry * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -84,7 +84,7 @@ class Rate extends \Magento\Core\Model\AbstractModel \Magento\Registry $registry, \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Tax\Model\Calculation\Rate\TitleFactory $taxTitleFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -107,7 +107,7 @@ class Rate extends \Magento\Core\Model\AbstractModel * Prepare location settings and tax postcode before save rate * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeSave() { @@ -119,11 +119,11 @@ class Rate extends \Magento\Core\Model\AbstractModel $this->getTaxPostcode() === ''; if ($isEmptyValues || $isWrongRange) { - throw new \Magento\Core\Exception(__('Please fill all required fields with valid information.')); + throw new \Magento\Model\Exception(__('Please fill all required fields with valid information.')); } if (!is_numeric($this->getRate()) || $this->getRate() <= 0) { - throw new \Magento\Core\Exception(__('Rate Percent should be a positive number.')); + throw new \Magento\Model\Exception(__('Rate Percent should be a positive number.')); } if ($this->getZipIsRange()) { @@ -131,15 +131,15 @@ class Rate extends \Magento\Core\Model\AbstractModel $zipTo = $this->getZipTo(); if (strlen($zipFrom) > 9 || strlen($zipTo) > 9) { - throw new \Magento\Core\Exception(__('Maximum zip code length is 9.')); + throw new \Magento\Model\Exception(__('Maximum zip code length is 9.')); } if (!is_numeric($zipFrom) || !is_numeric($zipTo) || $zipFrom < 0 || $zipTo < 0) { - throw new \Magento\Core\Exception(__('Zip code should not contain characters other than digits.')); + throw new \Magento\Model\Exception(__('Zip code should not contain characters other than digits.')); } if ($zipFrom > $zipTo) { - throw new \Magento\Core\Exception(__('Range To should be equal or greater than Range From.')); + throw new \Magento\Model\Exception(__('Range To should be equal or greater than Range From.')); } $this->setTaxPostcode($zipFrom . '-' . $zipTo); @@ -181,12 +181,12 @@ class Rate extends \Magento\Core\Model\AbstractModel * Processing object before delete data * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _beforeDelete() { if ($this->_isInRule()) { - throw new \Magento\Core\Exception(__('The tax rate cannot be removed. It exists in a tax rule.')); + throw new \Magento\Model\Exception(__('The tax rate cannot be removed. It exists in a tax rule.')); } return parent::_beforeDelete(); } diff --git a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php index 92e3274cd4ba6bd6393ccac5a65c7a3dbaa8b7ee..c40924e23ba1ea03f1562abe1298557eb61a96ee 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rate/Title.php +++ b/app/code/Magento/Tax/Model/Calculation/Rate/Title.php @@ -43,7 +43,7 @@ */ namespace Magento\Tax\Model\Calculation\Rate; -class Title extends \Magento\Core\Model\AbstractModel +class Title extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Tax/Model/Calculation/Rule.php b/app/code/Magento/Tax/Model/Calculation/Rule.php index 82c9f670f67a3a88989c9d9629a3b2901ae81b12..eb198bd8829f300fc4571d4a544218d98d3cef4b 100644 --- a/app/code/Magento/Tax/Model/Calculation/Rule.php +++ b/app/code/Magento/Tax/Model/Calculation/Rule.php @@ -38,7 +38,7 @@ */ namespace Magento\Tax\Model\Calculation; -class Rule extends \Magento\Core\Model\AbstractModel +class Rule extends \Magento\Model\AbstractModel { /** * @var mixed @@ -102,7 +102,7 @@ class Rule extends \Magento\Core\Model\AbstractModel * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\ClassModel $taxClass * @param \Magento\Tax\Model\Calculation $calculation - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -112,7 +112,7 @@ class Rule extends \Magento\Core\Model\AbstractModel \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\ClassModel $taxClass, \Magento\Tax\Model\Calculation $calculation, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { diff --git a/app/code/Magento/Tax/Model/ClassModel.php b/app/code/Magento/Tax/Model/ClassModel.php index 747a906ba2ae085d8da1e692ad093aa2c9dcb6f9..f07cdec6488b5a716e3fccf4f06319b272e13538 100644 --- a/app/code/Magento/Tax/Model/ClassModel.php +++ b/app/code/Magento/Tax/Model/ClassModel.php @@ -40,7 +40,7 @@ */ namespace Magento\Tax\Model; -class ClassModel extends \Magento\Core\Model\AbstractModel +class ClassModel extends \Magento\Model\AbstractModel { /** * Defines Customer Tax Class string @@ -61,7 +61,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel * @param \Magento\Model\Context $context * @param \Magento\Registry $registry * @param \Magento\Tax\Model\TaxClass\Factory $classFactory - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -69,7 +69,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel \Magento\Model\Context $context, \Magento\Registry $registry, \Magento\Tax\Model\TaxClass\Factory $classFactory, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -89,18 +89,18 @@ class ClassModel extends \Magento\Core\Model\AbstractModel * Check whether this class can be deleted * * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function checkClassCanBeDeleted() { if (!$this->getId()) { - throw new \Magento\Core\Exception(__('This class no longer exists.')); + throw new \Magento\Model\Exception(__('This class no longer exists.')); } $typeModel = $this->_classFactory->create($this); if ($typeModel->getAssignedToRules()->getSize() > 0) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'You cannot delete this tax class because it is used in Tax Rules. You have to delete the rules it is used in first.' ) @@ -109,7 +109,7 @@ class ClassModel extends \Magento\Core\Model\AbstractModel $objectCount = $typeModel->getAssignedToObjects()->getSize(); if ($objectCount > 0) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __( 'You cannot delete this tax class because it is used for %1 %2(s).', $objectCount, diff --git a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php index 2bd94c85d544829c86aa64d1dcd73aef1b40f0ae..ccc51315ddfe36ace32649951a02c73b64cf7504 100644 --- a/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php +++ b/app/code/Magento/Tax/Model/Config/Price/IncludePrice.php @@ -27,41 +27,12 @@ namespace Magento\Tax\Model\Config\Price; class IncludePrice extends \Magento\Core\Model\Config\Value { - /** - * @var \Magento\Core\Model\App - */ - protected $_app; - - /** - * @param \Magento\Model\Context $context - * @param \Magento\Registry $registry - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\App\ConfigInterface $config - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Model\Context $context, - \Magento\Registry $registry, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\App\ConfigInterface $config, - \Magento\Core\Model\App $app, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_app = $app; - parent::__construct($context, $registry, $storeManager, $config, $resource, $resourceCollection, $data); - } - /** * @return void */ public function _afterSave() { parent::_afterSave(); - $this->_app->cleanCache('checkout_quote'); + $this->_cacheManager->clean(array('checkout_quote')); } } diff --git a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php index 1069d3aaa8c26b24cddf6df269c82eaee4e4ece8..95b4df47ab0597052a5fe571c57f9d76bad8fd07 100644 --- a/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php +++ b/app/code/Magento/Tax/Model/Rate/CsvImportHandler.php @@ -105,12 +105,12 @@ class CsvImportHandler * * @param array $file file info retrieved from $_FILES array * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function importFromCsvFile($file) { if (!isset($file['tmp_name'])) { - throw new \Magento\Core\Exception('Invalid file upload attempt.'); + throw new \Magento\Model\Exception('Invalid file upload attempt.'); } $csvProcessor = new \Magento\File\Csv(); $ratesRawData = $csvProcessor->getData($file['tmp_name']); @@ -162,7 +162,7 @@ class CsvImportHandler * @param array $invalidFields assoc array of invalid file fields * @param array $validFields assoc array of valid file fields * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _filterRateData(array $rateRawData, array $invalidFields, array $validFields) { @@ -181,7 +181,7 @@ class CsvImportHandler } // check if number of fields in row match with number of valid fields if (count($rateRawData[$rowIndex]) != $validFieldsNum) { - throw new \Magento\Core\Exception('Invalid file format.'); + throw new \Magento\Model\Exception('Invalid file format.'); } } return $rateRawData; @@ -237,7 +237,7 @@ class CsvImportHandler * @param array $regionsCache cache of regions of already used countries (is used to optimize performance) * @param array $storesCache cache of stores related to tax rate titles * @return array regions cache populated with regions related to country of imported tax rate - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _importRate(array $rateData, array $regionsCache, array $storesCache) { @@ -245,7 +245,7 @@ class CsvImportHandler $countryCode = $rateData[1]; $country = $this->_countryFactory->create()->loadByCode($countryCode, 'iso2_code'); if (!$country->getId()) { - throw new \Magento\Core\Exception('One of the countries has invalid code.'); + throw new \Magento\Model\Exception('One of the countries has invalid code.'); } $regionsCache = $this->_addCountryRegionsToCache($countryCode, $regionsCache); diff --git a/app/code/Magento/Tax/Model/Resource/Calculation.php b/app/code/Magento/Tax/Model/Resource/Calculation.php index b8efcbf4f01689d4da1dbbf4bc501269db5fa4ad..f8bc44628f8b7e5261c7420112aa94d9dff1edcc 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation.php @@ -30,7 +30,7 @@ */ namespace Magento\Tax\Model\Resource; -class Calculation extends \Magento\Core\Model\Resource\Db\AbstractDb +class Calculation extends \Magento\Model\Resource\Db\AbstractDb { /** * Rates cache diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php index 5550a1b8525045508fdedd7a07280de527553fb0..24b5e4f9f4d9a4d6c651ba9353b5d554fd37dc81 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php index 6e8ce866f1286b6540a954e5873fa06ab3a2606c..0c13b00a151aaec8876bfb6eb59b56ee2266a33d 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\Calculation; -class Rate extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rate extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php index ed9c571b44faa405349f942cff548d4a291b4e62..a0f99155e937cc1819c6914e9c54fade9ad637c4 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Collection.php @@ -30,7 +30,7 @@ */ namespace Magento\Tax\Model\Resource\Calculation\Rate; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * @var \Magento\Core\Model\StoreManagerInterface @@ -44,7 +44,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( \Magento\Core\Model\EntityFactory $entityFactory, @@ -53,7 +53,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Model\StoreManagerInterface $storeManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_storeManager = $storeManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); @@ -186,12 +186,16 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * Convert items array to hash for select options * using fetchItem method * - * @see _toOptionHashOptimized() + * @see fetchItem() * * @return array */ public function toOptionHashOptimized() { - return $this->_toOptionHashOptimized('tax_calculation_rate_id', 'code'); + $result = array(); + while ($item = $this->fetchItem()) { + $result[$item->getData('tax_calculation_rate_id')] = $item->getData('code'); + } + return $result; } } diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php index 49f3360d99d8ac637a8ce66009636d123b8e8cba..e22349a3f0e5062078dfed48007aa1e15f1a3bb6 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rate; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Title extends \Magento\Core\Model\Resource\Db\AbstractDb +class Title extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php index 6c75b33a810ce4c06ab076aed4f6652a023fec09..e40744268617caa27fbfcbe7bd2bca7e4a8dfba2 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rate/Title/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rate\Title; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php index e04ea361e591a7aa3a167a73a16dfd9b9a7c807d..43339527ab28c9f99bf3d658d108c488593633fe 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rule.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Rule extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rule extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php b/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php index 99fb35d7dce7536ca4fafae445c0f6d412028234..7bbb2f3ce2ca11f29160b5a1ce17902213fc6514 100644 --- a/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Calculation/Rule/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Calculation\Rule; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization @@ -151,7 +151,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl * @param string $type * @param int $id * @return \Magento\Tax\Model\Resource\Calculation\Rule\Collection - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function setClassTypeFilter($type, $id) { @@ -163,7 +163,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $field = 'cd.customer_tax_class_id'; break; default: - throw new \Magento\Core\Exception('Invalid type supplied'); + throw new \Magento\Model\Exception('Invalid type supplied'); } $this->joinCalculationData('cd'); diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php index b872b74b673fddf06252148fd24151ea6ae67b22..2a66756efc033a4812e32cfc6074bbd61a21ba1d 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php index ca675d95e33507e48f2e04761985e11cc10f2246..def135c52a3d9e9457ccb42e772da7b432cb7b4b 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order\Tax; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php index 22331e4030a010a8fec3c23a8c467ee5e2c81b85..7eada36bf698d5e50e7ce136296ce17ff6fd5890 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\Sales\Order\Tax; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php index 989bdf0ba751e8c5bcfe3e8d7e3d91bcca78d7c0..e865c06f206b3786e539dd4f0b34be6932393d79 100644 --- a/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/Sales/Order/Tax/Item/Collection.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource\Sales\Order\Tax\Item; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Tax/Model/Resource/TaxClass.php b/app/code/Magento/Tax/Model/Resource/TaxClass.php index 97e2c11c939186130f56579036c6918238e3d800..7e97af80be57172dfa98d9f24dfbb092dc37232d 100644 --- a/app/code/Magento/Tax/Model/Resource/TaxClass.php +++ b/app/code/Magento/Tax/Model/Resource/TaxClass.php @@ -32,7 +32,7 @@ namespace Magento\Tax\Model\Resource; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class TaxClass extends \Magento\Core\Model\Resource\Db\AbstractDb +class TaxClass extends \Magento\Model\Resource\Db\AbstractDb { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php b/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php index 314a31eb65853ccc5bbd9df3e84806de16815393..8ed1c07036cca82b67967759112b1b83d3b4c73d 100644 --- a/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php +++ b/app/code/Magento/Tax/Model/Resource/TaxClass/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Tax\Model\Resource\TaxClass; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Resource initialization diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax.php b/app/code/Magento/Tax/Model/Sales/Order/Tax.php index 515217d8b9cea58172f03cfb01b4fb35ec893603..d3c3aee98bba3a5e91961bc6fa015fa68c8561a1 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax.php @@ -51,7 +51,7 @@ namespace Magento\Tax\Model\Sales\Order; * @method int getHidden() * @method \Magento\Tax\Model\Sales\Order\Tax setHidden(int $value) */ -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * @return void diff --git a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php index 04c0cc283dc97cbcf56af96d28da99b4417e90c0..f2723806cfe9975793458f641c89a87ffd5e4f1c 100644 --- a/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php +++ b/app/code/Magento/Tax/Model/Sales/Order/Tax/Item.php @@ -30,7 +30,7 @@ namespace Magento\Tax\Model\Sales\Order\Tax; * @package Magento_Tax * @author Magento Core Team <core@magentocommerce.com> */ -class Item extends \Magento\Core\Model\AbstractModel +class Item extends \Magento\Model\AbstractModel { /** * Initialization diff --git a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php index 5f986536f11b4ad9e4d06e7bd5f840e48432ad4e..6a26805604ecd8f2945af46229bb36f8dbb0be15 100644 --- a/app/code/Magento/Tax/Model/TaxClass/AbstractType.php +++ b/app/code/Magento/Tax/Model/TaxClass/AbstractType.php @@ -56,7 +56,7 @@ abstract class AbstractType extends \Magento\Object implements \Magento\Tax\Mode /** * Get Collection of Tax Rules that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToRules() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Factory.php b/app/code/Magento/Tax/Model/TaxClass/Factory.php index 7fab195f3b66f59ecf9124c831b03c258a45dd4f..3de9c823da5e357e9cbb6aa22d4ba8186e5ad702 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Factory.php +++ b/app/code/Magento/Tax/Model/TaxClass/Factory.php @@ -59,13 +59,13 @@ class Factory * * @param \Magento\Tax\Model\ClassModel $taxClass * @return \Magento\Tax\Model\TaxClass\Type\TypeInterface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function create(\Magento\Tax\Model\ClassModel $taxClass) { $taxClassType = $taxClass->getClassType(); if (!array_key_exists($taxClassType, $this->_types)) { - throw new \Magento\Core\Exception(sprintf('Invalid type of tax class "%s"', $taxClassType)); + throw new \Magento\Model\Exception(sprintf('Invalid type of tax class "%s"', $taxClassType)); } return $this->_objectManager->create( $this->_types[$taxClassType], diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php index fa245f1f155d210d604fb01c679c2dcfa4f498fe..da60eae3646d9f262db3819f4f73163a88717302 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/Customer.php @@ -87,7 +87,7 @@ class Customer extends \Magento\Tax\Model\TaxClass\AbstractType * \Magento\Tax\Model\TaxClass\Type\TypeInterface::getAssignedToObjects are refactored to return Data Objects. * Will be revisited in MAGETWO-21827 * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/Product.php b/app/code/Magento/Tax/Model/TaxClass/Type/Product.php index 8b6e4ab35f0be7c61ada81ee94c226891d9f86be..3bafa2e6247d9294fbaec77ea6e7f005b0b934d5 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/Product.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/Product.php @@ -60,7 +60,7 @@ class Product extends \Magento\Tax\Model\TaxClass\AbstractType /** * Get Products with this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects() { diff --git a/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php b/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php index 03162fcdecf7e649118017b57334b0cb6ce35d7c..56a4b56a6125f0d80926640c33d598ddbf643941 100644 --- a/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php +++ b/app/code/Magento/Tax/Model/TaxClass/Type/TypeInterface.php @@ -34,14 +34,14 @@ interface TypeInterface /** * Get Collection of Objects that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToObjects(); /** * Get Collection of Tax Rules that are assigned to this tax class * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getAssignedToRules(); diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php index 3fd0f0304d536a4e87365b0164f5fb7201993c9e..1735231aedc1246024ef46d0798ebacad95d2459 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Theme.php @@ -67,6 +67,7 @@ class Theme extends \Magento\Backend\App\Action */ public function indexAction() { + $this->_eventManager->dispatch('theme_registration_from_filesystem'); $this->_view->loadLayout(); $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->_view->renderLayout(); @@ -106,7 +107,7 @@ class Theme extends \Magento\Backend\App\Action try { $theme->setType(\Magento\View\Design\ThemeInterface::TYPE_VIRTUAL); if ($themeId && (!$theme->load($themeId)->getId() || !$theme->isVisible())) { - throw new \Magento\Core\Exception(__('We cannot find theme "%1".', $themeId)); + throw new \Magento\Model\Exception(__('We cannot find theme "%1".', $themeId)); } $this->_coreRegistry->register('current_theme', $theme); @@ -121,7 +122,7 @@ class Theme extends \Magento\Backend\App\Action } $this->_setActiveMenu('Magento_Theme::system_design_theme'); $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('adminhtml/*/'); } catch (\Exception $e) { @@ -166,7 +167,7 @@ class Theme extends \Magento\Backend\App\Action ); } if ($theme && !$theme->isEditable()) { - throw new \Magento\Core\Exception(__('Theme isn\'t editable.')); + throw new \Magento\Model\Exception(__('Theme isn\'t editable.')); } $theme->addData($themeData); if (isset($themeData['preview']['delete'])) { @@ -181,7 +182,7 @@ class Theme extends \Magento\Backend\App\Action $singleFile->update($theme, $customCssData); $this->messageManager->addSuccess(__('You saved the theme.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setThemeData($themeData); $this->_getSession()->setThemeCustomCssData($customCssData); @@ -222,7 +223,7 @@ class Theme extends \Magento\Backend\App\Action $theme->delete(); $this->messageManager->addSuccess(__('You deleted the theme.')); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('We cannot delete the theme.')); @@ -246,7 +247,7 @@ class Theme extends \Magento\Backend\App\Action try { $cssFileContent = $serviceModel->uploadCssFile('css_file_uploader'); $result = array('error' => false, 'content' => $cssFileContent['content']); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the CSS file.')); @@ -259,7 +260,7 @@ class Theme extends \Magento\Backend\App\Action * Upload js file * * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadJsAction() { @@ -273,7 +274,7 @@ class Theme extends \Magento\Backend\App\Action try { $theme = $themeFactory->create($themeId); if (!$theme) { - throw new \Magento\Core\Exception(__('We cannot find a theme with id "%1".', $themeId)); + throw new \Magento\Model\Exception(__('We cannot find a theme with id "%1".', $themeId)); } $jsFileData = $serviceModel->uploadJsFile('js_files_uploader'); $jsFile = $jsService->create(); @@ -289,7 +290,7 @@ class Theme extends \Magento\Backend\App\Action ); $customJsFiles = $customization->getFilesByType(\Magento\View\Design\Theme\Customization\File\Js::TYPE); $result = array('error' => false, 'files' => $customization->generateFileInfo($customJsFiles)); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('We cannot upload the JS file.')); diff --git a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php index d62108eae1ecea83894014f3595d8d975cf7a965..cc66f382d36a2fa290f512d0c0fb77b43ed8ad2b 100644 --- a/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php +++ b/app/code/Magento/Theme/Controller/Adminhtml/System/Design/Wysiwyg/Files.php @@ -93,7 +93,7 @@ class Files extends \Magento\Backend\App\Action try { $path = $this->_getSession()->getStoragePath(); $result = $this->_getStorage()->createFolder($name, $path); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); } catch (\Exception $e) { $result = array('error' => true, 'message' => __('Sorry, there was an unknown error.')); diff --git a/app/code/Magento/Theme/Model/Uploader/Service.php b/app/code/Magento/Theme/Model/Uploader/Service.php index f6bb2980af93384d0108799b7cc3b52f18df83e7..31f5980bcf8c7f8ec6da7dba5400958f60b52433 100644 --- a/app/code/Magento/Theme/Model/Uploader/Service.php +++ b/app/code/Magento/Theme/Model/Uploader/Service.php @@ -100,7 +100,7 @@ class Service * * @param string $file - Key in the $_FILES array * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadCssFile($file) { @@ -112,7 +112,7 @@ class Service $isValidFileSize = $this->_validateFileSize($fileUploader->getFileSize(), $this->getCssUploadMaxSize()); if (!$isValidFileSize) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The CSS file must be less than %1M.', $this->getCssUploadMaxSizeInMb()) ); } @@ -126,7 +126,7 @@ class Service * * @param string $file - Key in the $_FILES array * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadJsFile($file) { @@ -138,7 +138,7 @@ class Service $isValidFileSize = $this->_validateFileSize($fileUploader->getFileSize(), $this->getJsUploadMaxSize()); if (!$isValidFileSize) { - throw new \Magento\Core\Exception( + throw new \Magento\Model\Exception( __('The JS file must be less than %1M.', $this->getJsUploadMaxSizeInMb()) ); } diff --git a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php index 737c97016d97b308a240a7ecc76a035f64d6d256..f3e7b740077c42ba7a9f70f5d2b7780945f0c7fa 100644 --- a/app/code/Magento/Theme/Model/Wysiwyg/Storage.php +++ b/app/code/Magento/Theme/Model/Wysiwyg/Storage.php @@ -108,7 +108,7 @@ class Storage * * @param string $targetPath * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function uploadFile($targetPath) { @@ -120,7 +120,7 @@ class Storage $result = $uploader->save($targetPath); if (!$result) { - throw new \Magento\Core\Exception(__('We cannot upload the file.')); + throw new \Magento\Model\Exception(__('We cannot upload the file.')); } $this->_createThumbnail($targetPath . '/' . $uploader->getUploadedFileName()); @@ -178,12 +178,12 @@ class Storage * @param string $name * @param string $path * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function createFolder($name, $path) { if (!preg_match(self::DIRECTORY_NAME_REGEXP, $name)) { - throw new \Magento\Core\Exception(__('Use only standard alphanumeric, dashes and underscores.')); + throw new \Magento\Model\Exception(__('Use only standard alphanumeric, dashes and underscores.')); } if (!$this->mediaWriteDirectory->isWritable($path)) { $path = $this->_helper->getStorageRoot(); @@ -192,7 +192,7 @@ class Storage $newPath = $path . '/' . $name; if ($this->mediaWriteDirectory->isExist($newPath)) { - throw new \Magento\Core\Exception(__('We found a directory with the same name.')); + throw new \Magento\Model\Exception(__('We found a directory with the same name.')); } $this->mediaWriteDirectory->create($newPath); @@ -233,12 +233,12 @@ class Storage * * @param string $currentPath * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function getDirsCollection($currentPath) { if (!$this->mediaWriteDirectory->isExist($currentPath)) { - throw new \Magento\Core\Exception(__('We cannot find a directory with this name.')); + throw new \Magento\Model\Exception(__('We cannot find a directory with this name.')); } $paths = $this->mediaWriteDirectory->search('.*', $currentPath); $directories = array(); @@ -306,7 +306,7 @@ class Storage * * @param string $path * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function deleteDirectory($path) { @@ -314,7 +314,7 @@ class Storage $pathCmp = rtrim($path, '/'); if ($rootCmp == $pathCmp) { - throw new \Magento\Core\Exception(__('We cannot delete root directory %1.', $path)); + throw new \Magento\Model\Exception(__('We cannot delete root directory %1.', $path)); } return $this->mediaWriteDirectory->delete($path); diff --git a/app/code/Magento/Theme/view/frontend/html/bugreport.phtml b/app/code/Magento/Theme/view/frontend/html/bugreport.phtml index af86bbb4e80f0f4de8c59de8eb4af561a95c5820..220c76c6979c26b4129ff1645e42f1ba3e26b247 100644 --- a/app/code/Magento/Theme/view/frontend/html/bugreport.phtml +++ b/app/code/Magento/Theme/view/frontend/html/bugreport.phtml @@ -29,5 +29,5 @@ target="_blank"> <?php echo __('Report All Bugs') ?> </a> - <strong><?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?></strong> + <strong><?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?></strong> </small> diff --git a/app/code/Magento/Theme/view/frontend/html/footer.phtml b/app/code/Magento/Theme/view/frontend/html/footer.phtml index 8db58345ee1e24ee635887ca8000b818a9a5364e..0998dbefb4cddc6d3f39528392ed3e8df2894b7e 100644 --- a/app/code/Magento/Theme/view/frontend/html/footer.phtml +++ b/app/code/Magento/Theme/view/frontend/html/footer.phtml @@ -29,7 +29,7 @@ <?php echo $this->getChildHtml() ?> <p class="bugs"><?php echo __('Help Us to Keep Magento Healthy') ?> - <a href="http://www.magentocommerce.com/bug-tracking" - target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\Core\Model\App::VERSION) ?> + target="_blank"><strong><?php echo __('Report All Bugs') ?></strong></a> <?php echo __('(ver. %1)', \Magento\AppInterface::VERSION) ?> </p> <address><?php echo $this->getCopyright() ?></address> </div> diff --git a/app/code/Magento/Core/Helper/Translate.php b/app/code/Magento/Translation/Controller/Ajax.php similarity index 52% rename from app/code/Magento/Core/Helper/Translate.php rename to app/code/Magento/Translation/Controller/Ajax.php index d2589494f613194a06c29b46b81ec0b6826304cc..b5fdb069d14531dadf2af1dab6f03f99be3a37ff 100644 --- a/app/code/Magento/Core/Helper/Translate.php +++ b/app/code/Magento/Translation/Controller/Ajax.php @@ -18,68 +18,48 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Translation\Controller; -/** - * Core translate helper - */ -namespace Magento\Core\Helper; - -class Translate extends \Magento\App\Helper\AbstractHelper +class Ajax extends \Magento\App\Action\Action { /** - * Design package instance - * - * @var \Magento\View\DesignInterface - */ - protected $_design; - - /** - * Inline translate - * * @var \Magento\Translate\Inline\ParserInterface */ - protected $_inlineParser; + protected $inlineParser; /** - * @param \Magento\App\Helper\Context $context - * @param \Magento\View\DesignInterface $design + * @param \Magento\App\Action\Context $context * @param \Magento\Translate\Inline\ParserInterface $inlineParser */ public function __construct( - \Magento\App\Helper\Context $context, - \Magento\View\DesignInterface $design, + \Magento\App\Action\Context $context, \Magento\Translate\Inline\ParserInterface $inlineParser ) { - $this->_design = $design; - $this->_inlineParser = $inlineParser; parent::__construct($context); + + $this->inlineParser = $inlineParser; } /** - * Save translation data to database for specific area + * Ajax action for inline translation * - * @param array $translate - * @param string $area - * @param string $returnType - * @return string + * @return void */ - public function apply($translate, $area, $returnType = 'json') + public function indexAction() { - try { - if ($area) { - $this->_design->setArea($area); - } + $translate = (array)$this->getRequest()->getPost('translate'); - $this->_inlineParser->processAjaxPost($translate); - $result = $returnType == 'json' ? "{success:true}" : true; + try { + $this->inlineParser->processAjaxPost($translate); + $response = "{success:true}"; } catch (\Exception $e) { - $result = $returnType == 'json' ? "{error:true,message:'" . $e->getMessage() . "'}" : false; + $response = "{error:true,message:'" . $e->getMessage() . "'}"; } - return $result; + $this->getResponse()->setBody($response); + + $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); } } diff --git a/app/code/Magento/Core/Model/Translate/Inline/Config.php b/app/code/Magento/Translation/Model/Inline/Config.php similarity index 76% rename from app/code/Magento/Core/Model/Translate/Inline/Config.php rename to app/code/Magento/Translation/Model/Inline/Config.php index 5676b30fe93579d259c4dded6b25cb9e19c640bc..f88c6c407290514e62c81baae727c1fb5c10d586 100644 --- a/app/code/Magento/Core/Model/Translate/Inline/Config.php +++ b/app/code/Magento/Translation/Model/Inline/Config.php @@ -18,26 +18,21 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +namespace Magento\Translation\Model\Inline; /** * Inline Translation config */ -namespace Magento\Core\Model\Translate\Inline; - class Config implements \Magento\Translate\Inline\ConfigInterface { /** - * Core store config - * - * @var \Magento\Core\Model\Store\Config + * @var \Magento\Core\Model\Store\ConfigInterface */ - protected $_coreStoreConfig; + protected $config; /** * @var \Magento\Core\Helper\Data @@ -45,12 +40,12 @@ class Config implements \Magento\Translate\Inline\ConfigInterface protected $_helper; /** - * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\Store\ConfigInterface $config * @param \Magento\Core\Helper\Data $helper */ - public function __construct(\Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Helper\Data $helper) + public function __construct(\Magento\Core\Model\Store\ConfigInterface $config, \Magento\Core\Helper\Data $helper) { - $this->_coreStoreConfig = $coreStoreConfig; + $this->config = $config; $this->_helper = $helper; } @@ -59,7 +54,7 @@ class Config implements \Magento\Translate\Inline\ConfigInterface */ public function isActive($scope = null) { - return $this->_coreStoreConfig->getConfigFlag('dev/translate_inline/active', $scope); + return $this->config->getConfigFlag('dev/translate_inline/active', $scope); } /** diff --git a/app/code/Magento/Core/Model/Translate/Inline/Parser.php b/app/code/Magento/Translation/Model/Inline/Parser.php similarity index 94% rename from app/code/Magento/Core/Model/Translate/Inline/Parser.php rename to app/code/Magento/Translation/Model/Inline/Parser.php index 9af6858f23acfc958811a2dd67b08217af0e2c21..8ca3d2dd0734babe57cf6b630bd96fee1f94c378 100644 --- a/app/code/Magento/Core/Model/Translate/Inline/Parser.php +++ b/app/code/Magento/Translation/Model/Inline/Parser.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -28,7 +26,7 @@ * This class is responsible for parsing content and applying necessary html element * wrapping and client scripts for inline translation. */ -namespace Magento\Core\Model\Translate\Inline; +namespace Magento\Translation\Model\Inline; class Parser implements \Magento\Translate\Inline\ParserInterface { @@ -37,13 +35,6 @@ class Parser implements \Magento\Translate\Inline\ParserInterface */ const DATA_TRANSLATE = 'data-translate'; - /** - * Regular Expression for detected and replace translate - * - * @var string - */ - protected $_tokenRegex = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; - /** * Response body or JSON content string * @@ -56,7 +47,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface * * @var bool */ - protected $_isJson = \Magento\Translate\Inline\ParserInterface::JSON_FLAG_DEFAULT_STATE; + protected $_isJson = false; /** * Get max translate block in same tag @@ -117,7 +108,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface ); /** - * @var \Magento\Core\Model\Resource\Translate\StringFactory + * @var \Magento\Translation\Model\Resource\StringFactory */ protected $_resourceFactory; @@ -149,7 +140,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface /** * Initialize base inline translation model * - * @param \Magento\Core\Model\Resource\Translate\StringFactory $resource + * @param \Magento\Translation\Model\Resource\StringFactory $resource * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Zend_Filter_Interface $inputFilter * @param \Magento\App\State $appState @@ -157,7 +148,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface * @param \Magento\Translate\InlineInterface $translateInline */ public function __construct( - \Magento\Core\Model\Resource\Translate\StringFactory $resource, + \Magento\Translation\Model\Resource\StringFactory $resource, \Magento\Core\Model\StoreManagerInterface $storeManager, \Zend_Filter_Interface $inputFilter, \Magento\App\State $appState, @@ -191,7 +182,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface /** @var $validStoreId int */ $validStoreId = $this->_storeManager->getStore()->getId(); - /** @var $resource \Magento\Core\Model\Resource\Translate\String */ + /** @var $resource \Magento\Translation\Model\Resource\String */ $resource = $this->_resourceFactory->create(); foreach ($translateParams as $param) { if ($this->_appState->getAreaCode() == \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { @@ -420,13 +411,13 @@ class Parser implements \Magento\Translate\Inline\ParserInterface private function _prepareTagAttributesForContent(&$content) { $quoteHtml = $this->_getHtmlQuote(); - $tagMatch = array(); - $nextTag = 0; - $tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . $this->_tokenRegex . ')[^>]*?)+\\\\?/?>#iS'; + $tagMatch = array(); + $nextTag = 0; + $tagRegExp = '#<([a-z]+)\s*?[^>]+?((' . self::REGEXP_TOKEN . ')[^>]*?)+\\\\?/?>#iS'; while (preg_match($tagRegExp, $content, $tagMatch, PREG_OFFSET_CAPTURE, $nextTag)) { $tagHtml = $tagMatch[0][0]; $matches = array(); - $attrRegExp = '#' . $this->_tokenRegex . '#S'; + $attrRegExp = '#' . self::REGEXP_TOKEN . '#S'; $trArr = $this->_getTranslateData($attrRegExp, $tagHtml, array($this, '_getAttributeLocation')); if ($trArr) { $transRegExp = '# ' . $this->_getHtmlAttribute( @@ -548,7 +539,7 @@ class Parser implements \Magento\Translate\Inline\ParserInterface $tagClosurePos = $tagMatch[0][1] + strlen($tagHtml); $trArr = $this->_getTranslateData( - '#' . $this->_tokenRegex . '#iS', + '#' . self::REGEXP_TOKEN . '#iS', $tagHtml, array($this, '_getTagLocation'), array('tagName' => $tagName, 'tagList' => $tagsList) @@ -602,14 +593,14 @@ class Parser implements \Magento\Translate\Inline\ParserInterface { $next = 0; $matches = array(); - while (preg_match('#' . $this->_tokenRegex . '#', $this->_content, $matches, PREG_OFFSET_CAPTURE, $next)) { + while (preg_match('#' . self::REGEXP_TOKEN . '#', $this->_content, $matches, PREG_OFFSET_CAPTURE, $next)) { $translateProperties = json_encode( array( 'shown' => $matches[1][0], 'translated' => $matches[2][0], 'original' => $matches[3][0], 'location' => 'Text', - 'scope' => $matches[4][0] + 'scope' => $matches[4][0], ) ); diff --git a/app/code/Magento/Core/Model/Resource/Translate/String.php b/app/code/Magento/Translation/Model/Resource/String.php similarity index 83% rename from app/code/Magento/Core/Model/Resource/Translate/String.php rename to app/code/Magento/Translation/Model/Resource/String.php index ee94eceec41582a7f7eeb90686bb086ac9095685..90148505703225a6083365b63b4c852bc73dd3c9 100644 --- a/app/code/Magento/Core/Model/Resource/Translate/String.php +++ b/app/code/Magento/Translation/Model/Resource/String.php @@ -18,21 +18,12 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Translate; +namespace Magento\Translation\Model\Resource; -/** - * String translate resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -class String extends \Magento\Core\Model\Resource\Db\AbstractDb +class String extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Locale\ResolverInterface @@ -40,23 +31,31 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb protected $_localeResolver; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\BaseScopeResolverInterface + */ + protected $scopeResolver; + + /** + * @var null|string */ - protected $_storeManager; + protected $scope; /** * @param \Magento\App\Resource $resource * @param \Magento\Locale\ResolverInterface $localeResolver - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param null $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\Locale\ResolverInterface $localeResolver, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\BaseScopeResolverInterface $scopeResolver, + $scope = null ) { - parent::__construct($resource); $this->_localeResolver = $localeResolver; - $this->_storeManager = $storeManager; + $this->scopeResolver = $scopeResolver; + $this->scope = $scope; + parent::__construct($resource); } /** @@ -66,18 +65,18 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb */ protected function _construct() { - $this->_init('core_translate', 'key_id'); + $this->_init('translation', 'key_id'); } /** * Load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param String $value * @param String $field * @return array|$this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_string($value)) { $select = $this->_getReadAdapter()->select()->from( @@ -99,7 +98,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param String $field * @param String $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Magento\DB\Select */ protected function _getLoadSelect($field, $value, $object) @@ -112,10 +111,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After translation loading * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function _afterLoad(\Magento\Core\Model\AbstractModel $object) + public function _afterLoad(\Magento\Model\AbstractModel $object) { $adapter = $this->_getReadAdapter(); $select = $adapter->select()->from( @@ -132,10 +131,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Before save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $select = $adapter->select()->from( @@ -156,10 +155,10 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb /** * After save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { $adapter = $this->_getWriteAdapter(); $select = $adapter->select()->from( @@ -237,7 +236,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb } if (is_null($storeId)) { - $storeId = $this->_getStoreId(); + $storeId = $this->getStoreId(); } $select = $write->select()->from( @@ -262,7 +261,7 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb if ($row = $write->fetchRow($select, $bind)) { $original = $string; if (strpos($original, '::') !== false) { - list($scope, $original) = explode('::', $original); + list( , $original) = explode('::', $original); } if ($original == $translate) { $write->delete($table, array('key_id=?' => $row['key_id'])); @@ -286,12 +285,12 @@ class String extends \Magento\Core\Model\Resource\Db\AbstractDb } /** - * Get current store id + * Retrieve current store identifier * - * @return int + * @return \Magento\BaseScopeInterface */ - protected function _getStoreId() + protected function getStoreId() { - return $this->_storeManager->getStore()->getId(); + return $this->scopeResolver->getScope($this->scope)->getId(); } } diff --git a/app/code/Magento/Core/Model/Resource/Translate.php b/app/code/Magento/Translation/Model/Resource/Translate.php similarity index 79% rename from app/code/Magento/Core/Model/Resource/Translate.php rename to app/code/Magento/Translation/Model/Resource/Translate.php index 251e4a175c85dcd68fe7c0ac28858973acce5fae..128af4713e59e55f4651cf281c2ba7a6562e858c 100644 --- a/app/code/Magento/Core/Model/Resource/Translate.php +++ b/app/code/Magento/Translation/Model/Resource/Translate.php @@ -18,21 +18,12 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Translation\Model\Resource; -/** - * Translation resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \Magento\Translate\ResourceInterface +class Translate extends \Magento\Model\Resource\Db\AbstractDb implements \Magento\Translate\ResourceInterface { /** * @var \Magento\App\State @@ -40,23 +31,31 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M protected $_appState; /** - * @var \Magento\Core\Model\StoreManagerInterface + * @var \Magento\BaseScopeResolverInterface */ - protected $_storeManager; + protected $scopeResolver; + + /** + * @var null|string + */ + protected $scope; /** * @param \Magento\App\Resource $resource * @param \Magento\App\State $appState - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\BaseScopeResolverInterface $scopeResolver + * @param null|string $scope */ public function __construct( \Magento\App\Resource $resource, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager + \Magento\BaseScopeResolverInterface $scopeResolver, + $scope = null ) { - parent::__construct($resource); $this->_appState = $appState; - $this->_storeManager = $storeManager; + $this->scopeResolver = $scopeResolver; + $this->scope = $scope; + parent::__construct($resource); } /** @@ -66,7 +65,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M */ protected function _construct() { - $this->_init('core_translate', 'key_id'); + $this->_init('translation', 'key_id'); } /** @@ -83,7 +82,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } if (is_null($storeId)) { - $storeId = $this->_getStoreId(); + $storeId = $this->getStoreId(); } $adapter = $this->_getReadAdapter(); @@ -121,7 +120,7 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } if (is_null($storeId)) { - $this->_getStoreId(); + $storeId = $this->getStoreId(); } $adapter = $this->_getReadAdapter(); @@ -158,12 +157,12 @@ class Translate extends \Magento\Core\Model\Resource\Db\AbstractDb implements \M } /** - * Get store id for translations + * Retrieve current store identifier * - * @return int + * @return \Magento\BaseScopeInterface */ - protected function _getStoreId() + protected function getStoreId() { - return $this->_storeManager->getStore()->getId(); + return $this->scopeResolver->getScope($this->scope)->getId(); } } diff --git a/app/code/Magento/Core/Model/Translate/String.php b/app/code/Magento/Translation/Model/String.php similarity index 68% rename from app/code/Magento/Core/Model/Translate/String.php rename to app/code/Magento/Translation/Model/String.php index 6775f04bb940fdfc8a6c73a8895f929b2f469b78..623e74785b80d0587660ffecc4aae09b07cd7275 100644 --- a/app/code/Magento/Core/Model/Translate/String.php +++ b/app/code/Magento/Translation/Model/String.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,29 +25,25 @@ /** * String translation model * - * @method \Magento\Core\Model\Resource\Translate\String _getResource() - * @method \Magento\Core\Model\Resource\Translate\String getResource() + * @method \Magento\Translation\Model\Resource\String _getResource() + * @method \Magento\Translation\Model\Resource\String getResource() * @method int getStoreId() - * @method \Magento\Core\Model\Translate\String setStoreId(int $value) + * @method \Magento\Translation\Model\String setStoreId(int $value) * @method string getTranslate() - * @method \Magento\Core\Model\Translate\String setTranslate(string $value) + * @method \Magento\Translation\Model\String setTranslate(string $value) * @method string getLocale() - * @method \Magento\Core\Model\Translate\String setLocale(string $value) - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * @method \Magento\Translation\Model\String setLocale(string $value) */ -namespace Magento\Core\Model\Translate; +namespace Magento\Translation\Model; -class String extends \Magento\Core\Model\AbstractModel +class String extends \Magento\Model\AbstractModel { /** * @return void */ protected function _construct() { - $this->_init('Magento\Core\Model\Resource\Translate\String'); + $this->_init('Magento\Translation\Model\Resource\String'); } /** diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php similarity index 68% rename from dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php rename to app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php index 9dc6cfa2a4c1097789bf0c9be6b78b032653093f..6e2120b4e8cff981ee8f1d3f6b8d7f853ad6b68b 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueWriterTest.php +++ b/app/code/Magento/Translation/data/translation_setup/data-upgrade-1.0.0.0-1.0.0.1.php @@ -1,7 +1,5 @@ <?php /** - * \Magento\PubSub\Event\QueueWriter - * * Magento * * NOTICE OF LICENSE @@ -23,16 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $event = new \Magento\PubSub\Event('topic', array()); - $queue = new \Magento\PubSub\Event\QueueWriter(); - $result = $queue->offer($event); +/* @var $installer \Magento\Core\Model\Resource\Setup */ +$installer = $this; + +$installer->startSetup(); + +$select = $installer->getConnection() + ->select() + ->from($installer->getTable('core_translate')) + ->insertFromSelect($installer->getTable('translation')); + +$installer->getConnection()->query($select); + +$installer->getConnection()->dropTable($installer->getTable('core_translate')); - $this->assertNull($result); - } -} +$installer->endSetup(); diff --git a/app/code/Magento/Translation/etc/adminhtml/di.xml b/app/code/Magento/Translation/etc/adminhtml/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..5ade7363c26eace3585916e14d4eb059aec5d418 --- /dev/null +++ b/app/code/Magento/Translation/etc/adminhtml/di.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Backend\Model\Translate\Inline\Config" /> + <type name="Magento\Translation\Model\Resource\Translate"> + <arguments> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> + <type name="Magento\Translation\Model\Resource\String"> + <arguments> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="templateFileName" xsi:type="string">Magento_Translation::translate_inline.phtml</argument> + <argument name="translatorRoute" xsi:type="string">adminhtml/ajax/translate</argument> + <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> + <argument name="url" xsi:type="object">Magento\Backend\Model\UrlInterface</argument> + <argument name="scope" xsi:type="string">admin</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/adminhtml/routes.xml b/app/code/Magento/Translation/etc/adminhtml/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..f54eea71c040efb0d961d00ceae487be475720b0 --- /dev/null +++ b/app/code/Magento/Translation/etc/adminhtml/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="admin"> + <route id="translation" frontName="translation"> + <module name="Magento_Translation" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Translation/etc/cache.xml b/app/code/Magento/Translation/etc/cache.xml new file mode 100644 index 0000000000000000000000000000000000000000..d8e3c37ea7c28e2570d6e9d320c6a0bf69dc9eb5 --- /dev/null +++ b/app/code/Magento/Translation/etc/cache.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Cache/etc/cache.xsd"> + <type name="translate" translate="label,description" instance="Magento\App\Cache\Type\Translate"> + <label>Translations</label> + <description>Translation files.</description> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/config.xml b/app/code/Magento/Translation/etc/config.xml new file mode 100644 index 0000000000000000000000000000000000000000..95c9f1b2a6d13fdbefacbd41bf72124a4a6c4480 --- /dev/null +++ b/app/code/Magento/Translation/etc/config.xml @@ -0,0 +1,38 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../Core/etc/config.xsd"> + <default> + <dev> + <translate_inline> + <active>0</active> + <active_admin>0</active_admin> + <invalid_caches> + <block_html /> + </invalid_caches> + </translate_inline> + </dev> + </default> +</config> diff --git a/app/code/Magento/Translation/etc/di.xml b/app/code/Magento/Translation/etc/di.xml new file mode 100644 index 0000000000000000000000000000000000000000..f0c02add04e02da5fdd42ae3beb76b09531ad3fe --- /dev/null +++ b/app/code/Magento/Translation/etc/di.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/ObjectManager/etc/config.xsd"> + <preference for="Magento\Translate\InlineInterface" type="Magento\Translate\Inline" /> + <preference for="Magento\Translate\Inline\ConfigInterface" type="Magento\Translation\Model\Inline\Config" /> + <preference for="Magento\Translate\Inline\ProviderInterface" type="Magento\Translate\Inline\Provider" /> + <preference for="Magento\Translate\Inline\ParserInterface" type="Magento\Translation\Model\Inline\Parser" /> + <preference for="Magento\Translate\ResourceInterface" type="Magento\Translation\Model\Resource\Translate" /> + <preference for="Magento\Translate\Inline\StateInterface" type="Magento\Translate\Inline\State" /> + <preference for="Magento\Phrase\RendererInterface" type="Magento\Phrase\Renderer\Composite" /> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="templateFileName" xsi:type="string">Magento_Translation::translate_inline.phtml</argument> + <argument name="translatorRoute" xsi:type="string">translation/ajax/index</argument> + <argument name="layout" xsi:type="object">Magento\View\LayoutInterface\Proxy</argument> + <argument name="config" xsi:type="object">Magento\Translate\Inline\ConfigInterface\Proxy</argument> + </arguments> + </type> + <type name="Magento\Translation\Model\Inline\Parser"> + <arguments> + <argument name="inputFilter" xsi:type="object">Magento\Filter\Input\MaliciousCode</argument> + </arguments> + </type> + <type name="Magento\Translate\Inline\Provider"> + <arguments> + <argument name="inlineTranslate" xsi:type="object">Magento\Translate\Inline\Proxy</argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Composite"> + <arguments> + <argument name="renderers" xsi:type="array"> + <item name="translation" xsi:type="object">Magento\Phrase\Renderer\Translate</item> + <item name="placeholder" xsi:type="object">Magento\Phrase\Renderer\Placeholder</item> + <item name="inline" xsi:type="object">Magento\Phrase\Renderer\Inline</item> + </argument> + </arguments> + </type> + <type name="Magento\Phrase\Renderer\Translate"> + <arguments> + <argument name="translator" xsi:type="object">Magento\Translate</argument> + </arguments> + </type> +</config> diff --git a/app/code/Magento/Translation/etc/frontend/routes.xml b/app/code/Magento/Translation/etc/frontend/routes.xml new file mode 100644 index 0000000000000000000000000000000000000000..0cfe58766bc3034a6d47542b424b7e9f5c9dfdf3 --- /dev/null +++ b/app/code/Magento/Translation/etc/frontend/routes.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../lib/Magento/App/etc/routes.xsd"> + <router id="standard"> + <route id="translation" frontName="translation"> + <module name="Magento_Translation" /> + </route> + </router> +</config> \ No newline at end of file diff --git a/app/code/Magento/Translation/etc/module.xml b/app/code/Magento/Translation/etc/module.xml new file mode 100644 index 0000000000000000000000000000000000000000..05d7fae094c3e1250bf9506a98135bf42d3717b4 --- /dev/null +++ b/app/code/Magento/Translation/etc/module.xml @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/Magento/Module/etc/module.xsd"> + <module name="Magento_Translation" version="1.0.0.1" active="true"> + <sequence> + <module name="Magento_Core"/> + </sequence> + <depends> + <module name="Magento_Core"/> + <module name="Magento_Backend"/> + </depends> + </module> +</config> diff --git a/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php new file mode 100644 index 0000000000000000000000000000000000000000..0629dd3ff0a301e864366ecc12e87aae80e5f28c --- /dev/null +++ b/app/code/Magento/Translation/sql/translation_setup/install-1.0.0.0.php @@ -0,0 +1,110 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +/* @var $installer \Magento\Core\Model\Resource\Setup */ +$installer = $this; + +$installer->startSetup(); + +/** + * Create table 'translation' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('translation')) + ->addColumn( + 'key_id', + \Magento\DB\Ddl\Table::TYPE_INTEGER, + null, + array( + 'identity' => true, + 'unsigned' => true, + 'nullable' => false, + 'primary' => true, + ), + 'Key Id of Translation' + )->addColumn( + 'string', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array( + 'nullable' => false, + 'default' => \Magento\TranslateInterface::DEFAULT_STRING, + ), + 'Translation String' + )->addColumn( + 'store_id', + \Magento\DB\Ddl\Table::TYPE_SMALLINT, + null, + array( + 'unsigned' => true, + 'nullable' => false, + 'default' => '0', + ), + 'Store Id' + )->addColumn( + 'translate', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 255, + array(), + 'Translate' + )->addColumn( + 'locale', + \Magento\DB\Ddl\Table::TYPE_TEXT, + 20, + array( + 'nullable' => false, + 'default' => 'en_US', + ), + 'Locale' + )->addColumn( + 'crc_string', + \Magento\DB\Ddl\Table::TYPE_BIGINT, + null, + array( + 'nullable' => false, + 'default' => crc32(\Magento\TranslateInterface::DEFAULT_STRING) + ), + 'Translation String CRC32 Hash' + )->addIndex( + $installer->getIdxName( + 'translation', + array('store_id', 'locale', 'crc_string', 'string'), + \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + array('store_id', 'locale', 'crc_string', 'string'), + array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) + )->addIndex( + $installer->getIdxName('translation', array('store_id')), + array('store_id') + )->addForeignKey( + $installer->getFkName('translation', 'store_id', 'core_store', 'store_id'), + 'store_id', + $installer->getTable('core_store'), + 'store_id', + \Magento\DB\Ddl\Table::ACTION_CASCADE, + \Magento\DB\Ddl\Table::ACTION_CASCADE + )->setComment('Translations'); +$installer->getConnection()->createTable($table); + +$installer->endSetup(); diff --git a/app/code/Magento/Core/view/adminhtml/translate_inline.phtml b/app/code/Magento/Translation/view/adminhtml/translate_inline.phtml similarity index 100% rename from app/code/Magento/Core/view/adminhtml/translate_inline.phtml rename to app/code/Magento/Translation/view/adminhtml/translate_inline.phtml diff --git a/app/code/Magento/Core/view/frontend/translate_inline.phtml b/app/code/Magento/Translation/view/frontend/translate_inline.phtml similarity index 100% rename from app/code/Magento/Core/view/frontend/translate_inline.phtml rename to app/code/Magento/Translation/view/frontend/translate_inline.phtml diff --git a/app/code/Magento/User/Controller/Adminhtml/Auth.php b/app/code/Magento/User/Controller/Adminhtml/Auth.php index a44e962515198c1c5043f46cb22610c7109beda9..532417c8c1036b77c11cc55320f506296a1ee8ae 100644 --- a/app/code/Magento/User/Controller/Adminhtml/Auth.php +++ b/app/code/Magento/User/Controller/Adminhtml/Auth.php @@ -174,7 +174,7 @@ class Auth extends \Magento\Backend\App\AbstractAction $this->getResponse()->setRedirect( $this->_objectManager->get('Magento\Backend\Helper\Data')->getHomePageUrl() ); - } catch (\Magento\Core\Exception $exception) { + } catch (\Magento\Model\Exception $exception) { $this->messageManager->addMessages($exception->getMessages()); $this->_redirect( 'adminhtml/auth/resetpassword', @@ -189,7 +189,7 @@ class Auth extends \Magento\Backend\App\AbstractAction * @param int $userId * @param string $resetPasswordToken * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateResetPasswordLinkToken($userId, $resetPasswordToken) { @@ -199,18 +199,18 @@ class Auth extends \Magento\Backend\App\AbstractAction $resetPasswordToken ) || empty($resetPasswordToken) || empty($userId) || $userId < 0 ) { - throw new \Magento\Core\Exception(__('Please correct the password reset token.')); + throw new \Magento\Model\Exception(__('Please correct the password reset token.')); } /** @var $user \Magento\User\Model\User */ $user = $this->_userFactory->create()->load($userId); if (!$user->getId()) { - throw new \Magento\Core\Exception(__('Please specify the correct account and try again.')); + throw new \Magento\Model\Exception(__('Please specify the correct account and try again.')); } $userToken = $user->getRpToken(); if (strcmp($userToken, $resetPasswordToken) != 0 || $user->isResetPasswordLinkTokenExpired()) { - throw new \Magento\Core\Exception(__('Your password reset link has expired.')); + throw new \Magento\Model\Exception(__('Your password reset link has expired.')); } } diff --git a/app/code/Magento/User/Controller/Adminhtml/User.php b/app/code/Magento/User/Controller/Adminhtml/User.php index e8a28bf4b3cdf8cc4c51b2498f459fb9da7f7676..5dd25d0d9b5ab63209b3fa5d72139d5106a3f6ac 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User.php +++ b/app/code/Magento/User/Controller/Adminhtml/User.php @@ -177,7 +177,7 @@ class User extends \Magento\Backend\App\AbstractAction $this->messageManager->addSuccess(__('You saved the user.')); $this->_getSession()->setUserData(false); $this->_redirect('adminhtml/*/'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addMessages($e->getMessages()); $this->_getSession()->setUserData($data); $this->_redirect('adminhtml/*/edit', array('_current' => true)); diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role.php b/app/code/Magento/User/Controller/Adminhtml/User/Role.php index 61406409521e5c8e621f6a74da293654ea0c00d9..da3ac59c511cb34a75e7416f578e0bc4cd59cccd 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role.php @@ -262,7 +262,7 @@ class Role extends \Magento\Backend\App\AbstractAction $this->_addUserToRole($nRuid, $role->getId()); } $this->messageManager->addSuccess(__('You saved the role.')); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('An error occurred while saving this role.')); diff --git a/app/code/Magento/User/Model/Resource/Permissions/Collection.php b/app/code/Magento/User/Model/Resource/Permissions/Collection.php index 67df01ab2db316f856f65abe99476fc086f1f3db..f31ab4b3fa57c328efd73fcaaa0bd753f027bea8 100644 --- a/app/code/Magento/User/Model/Resource/Permissions/Collection.php +++ b/app/code/Magento/User/Model/Resource/Permissions/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Permissions; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/User/Model/Resource/Role.php b/app/code/Magento/User/Model/Resource/Role.php index 4299b11cd6b0dbb0cfca51528b72330a04b578cf..cb6dd6ed93cc0dfd665f12db71775f7fec1d514b 100644 --- a/app/code/Magento/User/Model/Resource/Role.php +++ b/app/code/Magento/User/Model/Resource/Role.php @@ -28,7 +28,7 @@ use Magento\User\Model\Acl\Role\User as RoleUser; /** * Admin role resource model */ -class Role extends \Magento\Core\Model\Resource\Db\AbstractDb +class Role extends \Magento\Model\Resource\Db\AbstractDb { /** * Users table @@ -87,10 +87,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role before saving * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $role) + protected function _beforeSave(\Magento\Model\AbstractModel $role) { if (!$role->getId()) { $role->setCreated($this->dateTime->formatDate(true)); @@ -134,10 +134,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role after saving * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $role) + protected function _afterSave(\Magento\Model\AbstractModel $role) { $this->_updateRoleUsersAcl($role); $this->_cache->clean(\Zend_Cache::CLEANING_MODE_MATCHING_TAG, array(\Magento\Backend\Block\Menu::CACHE_TAGS)); @@ -147,10 +147,10 @@ class Role extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Process role after deleting * - * @param \Magento\Core\Model\AbstractModel $role + * @param \Magento\Model\AbstractModel $role * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $role) + protected function _afterDelete(\Magento\Model\AbstractModel $role) { $adapter = $this->_getWriteAdapter(); diff --git a/app/code/Magento/User/Model/Resource/Role/Collection.php b/app/code/Magento/User/Model/Resource/Role/Collection.php index 2b0240dad099451c2000dce3b17383c5bf1b1135..ff99e071531fc127e663b51a38afe7b77399f641 100644 --- a/app/code/Magento/User/Model/Resource/Role/Collection.php +++ b/app/code/Magento/User/Model/Resource/Role/Collection.php @@ -28,7 +28,7 @@ use Magento\User\Model\Acl\Role\Group as RoleGroup; /** * Admin role collection */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/Role/User/Collection.php b/app/code/Magento/User/Model/Resource/Role/User/Collection.php index c14ba5cbfe4607ca0706547ec3aea37e1c253cc8..d1f4e10817b11d5c063aeacefb473e77a3ee4f13 100644 --- a/app/code/Magento/User/Model/Resource/Role/User/Collection.php +++ b/app/code/Magento/User/Model/Resource/Role/User/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Role\User; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/Rules.php b/app/code/Magento/User/Model/Resource/Rules.php index 83f2e3a9920ac68e43b0d6d1afb0beaf00a83eba..887b80576b55fdfdb4f519b4c6fcd34261fe4848 100644 --- a/app/code/Magento/User/Model/Resource/Rules.php +++ b/app/code/Magento/User/Model/Resource/Rules.php @@ -26,7 +26,7 @@ namespace Magento\User\Model\Resource; /** * Admin rule resource model */ -class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb +class Rules extends \Magento\Model\Resource\Db\AbstractDb { /** * Root ACL resource @@ -88,7 +88,7 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param \Magento\User\Model\Rules $rule * @return void - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function saveRel(\Magento\User\Model\Rules $rule) { @@ -130,7 +130,7 @@ class Rules extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->commit(); $this->_aclCache->clean(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $adapter->rollBack(); throw $e; } catch (\Exception $e) { diff --git a/app/code/Magento/User/Model/Resource/Rules/Collection.php b/app/code/Magento/User/Model/Resource/Rules/Collection.php index a80c129da1983951e01318a794248c089c09d9bd..a343164a6d66b2619e338b53cea4be7081d2c19e 100644 --- a/app/code/Magento/User/Model/Resource/Rules/Collection.php +++ b/app/code/Magento/User/Model/Resource/Rules/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\Rules; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource model diff --git a/app/code/Magento/User/Model/Resource/User.php b/app/code/Magento/User/Model/Resource/User.php index 44541ddc2fa1c4417baa92310818961c4ddbda6e..2dcc688ae28f9eb798ae91a1e71e8dd7b3bea540 100644 --- a/app/code/Magento/User/Model/Resource/User.php +++ b/app/code/Magento/User/Model/Resource/User.php @@ -30,7 +30,7 @@ use Magento\User\Model\User as ModelUser; /** * ACL user resource */ -class User extends \Magento\Core\Model\Resource\Db\AbstractDb +class User extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Acl\CacheInterface @@ -139,7 +139,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb { if (is_numeric($user)) { $userId = $user; - } elseif ($user instanceof \Magento\Core\Model\AbstractModel) { + } elseif ($user instanceof \Magento\Model\AbstractModel) { $userId = $user->getUserId(); } else { return null; @@ -162,10 +162,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Set created/modified values before user save * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $user) + protected function _beforeSave(\Magento\Model\AbstractModel $user) { if ($user->isObjectNew()) { $user->setCreated($this->dateTime->formatDate(true)); @@ -178,10 +178,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Unserialize user extra data after user save * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $user) + protected function _afterSave(\Magento\Model\AbstractModel $user) { $user->setExtra(unserialize($user->getExtra())); if ($user->hasRoleId()) { @@ -241,10 +241,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Unserialize user extra data after user load * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $user) + protected function _afterLoad(\Magento\Model\AbstractModel $user) { if (is_string($user->getExtra())) { $user->setExtra(unserialize($user->getExtra())); @@ -255,11 +255,11 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete user role record with user * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - public function delete(\Magento\Core\Model\AbstractModel $user) + public function delete(\Magento\Model\AbstractModel $user) { $this->_beforeDelete($user); $adapter = $this->_getWriteAdapter(); @@ -271,7 +271,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb $adapter->delete($this->getMainTable(), $conditions); $adapter->delete($this->getTable('admin_role'), $conditions); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { throw $e; return false; } catch (\Exception $e) { @@ -286,10 +286,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Get user roles * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function getRoles(\Magento\Core\Model\AbstractModel $user) + public function getRoles(\Magento\Model\AbstractModel $user) { if (!$user->getId()) { return array(); @@ -323,10 +323,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Delete user role * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return $this */ - public function deleteFromRole(\Magento\Core\Model\AbstractModel $user) + public function deleteFromRole(\Magento\Model\AbstractModel $user) { if ($user->getUserId() <= 0) { return $this; @@ -346,10 +346,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if role user exists * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function roleUserExists(\Magento\Core\Model\AbstractModel $user) + public function roleUserExists(\Magento\Model\AbstractModel $user) { if ($user->getUserId() > 0) { $roleTable = $this->getTable('admin_role'); @@ -369,10 +369,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Check if user exists * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return array */ - public function userExists(\Magento\Core\Model\AbstractModel $user) + public function userExists(\Magento\Model\AbstractModel $user) { $adapter = $this->_getReadAdapter(); $select = $adapter->select(); @@ -397,10 +397,10 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Whether a user's identity is confirmed * - * @param \Magento\Core\Model\AbstractModel $user + * @param \Magento\Model\AbstractModel $user * @return bool */ - public function isUserUnique(\Magento\Core\Model\AbstractModel $user) + public function isUserUnique(\Magento\Model\AbstractModel $user) { return !$this->userExists($user); } @@ -408,7 +408,7 @@ class User extends \Magento\Core\Model\Resource\Db\AbstractDb /** * Save user extra data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $data * @return $this */ diff --git a/app/code/Magento/User/Model/Resource/User/Collection.php b/app/code/Magento/User/Model/Resource/User/Collection.php index fab622aa7a294b06e7d0894e6518f8afc0ce57be..da464402a165d97b713e8ad4e0140269e1c5a6cb 100644 --- a/app/code/Magento/User/Model/Resource/User/Collection.php +++ b/app/code/Magento/User/Model/Resource/User/Collection.php @@ -32,7 +32,7 @@ namespace Magento\User\Model\Resource\User; * @package Magento_User * @author Magento Core Team <core@magentocommerce.com> */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Define resource model diff --git a/app/code/Magento/User/Model/Resource/User/Locked/Collection.php b/app/code/Magento/User/Model/Resource/User/Locked/Collection.php index 84273a9111ae2786aaf311d43dfb14ce43e267fa..29f552d9531848600370109083d5c8ff68aa76e1 100644 --- a/app/code/Magento/User/Model/Resource/User/Locked/Collection.php +++ b/app/code/Magento/User/Model/Resource/User/Locked/Collection.php @@ -37,7 +37,7 @@ class Collection extends \Magento\User\Model\Resource\User\Collection /** * Collection Init Select * - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource * @return $this */ protected function _initSelect() diff --git a/app/code/Magento/User/Model/Role.php b/app/code/Magento/User/Model/Role.php index cc5802cd77104760c6b72b1882733812bb40e967..fbca5b9dbe587f1617b61109dbc1dd607bb5a11a 100644 --- a/app/code/Magento/User/Model/Role.php +++ b/app/code/Magento/User/Model/Role.php @@ -43,7 +43,7 @@ namespace Magento\User\Model; * @method string getRoleName() * @method \Magento\User\Model\Role setRoleName(string $value) */ -class Role extends \Magento\Core\Model\AbstractModel +class Role extends \Magento\Model\AbstractModel { /** * @var string diff --git a/app/code/Magento/User/Model/Rules.php b/app/code/Magento/User/Model/Rules.php index 08035e08280406ceb8e399a3fa6060055b579b63..579efc6e762c83077a4046f4ff7f5865ae6bb07f 100644 --- a/app/code/Magento/User/Model/Rules.php +++ b/app/code/Magento/User/Model/Rules.php @@ -39,7 +39,7 @@ namespace Magento\User\Model; * @method string getPermission() * @method \Magento\User\Model\Rules setPermission(string $value) */ -class Rules extends \Magento\Core\Model\AbstractModel +class Rules extends \Magento\Model\AbstractModel { /** * Class constructor diff --git a/app/code/Magento/User/Model/User.php b/app/code/Magento/User/Model/User.php index bd6d39e67d2f45dfeb1e268a466370c4aa01fca1..eb476a74e9aee16f46bc69182bd9589e4aa9071d 100644 --- a/app/code/Magento/User/Model/User.php +++ b/app/code/Magento/User/Model/User.php @@ -54,7 +54,7 @@ namespace Magento\User\Model; * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.LongVariable) */ -class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend\Model\Auth\Credential\StorageInterface +class User extends \Magento\Model\AbstractModel implements \Magento\Backend\Model\Auth\Credential\StorageInterface { /** * Configuration paths for email templates and identities @@ -149,7 +149,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * @param \Magento\Mail\Template\TransportBuilder $transportBuilder * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param array $data @@ -167,7 +167,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -223,7 +223,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $this->_userData = $objectManager->get('Magento\User\Helper\Data'); $this->_config = $objectManager->get('Magento\Backend\App\ConfigInterface'); - $this->_coreRegistry = $objectManager->get('Magento\Registry'); + $this->_registry = $objectManager->get('Magento\Registry'); $this->_validatorObject = $objectManager->get('Magento\Validator\ObjectFactory'); $this->_roleFactory = $objectManager->get('Magento\User\Model\RoleFactory'); $this->_encryptor = $objectManager->get('Magento\Encryption\EncryptorInterface'); @@ -519,7 +519,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * @param string $username * @param string $password * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @throws \Magento\Backend\Model\Auth\Exception * @throws \Magento\Backend\Model\Auth\Plugin\Exception */ @@ -550,7 +550,7 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend 'admin_user_authenticate_after', array('username' => $username, 'password' => $password, 'user' => $this, 'result' => $result) ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->unsetData(); throw $e; } @@ -633,12 +633,12 @@ class User extends \Magento\Core\Model\AbstractModel implements \Magento\Backend * * @param string $newToken * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function changeResetPasswordLinkToken($newToken) { if (!is_string($newToken) || empty($newToken)) { - throw new \Magento\Core\Exception(__('Please correct the password reset token.')); + throw new \Magento\Model\Exception(__('Please correct the password reset token.')); } $this->setRpToken($newToken); $this->setRpTokenCreatedAt($this->dateTime->now()); diff --git a/app/code/Magento/Webapi/Controller/ErrorProcessor.php b/app/code/Magento/Webapi/Controller/ErrorProcessor.php index cdadb7c32a6b0863bb127ed354fef33e6045960f..5ef6407703497f2f5ae7e25d0e43ed863b4c1809 100644 --- a/app/code/Magento/Webapi/Controller/ErrorProcessor.php +++ b/app/code/Magento/Webapi/Controller/ErrorProcessor.php @@ -25,6 +25,8 @@ */ namespace Magento\Webapi\Controller; +use Magento\App\State; + class ErrorProcessor { const DEFAULT_SHUTDOWN_FUNCTION = 'apiShutdownFunction'; @@ -42,13 +44,19 @@ class ErrorProcessor /**#@-*/ - /** @var \Magento\Core\Helper\Data */ + /** + * @var \Magento\Core\Helper\Data + */ protected $_coreHelper; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; - /** @var \Magento\Logger */ + /** + * @var \Magento\Logger + */ protected $_logger; /** @@ -64,21 +72,19 @@ class ErrorProcessor protected $directoryWrite; /** - * Initialize dependencies. Register custom shutdown function. - * * @param \Magento\Core\Helper\Data $helper - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState * @param \Magento\Logger $logger * @param \Magento\App\Filesystem $filesystem */ public function __construct( \Magento\Core\Helper\Data $helper, - \Magento\AppInterface $app, + \Magento\App\State $appState, \Magento\Logger $logger, \Magento\App\Filesystem $filesystem ) { $this->_coreHelper = $helper; - $this->_app = $app; + $this->_appState = $appState; $this->_logger = $logger; $this->_filesystem = $filesystem; $this->directoryWrite = $this->_filesystem->getDirectoryWrite(\Magento\App\Filesystem::VAR_DIR); @@ -115,7 +121,7 @@ class ErrorProcessor } else if ($exception instanceof \Magento\Webapi\Exception) { $maskedException = $exception; } else { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { /** Create exception with masked message. */ $maskedException = new \Magento\Webapi\Exception( __('Internal Error. Details are available in Magento log file. Report ID: %1', $reportId), @@ -145,7 +151,7 @@ class ErrorProcessor */ public function renderException(\Exception $exception, $httpCode = self::DEFAULT_ERROR_HTTP_CODE) { - if ($this->_app->isDeveloperMode() || $exception instanceof \Magento\Webapi\Exception) { + if ($this->_appState->getMode() == State::MODE_DEVELOPER || $exception instanceof \Magento\Webapi\Exception) { $this->render($exception->getMessage(), $exception->getTraceAsString(), $httpCode); } else { $reportId = $this->_logException($exception); @@ -218,7 +224,8 @@ class ErrorProcessor { $errorData = array(); $message = array('code' => $httpCode, 'message' => $errorMessage); - if ($this->_app->isDeveloperMode()) { + $isDeveloperMode = $this->_appState->getMode() == State::MODE_DEVELOPER; + if ($isDeveloperMode) { $message['trace'] = $trace; } $errorData['messages']['error'][] = $message; @@ -227,24 +234,18 @@ class ErrorProcessor $errorData = $this->_coreHelper->jsonEncode($errorData); break; case self::DATA_FORMAT_XML: - $errorData = '<?xml version="1.0"?>' . - '<error>' . - '<messages>' . - '<error>' . - '<data_item>' . - '<code>' . - $httpCode . - '</code>' . - '<message><![CDATA[' . - $errorMessage . - ']]></message>' . - ($this->_app->isDeveloperMode() ? '<trace><![CDATA[' . - $trace . - ']]></trace>' : '') . - '</data_item>' . - '</error>' . - '</messages>' . - '</error>'; + $errorData = '<?xml version="1.0"?>' + . '<error>' + . '<messages>' + . '<error>' + . '<data_item>' + . '<code>' . $httpCode . '</code>' + . '<message><![CDATA[' . $errorMessage . ']]></message>' + . ($isDeveloperMode ? '<trace><![CDATA[' . $trace . ']]></trace>' : '') + . '</data_item>' + . '</error>' + . '</messages>' + . '</error>'; break; } return $errorData; @@ -273,7 +274,7 @@ class ErrorProcessor if ($error && $error['type'] & $fatalErrorFlag) { $errorMessage = "Fatal Error: '{$error['message']}' in '{$error['file']}' on line {$error['line']}"; $reportId = $this->_saveFatalErrorReport($errorMessage); - if ($this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() == State::MODE_DEVELOPER) { $this->render($errorMessage); } else { $this->render(__('Server internal error. See details in report api/%1', $reportId)); diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index d705305c396c60356572b8bfb5e2327396b7e7f3..0047d63acffedf09bd960080250754631a6d494d 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -52,8 +52,8 @@ class Rest implements \Magento\App\FrontControllerInterface /** @var \Magento\App\State */ protected $_appState; - /** @var \Magento\AppInterface */ - protected $_application; + /** @var \Magento\View\LayoutInterface */ + protected $_layout; /** @var \Magento\Oauth\OauthInterface */ protected $_oauthService; @@ -71,19 +71,25 @@ class Rest implements \Magento\App\FrontControllerInterface protected $_errorProcessor; /** - * Initialize dependencies. + * Initialize dependencies * + * @var \Magento\App\AreaList + */ + protected $areaList; + + /** * @param RestRequest $request * @param RestResponse $response * @param Router $router * @param \Magento\ObjectManager $objectManager * @param \Magento\App\State $appState - * @param \Magento\AppInterface $application + * @param \Magento\View\LayoutInterface $layout * @param \Magento\Oauth\OauthInterface $oauthService * @param \Magento\Oauth\Helper\Request $oauthHelper * @param AuthorizationService $authorizationService * @param ServiceArgsSerializer $serializer * @param ErrorProcessor $errorProcessor + * @param \Magento\App\AreaList $areaList * * TODO: Consider removal of warning suppression * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -94,24 +100,26 @@ class Rest implements \Magento\App\FrontControllerInterface Router $router, \Magento\ObjectManager $objectManager, \Magento\App\State $appState, - \Magento\AppInterface $application, + \Magento\View\LayoutInterface $layout, \Magento\Oauth\OauthInterface $oauthService, \Magento\Oauth\Helper\Request $oauthHelper, AuthorizationService $authorizationService, ServiceArgsSerializer $serializer, - ErrorProcessor $errorProcessor + ErrorProcessor $errorProcessor, + \Magento\App\AreaList $areaList ) { $this->_router = $router; $this->_request = $request; $this->_response = $response; $this->_objectManager = $objectManager; $this->_appState = $appState; - $this->_application = $application; + $this->_layout = $layout; $this->_oauthService = $oauthService; $this->_oauthHelper = $oauthHelper; $this->_authorizationService = $authorizationService; $this->_serializer = $serializer; $this->_errorProcessor = $errorProcessor; + $this->areaList = $areaList; } /** @@ -125,10 +133,8 @@ class Rest implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->_application->loadAreaPart( - $this->_application->getLayout()->getArea(), - \Magento\Core\Model\App\Area::PART_TRANSLATE - ); + $this->areaList->getArea($this->_layout->getArea()) + ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { throw new \Magento\Webapi\Exception(__('Magento is not yet installed')); diff --git a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php index f79ac01eb557a98297bbe99f676985723f2e231d..cbde612db3eb9b1ef8965fb4b33fecb8595fd06e 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Json.php @@ -25,24 +25,28 @@ */ namespace Magento\Webapi\Controller\Rest\Request\Deserializer; +use \Magento\App\State; + class Json implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterface { - /** @var \Magento\Core\Helper\Data */ + /** + * @var \Magento\Core\Helper\Data + */ protected $_helper; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var State + */ + protected $_appState; /** - * Initialize dependencies. - * * @param \Magento\Core\Helper\Data $helper - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState */ - public function __construct(\Magento\Core\Helper\Data $helper, \Magento\Core\Model\App $app) + public function __construct(\Magento\Core\Helper\Data $helper, State $appState) { $this->_helper = $helper; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -63,7 +67,7 @@ class Json implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterf try { $decodedBody = $this->_helper->jsonDecode($encodedBody); } catch (\Zend_Json_Exception $e) { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { throw new \Magento\Webapi\Exception(__('Decoding error.')); } else { throw new \Magento\Webapi\Exception( diff --git a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php index 67ba2730dd980959ad4d1efce97a0e1ef0477cab..23cbc4a9818b2255e70f1b1cb5a92ee22e00e1d6 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php +++ b/app/code/Magento/Webapi/Controller/Rest/Request/Deserializer/Xml.php @@ -25,24 +25,24 @@ */ namespace Magento\Webapi\Controller\Rest\Request\Deserializer; +use Magento\App\State; + class Xml implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterface { /** @var \Magento\Xml\Parser */ protected $_xmlParser; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** @var State */ + protected $_appState; /** - * Initialize dependencies. - * * @param \Magento\Xml\Parser $xmlParser - * @param \Magento\Core\Model\App $app + * @param State $appState */ - public function __construct(\Magento\Xml\Parser $xmlParser, \Magento\Core\Model\App $app) + public function __construct(\Magento\Xml\Parser $xmlParser, State $appState) { $this->_xmlParser = $xmlParser; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -80,7 +80,7 @@ class Xml implements \Magento\Webapi\Controller\Rest\Request\DeserializerInterfa /** Process errors during XML parsing. */ if ($this->_errorMessage !== null) { - if (!$this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() !== State::MODE_DEVELOPER) { $exceptionMessage = __('Decoding error.'); } else { $exceptionMessage = 'Decoding Error: ' . $this->_errorMessage; diff --git a/app/code/Magento/Webapi/Controller/Rest/Response.php b/app/code/Magento/Webapi/Controller/Rest/Response.php index e962edf06906ae354da50f11f27086af7acc4e7b..b2f530660f6b2b75f57059c6a3cc4d67284c8f83 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Response.php +++ b/app/code/Magento/Webapi/Controller/Rest/Response.php @@ -33,24 +33,26 @@ class Response extends \Magento\Webapi\Controller\Response /** @var \Magento\Webapi\Controller\Rest\Response\RendererInterface */ protected $_renderer; - /** @var \Magento\Core\Model\App */ - protected $_app; + /** + * @var \Magento\App\State + */ + protected $_appState; /** * Initialize dependencies. * * @param \Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory * @param \Magento\Webapi\Controller\ErrorProcessor $errorProcessor - * @param \Magento\Core\Model\App $app + * @param \Magento\App\State $appState */ public function __construct( \Magento\Webapi\Controller\Rest\Response\Renderer\Factory $rendererFactory, \Magento\Webapi\Controller\ErrorProcessor $errorProcessor, - \Magento\Core\Model\App $app + \Magento\App\State $appState ) { $this->_renderer = $rendererFactory->get(); $this->_errorProcessor = $errorProcessor; - $this->_app = $app; + $this->_appState = $appState; } /** @@ -103,7 +105,7 @@ class Response extends \Magento\Webapi\Controller\Response if ($maskedException->getDetails()) { $messageData['parameters'] = $maskedException->getDetails(); } - if ($this->_app->isDeveloperMode()) { + if ($this->_appState->getMode() == \Magento\App\State::MODE_DEVELOPER) { $messageData['trace'] = $exception->getTraceAsString(); } $formattedMessages['errors'][] = $messageData; diff --git a/app/code/Magento/Webapi/Controller/Soap.php b/app/code/Magento/Webapi/Controller/Soap.php index bd2e20048b4deffd30249b1fa41c4a0e89420b52..7875b4460f75695ed53bebd57ca9bd77c5b6866a 100644 --- a/app/code/Magento/Webapi/Controller/Soap.php +++ b/app/code/Magento/Webapi/Controller/Soap.php @@ -62,8 +62,8 @@ class Soap implements \Magento\App\FrontControllerInterface /** @var \Magento\App\State */ protected $_appState; - /** @var \Magento\AppInterface */ - protected $_application; + /** @var \Magento\View\LayoutInterface */ + protected $_layout; /** * @var \Magento\Oauth\OauthInterface @@ -75,6 +75,11 @@ class Soap implements \Magento\App\FrontControllerInterface */ protected $_localeResolver; + /** + * @var \Magento\App\AreaList + */ + protected $areaList; + /** * @param Soap\Request $request * @param Response $response @@ -82,9 +87,12 @@ class Soap implements \Magento\App\FrontControllerInterface * @param \Magento\Webapi\Model\Soap\Server $soapServer * @param ErrorProcessor $errorProcessor * @param \Magento\App\State $appState - * @param \Magento\AppInterface $application + * @param \Magento\View\LayoutInterface $layout * @param \Magento\Oauth\OauthInterface $oauthService * @param \Magento\Locale\ResolverInterface $localeResolver + * @param \Magento\App\AreaList $areaList + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Webapi\Controller\Soap\Request $request, @@ -93,9 +101,10 @@ class Soap implements \Magento\App\FrontControllerInterface \Magento\Webapi\Model\Soap\Server $soapServer, ErrorProcessor $errorProcessor, \Magento\App\State $appState, - \Magento\AppInterface $application, + \Magento\View\LayoutInterface $layout, \Magento\Oauth\OauthInterface $oauthService, - \Magento\Locale\ResolverInterface $localeResolver + \Magento\Locale\ResolverInterface $localeResolver, + \Magento\App\AreaList $areaList ) { $this->_request = $request; $this->_response = $response; @@ -103,9 +112,10 @@ class Soap implements \Magento\App\FrontControllerInterface $this->_soapServer = $soapServer; $this->_errorProcessor = $errorProcessor; $this->_appState = $appState; - $this->_application = $application; $this->_oauthService = $oauthService; $this->_localeResolver = $localeResolver; + $this->_layout = $layout; + $this->areaList = $areaList; } /** @@ -119,10 +129,8 @@ class Soap implements \Magento\App\FrontControllerInterface $pathParts = explode('/', trim($request->getPathInfo(), '/')); array_shift($pathParts); $request->setPathInfo('/' . implode('/', $pathParts)); - $this->_application->loadAreaPart( - $this->_application->getLayout()->getArea(), - \Magento\Core\Model\App\Area::PART_TRANSLATE - ); + $this->areaList->getArea($this->_layout->getArea()) + ->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); try { if (!$this->_appState->isInstalled()) { throw new WebapiException(__('Magento is not yet installed')); @@ -193,10 +201,11 @@ class Soap implements \Magento\App\FrontControllerInterface $this->_setResponseContentType($contentType); $this->_response->setHttpResponseCode($httpCode); $soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_application, + $this->_request, $this->_soapServer, $maskedException, - $this->_localeResolver + $this->_localeResolver, + $this->_appState ); // TODO: Generate list of available URLs when invalid WSDL URL specified $this->_setResponseBody($soapFault->toXml()); diff --git a/app/code/Magento/Webapi/Model/Soap/Fault.php b/app/code/Magento/Webapi/Model/Soap/Fault.php index f7c4d9f8b9bc1893876a393b471bc0fef93f8364..cb1f639ce384042d5bcec73b2d02a96ff3beca34 100644 --- a/app/code/Magento/Webapi/Model/Soap/Fault.php +++ b/app/code/Magento/Webapi/Model/Soap/Fault.php @@ -25,6 +25,8 @@ */ namespace Magento\Webapi\Model\Soap; +use Magento\App\State; + class Fault extends \RuntimeException { const FAULT_REASON_INTERNAL = 'Internal Error.'; @@ -84,9 +86,9 @@ class Fault extends \RuntimeException protected $_details = array(); /** - * @var \Magento\Core\Model\App + * @var \Magento\App\RequestInterface */ - protected $_application; + protected $_request; /** * @var Server @@ -99,24 +101,32 @@ class Fault extends \RuntimeException protected $_localeResolver; /** - * @param \Magento\Core\Model\App $application + * @var \Magento\App\State + */ + protected $appState; + + /** + * @param \Magento\App\RequestInterface $request * @param Server $soapServer * @param \Magento\Webapi\Exception $previousException * @param \Magento\Locale\ResolverInterface $localeResolver + * @param State $appState */ public function __construct( - \Magento\Core\Model\App $application, + \Magento\App\RequestInterface $request, Server $soapServer, \Magento\Webapi\Exception $previousException, - \Magento\Locale\ResolverInterface $localeResolver + \Magento\Locale\ResolverInterface $localeResolver, + State $appState ) { parent::__construct($previousException->getMessage(), $previousException->getCode(), $previousException); $this->_soapCode = $previousException->getOriginator(); $this->_parameters = $previousException->getDetails(); $this->_errorCode = $previousException->getCode(); - $this->_application = $application; + $this->_request = $request; $this->_soapServer = $soapServer; $this->_localeResolver = $localeResolver; + $this->appState = $appState; $this->_setFaultName($previousException->getName()); } @@ -127,7 +137,7 @@ class Fault extends \RuntimeException */ public function toXml() { - if ($this->_application->isDeveloperMode()) { + if ($this->appState->getMode() == State::MODE_DEVELOPER) { $this->addDetails(array(self::NODE_DETAIL_TRACE => "<![CDATA[{$this->getTraceAsString()}]]>")); } if ($this->getParameters()) { @@ -169,7 +179,7 @@ class Fault extends \RuntimeException protected function _setFaultName($exceptionName) { if ($exceptionName) { - $contentType = $this->_application->getRequest()->getHeader('Content-Type'); + $contentType = $this->_request->getHeader('Content-Type'); /** SOAP action is specified in content type header if content type is application/soap+xml */ if (preg_match('|application/soap\+xml.+action="(.+)".*|', $contentType, $matches)) { $soapAction = $matches[1]; diff --git a/app/code/Magento/Webapi/etc/webapi_rest/di.xml b/app/code/Magento/Webapi/etc/webapi_rest/di.xml index 69e4d199206e10fea0deed9db07b10798d50b2f0..9d49baaf00233e04b93d8daddc6e8d17ea982d39 100644 --- a/app/code/Magento/Webapi/etc/webapi_rest/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_rest/di.xml @@ -31,6 +31,7 @@ </arguments> </type> <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Rest" /> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> <type name="Magento\Webapi\Controller\Rest\Request\Deserializer\Factory"> <arguments> diff --git a/app/code/Magento/Webapi/etc/webapi_soap/di.xml b/app/code/Magento/Webapi/etc/webapi_soap/di.xml index 52e0ee9a1c7bc2a3afc1d7dc4ed65bf153ca0b91..4415bbc060be1e49c7536ff4c07bcf333939f31a 100644 --- a/app/code/Magento/Webapi/etc/webapi_soap/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_soap/di.xml @@ -31,6 +31,7 @@ </arguments> </type> <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Soap" /> + <preference for="Magento\Model\ActionValidator\RemoveAction" type="Magento\Model\ActionValidator\RemoveAction\Allowed" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> <type name="Magento\Webapi\Controller\Soap"> <arguments> diff --git a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php index 7adbc06e57762ebb1e4acd785334d7611e32b63d..39eb5de39f1e8dbf2cc0964d5df993cdfcad2c16 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -25,7 +25,7 @@ */ namespace Magento\Weee\Model\Attribute\Backend\Weee; -use Magento\Core\Exception; +use Magento\Model\Exception; class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price { diff --git a/app/code/Magento/Weee/Model/Observer.php b/app/code/Magento/Weee/Model/Observer.php index 2f800f6169478cc48a087d8484775b5db3021f51..7ec5addd9afb179234a02bca4d17647fddd7fcd7 100644 --- a/app/code/Magento/Weee/Model/Observer.php +++ b/app/code/Magento/Weee/Model/Observer.php @@ -25,7 +25,7 @@ */ namespace Magento\Weee\Model; -class Observer extends \Magento\Core\Model\AbstractModel +class Observer extends \Magento\Model\AbstractModel { /** * @var \Magento\Catalog\Model\Product\Type @@ -62,7 +62,7 @@ class Observer extends \Magento\Core\Model\AbstractModel * @param \Magento\Weee\Helper\Data $weeeData * @param \Magento\Catalog\Model\Product\Type $productType * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -74,7 +74,7 @@ class Observer extends \Magento\Core\Model\AbstractModel \Magento\Weee\Helper\Data $weeeData, \Magento\Catalog\Model\Product\Type $productType, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -251,7 +251,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $response = $observer->getEvent()->getResponseObject(); $options = $response->getAdditionalOptions(); - $_product = $this->_coreRegistry->registry('current_product'); + $_product = $this->_registry->registry('current_product'); if (!$_product) { return $this; } @@ -287,7 +287,7 @@ class Observer extends \Magento\Core\Model\AbstractModel $selection = $observer->getEvent()->getSelection(); $options = $response->getAdditionalOptions(); - $_product = $this->_coreRegistry->registry('current_product'); + $_product = $this->_registry->registry('current_product'); $typeDynamic = \Magento\Bundle\Block\Adminhtml\Catalog\Product\Edit\Tab\Attributes\Extend::DYNAMIC; if (!$_product || $_product->getPriceType() != $typeDynamic) { diff --git a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php index bde9a7bbbc2101b952fe2dea9410c55160a58993..d622c1f004fe5adba33c06125868cc0c19d48e18 100644 --- a/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Attribute/Backend/Weee/Tax.php @@ -32,7 +32,7 @@ namespace Magento\Weee\Model\Resource\Attribute\Backend\Weee; * @package Magento_Weee * @author Magento Core Team <core@magentocommerce.com> */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Core\Model\StoreManagerInterface diff --git a/app/code/Magento/Weee/Model/Resource/Tax.php b/app/code/Magento/Weee/Model/Resource/Tax.php index 0205ce4c2d7d07ddd793bb843d79e0e868e5adfe..3d8c6d73db0c132d5665b4bf68038216b75d87d7 100644 --- a/app/code/Magento/Weee/Model/Resource/Tax.php +++ b/app/code/Magento/Weee/Model/Resource/Tax.php @@ -31,7 +31,7 @@ use Magento\Catalog\Model\Product\Condition\ConditionInterface; /** * Wee tax resource model */ -class Tax extends \Magento\Core\Model\Resource\Db\AbstractDb +class Tax extends \Magento\Model\Resource\Db\AbstractDb { /** * @var \Magento\Stdlib\DateTime diff --git a/app/code/Magento/Weee/Model/Tax.php b/app/code/Magento/Weee/Model/Tax.php index 425d4a51623c7e8ff8b4d65b511271f94b08b5ce..e15d9623ad90a313c40b806da9437cb068c074d9 100644 --- a/app/code/Magento/Weee/Model/Tax.php +++ b/app/code/Magento/Weee/Model/Tax.php @@ -28,7 +28,7 @@ namespace Magento\Weee\Model; use Magento\Catalog\Model\Product; use Magento\Core\Model\Website; -class Tax extends \Magento\Core\Model\AbstractModel +class Tax extends \Magento\Model\AbstractModel { /** * Including FPT only diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php index b2d44402b2abf863410f088a70b87999fed94a10..00a54f436870cb2b91ee7b7da8a7f8547286d8d5 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Options.php @@ -131,14 +131,14 @@ class Options extends \Magento\Backend\Block\Widget\Form\Generic /** * Add fields to main fieldset based on specified widget type * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function addFields() { // get configuration node and translation helper if (!$this->getWidgetType()) { - throw new \Magento\Core\Exception(__('Please specify a Widget Type.')); + throw new \Magento\Model\Exception(__('Please specify a Widget Type.')); } $config = $this->_widget->getConfigAsObject($this->getWidgetType()); if (!$config->getParameters()) { diff --git a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php index e80ebdb79839801ab7b8b88af3c49658b85b57f8..98ca02c4b30334f990b4b77ef02be11cfd59d319 100644 --- a/app/code/Magento/Widget/Controller/Adminhtml/Widget.php +++ b/app/code/Magento/Widget/Controller/Adminhtml/Widget.php @@ -110,7 +110,7 @@ class Widget extends \Magento\Backend\App\Action } $this->_view->renderLayout(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $result = array('error' => true, 'message' => $e->getMessage()); $this->getResponse()->setBody($this->_objectManager->get('Magento\Core\Helper\Data')->jsonEncode($result)); } diff --git a/app/code/Magento/Widget/Model/Resource/Widget.php b/app/code/Magento/Widget/Model/Resource/Widget.php index fb3b72f5145014d61cedfc3e282f8124ea7d4469..bd7f1e28a8c3c28695959a081fb7fbc656827777 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget.php +++ b/app/code/Magento/Widget/Model/Resource/Widget.php @@ -34,7 +34,7 @@ */ namespace Magento\Widget\Model\Resource; -class Widget extends \Magento\Core\Model\Resource\Db\AbstractDb +class Widget extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance.php index 9bbc407b3c63334ad75b8f48d56f95b4e4cc1ddf..3d7269e1fa3e2527204f924bee86bd3b87f43b5d 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance.php @@ -34,9 +34,9 @@ */ namespace Magento\Widget\Model\Resource\Widget; -use Magento\Core\Model\AbstractModel; +use Magento\Model\AbstractModel; -class Instance extends \Magento\Core\Model\Resource\Db\AbstractDb +class Instance extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php index daf2cb9a1a0c5959d463f700ac4d6224616cb13a..624d11ca5a9eb2a6b55bad281b9b6a9202d5fb5a 100644 --- a/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php +++ b/app/code/Magento/Widget/Model/Resource/Widget/Instance/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Widget\Model\Resource\Widget\Instance; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Fields map for corellation names & real selected fields diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index f7b223cd47ddf47d4efaf280968c5691f3f0a80f..66090c5e3a5300b4002fad368c316d820a682289 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -43,7 +43,7 @@ namespace Magento\Widget\Model\Widget; * @package Magento_Widget * @author Magento Core Team <core@magentocommerce.com> */ -class Instance extends \Magento\Core\Model\AbstractModel +class Instance extends \Magento\Model\AbstractModel { const SPECIFIC_ENTITIES = 'specific'; @@ -137,7 +137,7 @@ class Instance extends \Magento\Core\Model\AbstractModel * @param \Magento\Widget\Model\NamespaceResolver $namespaceResolver * @param \Magento\Math\Random $mathRandom * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param string[] $relatedCacheTypes * @param array $data @@ -154,7 +154,7 @@ class Instance extends \Magento\Core\Model\AbstractModel \Magento\Widget\Model\NamespaceResolver $namespaceResolver, \Magento\Math\Random $mathRandom, \Magento\App\Filesystem $filesystem, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $relatedCacheTypes = array(), array $data = array() diff --git a/app/code/Magento/Wishlist/Block/AbstractBlock.php b/app/code/Magento/Wishlist/Block/AbstractBlock.php index f6623f5653a42582e0c17a9b6743c650b31e6d83..27e896736812bc1318610c87383c5138a38de5cc 100644 --- a/app/code/Magento/Wishlist/Block/AbstractBlock.php +++ b/app/code/Magento/Wishlist/Block/AbstractBlock.php @@ -61,36 +61,14 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd protected $_productFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, array $data = array(), @@ -100,16 +78,6 @@ abstract class AbstractBlock extends \Magento\Catalog\Block\Product\AbstractProd $this->_productFactory = $productFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $data, $priceBlockTypes ); diff --git a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php index de342a3717299d12b6b45b89f8fc70860485736d..9e301f4ef97d8617fd279efa88c3c71cb84444c1 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Sidebar.php +++ b/app/code/Magento/Wishlist/Block/Customer/Sidebar.php @@ -128,9 +128,11 @@ class Sidebar extends \Magento\Wishlist\Block\AbstractBlock implements \Magento\ public function getIdentities() { $identities = array(); - foreach ($this->getWishlistItems() as $item) { - /** @var $item \Magento\Wishlist\Model\Item */ - $identities = array_merge($identities, $item->getProduct()->getIdentities()); + if ($this->getItemCount()) { + foreach ($this->getWishlistItems() as $item) { + /** @var $item \Magento\Wishlist\Model\Item */ + $identities = array_merge($identities, $item->getProduct()->getIdentities()); + } } return $identities; } diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php index cd79559be5ca35ba981943d8c0f46134c86421f0..6dbefdbb1dfdaab1d0c8c98a1d8bb0cd40f8d7ba 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist.php @@ -54,38 +54,16 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_formKey; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param \Magento\Data\Form\FormKey $formKey * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -97,16 +75,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_helperPool = $helperPool; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, diff --git a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php index d3ebf8e4bd19b16021f3adc64efef6c60887aaae..5a50c00c83932563771da6d77bca818b66f320f0 100644 --- a/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php +++ b/app/code/Magento/Wishlist/Block/Customer/Wishlist/Item/Options.php @@ -53,37 +53,15 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock ); /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Helper\Product\ConfigurationPool $helperPool, @@ -93,16 +71,6 @@ class Options extends \Magento\Wishlist\Block\AbstractBlock $this->_helperPool = $helperPool; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, diff --git a/app/code/Magento/Wishlist/Block/Share/Wishlist.php b/app/code/Magento/Wishlist/Block/Share/Wishlist.php index 1525ba5d71ce2f103f53602b9ed0e02f99a84776..7d6bd305531099b73acdcb66aab3a190fe012d15 100644 --- a/app/code/Magento/Wishlist/Block/Share/Wishlist.php +++ b/app/code/Magento/Wishlist/Block/Share/Wishlist.php @@ -49,37 +49,15 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock protected $_customerFactory; /** - * @param \Magento\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Config $catalogConfig - * @param \Magento\Registry $registry - * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Math\Random $mathRandom - * @param \Magento\Checkout\Helper\Cart $cartHelper - * @param \Magento\Wishlist\Helper\Data $wishlistHelper - * @param \Magento\Catalog\Helper\Product\Compare $compareProduct - * @param \Magento\Theme\Helper\Layout $layoutHelper - * @param \Magento\Catalog\Helper\Image $imageHelper + * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\App\Http\Context $httpContext * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Customer\Model\CustomerFactory $customerFactory * @param array $data * @param array $priceBlockTypes - * - * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\View\Element\Template\Context $context, - \Magento\Catalog\Model\Config $catalogConfig, - \Magento\Registry $registry, - \Magento\Tax\Helper\Data $taxData, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Math\Random $mathRandom, - \Magento\Checkout\Helper\Cart $cartHelper, - \Magento\Wishlist\Helper\Data $wishlistHelper, - \Magento\Catalog\Helper\Product\Compare $compareProduct, - \Magento\Theme\Helper\Layout $layoutHelper, - \Magento\Catalog\Helper\Image $imageHelper, + \Magento\Catalog\Block\Product\Context $context, \Magento\App\Http\Context $httpContext, \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Customer\Model\CustomerFactory $customerFactory, @@ -89,16 +67,6 @@ class Wishlist extends \Magento\Wishlist\Block\AbstractBlock $this->_customerFactory = $customerFactory; parent::__construct( $context, - $catalogConfig, - $registry, - $taxData, - $catalogData, - $mathRandom, - $cartHelper, - $wishlistHelper, - $compareProduct, - $layoutHelper, - $imageHelper, $httpContext, $productFactory, $data, diff --git a/app/code/Magento/Wishlist/Controller/AbstractController.php b/app/code/Magento/Wishlist/Controller/AbstractController.php index bf2a8b5055158320720082279338c2a1664acf0a..9e0455e83ba887a62abd0187492b32732d84c526 100644 --- a/app/code/Magento/Wishlist/Controller/AbstractController.php +++ b/app/code/Magento/Wishlist/Controller/AbstractController.php @@ -127,7 +127,7 @@ abstract class AbstractController extends \Magento\App\Action\Action if ($item->addToCart($cart, $isOwner)) { $addedItems[] = $item->getProduct(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $notSalable[] = $item; } elseif ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index b9c03c92aedb55ad02f3ca12423aed87889ee997..9fd3d969fc0f8aec3b7479c3dfe256828871a67c 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -70,6 +70,11 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements */ protected $_transportBuilder; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * @param \Magento\App\Action\Context $context * @param \Magento\Core\App\Action\FormKeyValidator $formKeyValidator @@ -77,6 +82,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements * @param \Magento\Wishlist\Model\Config $wishlistConfig * @param \Magento\App\Response\Http\FileFactory $fileResponseFactory * @param \Magento\Mail\Template\TransportBuilder $transportBuilder + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation */ public function __construct( \Magento\App\Action\Context $context, @@ -84,12 +90,14 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements \Magento\Registry $coreRegistry, \Magento\Wishlist\Model\Config $wishlistConfig, \Magento\App\Response\Http\FileFactory $fileResponseFactory, - \Magento\Mail\Template\TransportBuilder $transportBuilder + \Magento\Mail\Template\TransportBuilder $transportBuilder, + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_coreRegistry = $coreRegistry; $this->_wishlistConfig = $wishlistConfig; $this->_fileResponseFactory = $fileResponseFactory; $this->_transportBuilder = $transportBuilder; + $this->inlineTranslation = $inlineTranslation; parent::__construct($context, $formKeyValidator); } @@ -153,16 +161,16 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements if ($wishlistId) { $wishlist->load($wishlistId); } else { - $wishlist->loadByCustomer($customerId, true); + $wishlist->loadByCustomerId($customerId, true); } if (!$wishlist->getId() || $wishlist->getCustomerId() != $customerId) { $wishlist = null; - throw new \Magento\Core\Exception(__("The requested wish list doesn't exist.")); + throw new \Magento\Model\Exception(__("The requested wish list doesn't exist.")); } $this->_coreRegistry->register('wishlist', $wishlist); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); return false; } catch (\Exception $e) { @@ -242,7 +250,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $result = $wishlist->addNewItem($product, $buyRequest); if (is_string($result)) { - throw new \Magento\Core\Exception($result); + throw new \Magento\Model\Exception($result); } $wishlist->save(); @@ -271,7 +279,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $this->_objectManager->get('Magento\Escaper')->escapeUrl($referer) ); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( __('An error occurred while adding item to wish list: %1', $e->getMessage()) ); @@ -297,7 +305,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $item = $this->_objectManager->create('Magento\Wishlist\Model\Item'); $item->loadWithOptions($id); if (!$item->getId()) { - throw new \Magento\Core\Exception(__('We can\'t load the wish list item.')); + throw new \Magento\Model\Exception(__('We can\'t load the wish list item.')); } $wishlist = $this->_getWishlist($item->getWishlistId()); if (!$wishlist) { @@ -325,7 +333,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $this, $params ); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_redirect('*'); return; @@ -383,7 +391,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $message = __('%1 has been updated in your wish list.', $product->getName()); $this->messageManager->addSuccess($message); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addError(__('An error occurred while updating wish list.')); @@ -501,7 +509,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements try { $item->delete(); $wishlist->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError( __('An error occurred while deleting the item from wish list: %1', $e->getMessage()) ); @@ -593,7 +601,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $redirectUrl = $this->_redirect->getRefererUrl(); } $this->_objectManager->get('Magento\Wishlist\Helper\Data')->calculate(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $this->messageManager->addError(__('This product(s) is out of stock.')); } elseif ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_HAS_REQUIRED_OPTIONS) { @@ -633,7 +641,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements try { $item = $cart->getQuote()->getItemById($itemId); if (!$item) { - throw new \Magento\Core\Exception(__("The requested cart item doesn't exist.")); + throw new \Magento\Model\Exception(__("The requested cart item doesn't exist.")); } $productId = $item->getProductId(); @@ -649,7 +657,7 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $wishlistName = $this->_objectManager->get('Magento\Escaper')->escapeHtml($wishlist->getName()); $this->messageManager->addSuccess(__("%1 has been moved to wish list %2", $productName, $wishlistName)); $wishlist->save(); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { $this->messageManager->addException($e, __('We can\'t move the item to the wish list.')); @@ -727,9 +735,8 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements return; } - $translate = $this->_objectManager->get('Magento\TranslateInterface'); - /* @var $translate \Magento\TranslateInterface */ - $translate->setTranslateInline(false); + $this->inlineTranslation->suspend(); + $sent = 0; try { @@ -790,13 +797,13 @@ class Index extends \Magento\Wishlist\Controller\AbstractController implements $wishlist->setShared($wishlist->getShared() + $sent); $wishlist->save(); - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->_eventManager->dispatch('wishlist_share', array('wishlist' => $wishlist)); $this->messageManager->addSuccess(__('Your wish list has been shared.')); $this->_redirect('*/*', array('wishlist_id' => $wishlist->getId())); } catch (\Exception $e) { - $translate->setTranslateInline(true); + $this->inlineTranslation->resume(); $this->messageManager->addError($e->getMessage()); $this->_objectManager->get( 'Magento\Wishlist\Model\Session' diff --git a/app/code/Magento/Wishlist/Controller/Shared.php b/app/code/Magento/Wishlist/Controller/Shared.php index f2c204c3d83c976164d163f874816a235c5c7aef..b3dc3fcb2dfa810113375604d6136bef43cbd338 100644 --- a/app/code/Magento/Wishlist/Controller/Shared.php +++ b/app/code/Magento/Wishlist/Controller/Shared.php @@ -139,7 +139,7 @@ class Shared extends AbstractController if ($this->_objectManager->get('Magento\Checkout\Helper\Cart')->getShouldRedirectToCart()) { $redirectUrl = $this->_objectManager->get('Magento\Checkout\Helper\Cart')->getCartUrl(); } - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { if ($e->getCode() == \Magento\Wishlist\Model\Item::EXCEPTION_CODE_NOT_SALABLE) { $this->messageManager->addError(__('This product(s) is out of stock.')); } else { diff --git a/app/code/Magento/Wishlist/Helper/Data.php b/app/code/Magento/Wishlist/Helper/Data.php index 34958fb58507ecfefe68fa0f92bce7ae5c4137b4..648f786e8f08fa76980ce0c28ab3dcf8946936b0 100644 --- a/app/code/Magento/Wishlist/Helper/Data.php +++ b/app/code/Magento/Wishlist/Helper/Data.php @@ -204,7 +204,7 @@ class Data extends \Magento\App\Helper\AbstractHelper } else { $this->_wishlist = $this->_wishlistFactory->create(); if ($this->getCustomer()) { - $this->_wishlist->loadByCustomer($this->getCustomer()); + $this->_wishlist->loadByCustomerId($this->getCustomer()->getId()); } } } diff --git a/app/code/Magento/Wishlist/Model/Item.php b/app/code/Magento/Wishlist/Model/Item.php index cc0f431c3dab006f4bc49d424f8abf13c25bde5b..f147de4aa2d1518680d987807d7298c7564e0f26 100644 --- a/app/code/Magento/Wishlist/Model/Item.php +++ b/app/code/Magento/Wishlist/Model/Item.php @@ -42,7 +42,7 @@ use Magento\Wishlist\Model\Item\Option; use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\Resource\Item\Option\CollectionFactory; -class Item extends \Magento\Core\Model\AbstractModel implements +class Item extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\ItemInterface { const EXCEPTION_CODE_NOT_SALABLE = 901; @@ -144,7 +144,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * @param OptionFactory $wishlistOptFactory * @param CollectionFactory $wishlOptionCollectionFactory * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -158,7 +158,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements OptionFactory $wishlistOptFactory, CollectionFactory $wishlOptionCollectionFactory, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -230,14 +230,14 @@ class Item extends \Magento\Core\Model\AbstractModel implements * * @param Option $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _addOptionCode($option) { if (!isset($this->_optionsByCode[$option->getCode()])) { $this->_optionsByCode[$option->getCode()] = $option; } else { - throw new \Magento\Core\Exception(__('An item option with code %1 already exists.', $option->getCode())); + throw new \Magento\Model\Exception(__('An item option with code %1 already exists.', $option->getCode())); } return $this; } @@ -313,15 +313,15 @@ class Item extends \Magento\Core\Model\AbstractModel implements * Validate wish list item data * * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function validate() { if (!$this->getWishlistId()) { - throw new \Magento\Core\Exception(__('We can\'t specify a wish list.')); + throw new \Magento\Model\Exception(__('We can\'t specify a wish list.')); } if (!$this->getProductId()) { - throw new \Magento\Core\Exception(__('Cannot specify product.')); + throw new \Magento\Model\Exception(__('Cannot specify product.')); } return true; @@ -372,7 +372,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements /** * Retrieve item product instance * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return \Magento\Catalog\Model\Product */ public function getProduct() @@ -380,7 +380,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements $product = $this->_getData('product'); if (is_null($product)) { if (!$this->getProductId()) { - throw new \Magento\Core\Exception(__('Cannot specify product.')); + throw new \Magento\Model\Exception(__('Cannot specify product.')); } $product = $this->_productFactory->create()->setStoreId($this->getStoreId())->load($this->getProductId()); @@ -405,7 +405,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * @param \Magento\Checkout\Model\Cart $cart * @param bool $delete delete the item after successful add to cart * @return bool - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addToCart(\Magento\Checkout\Model\Cart $cart, $delete = false) { @@ -433,7 +433,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements } if (!$product->isSalable()) { - throw new \Magento\Core\Exception(null, self::EXCEPTION_CODE_NOT_SALABLE); + throw new \Magento\Model\Exception(null, self::EXCEPTION_CODE_NOT_SALABLE); } $buyRequest = $this->getBuyRequest(); @@ -661,7 +661,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements * * @param Option|\Magento\Object|array $option * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function addOption($option) { @@ -674,7 +674,7 @@ class Item extends \Magento\Core\Model\AbstractModel implements ->setProduct($option->getProduct()) ->setItem($this); } else { - throw new \Magento\Core\Exception(__('Invalid item option format.')); + throw new \Magento\Model\Exception(__('Invalid item option format.')); } $exOption = $this->getOptionByCode($option->getCode()); diff --git a/app/code/Magento/Wishlist/Model/Item/Option.php b/app/code/Magento/Wishlist/Model/Item/Option.php index e137b6259a0f7a27574c29e51d8c832cfe43ccc5..618c53abbd3b883d01a5c729d95d25dccfe2035e 100644 --- a/app/code/Magento/Wishlist/Model/Item/Option.php +++ b/app/code/Magento/Wishlist/Model/Item/Option.php @@ -29,7 +29,7 @@ namespace Magento\Wishlist\Model\Item; use Magento\Catalog\Model\Product; use Magento\Wishlist\Model\Item; -class Option extends \Magento\Core\Model\AbstractModel implements +class Option extends \Magento\Model\AbstractModel implements \Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface { /** diff --git a/app/code/Magento/Wishlist/Model/Observer.php b/app/code/Magento/Wishlist/Model/Observer.php index 4994f827ef15be66806891d84c8c61f2b6761f29..d2a00e3b79aa32ca0450cc437d06ee76fcc04f86 100644 --- a/app/code/Magento/Wishlist/Model/Observer.php +++ b/app/code/Magento/Wishlist/Model/Observer.php @@ -31,7 +31,7 @@ */ namespace Magento\Wishlist\Model; -class Observer extends \Magento\Core\Model\AbstractModel +class Observer extends \Magento\Model\AbstractModel { /** * Wishlist data @@ -68,7 +68,7 @@ class Observer extends \Magento\Core\Model\AbstractModel * @param \Magento\Customer\Model\Session $customerSession * @param WishlistFactory $wishlistFactory * @param \Magento\Message\ManagerInterface $messageManager - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param \Magento\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ @@ -80,7 +80,7 @@ class Observer extends \Magento\Core\Model\AbstractModel \Magento\Customer\Model\Session $customerSession, WishlistFactory $wishlistFactory, \Magento\Message\ManagerInterface $messageManager, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { @@ -103,7 +103,7 @@ class Observer extends \Magento\Core\Model\AbstractModel if (!$customerId) { return false; } - return $this->_wishlistFactory->create()->loadByCustomer($customerId, true); + return $this->_wishlistFactory->create()->loadByCustomerId($customerId, true); } /** @@ -172,7 +172,7 @@ class Observer extends \Magento\Core\Model\AbstractModel if ($this->_customerSession->isLoggedIn()) { $wishlist = $this->_wishlistFactory->create() - ->loadByCustomer($this->_customerSession->getCustomer(), true); + ->loadByCustomerId($this->_customerSession->getCustomerId(), true); } elseif ($sharedWishlist) { $wishlist = $this->_wishlistFactory->create()->loadByCode($sharedWishlist); } else { diff --git a/app/code/Magento/Wishlist/Model/Resource/Item.php b/app/code/Magento/Wishlist/Model/Resource/Item.php index a77b9c87689d508b6b21adcc62b17fd6ecdf9f92..0ed6419f89222fc5585ae03f2901f15e25f65b07 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource; -class Item extends \Magento\Core\Model\Resource\Db\AbstractDb +class Item extends \Magento\Model\Resource\Db\AbstractDb { /** * Initialize connection and define main table diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php index eaac0c3fcb090a7ee050adef9f87dda71a255302..abc5bdd144af5c2b8e82e379917964aabccfc086 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource\Item; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Product Visibility Filter to product collection flag diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Option.php b/app/code/Magento/Wishlist/Model/Resource/Item/Option.php index 84147c9728649e6fe64827ad5e17fbe4eb2e4444..fc44a53bf950f9574b350c34bb85434d07708fb9 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Option.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Option.php @@ -33,7 +33,7 @@ */ namespace Magento\Wishlist\Model\Resource\Item; -class Option extends \Magento\Core\Model\Resource\Db\AbstractDb +class Option extends \Magento\Model\Resource\Db\AbstractDb { /** * @return void diff --git a/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php index b8692269e51e6a6afc7ded763f8f46a4da85aef4..33e9dfb4bc746ff818fc18e82c013ef5d81bb6bd 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Item/Option/Collection.php @@ -37,7 +37,7 @@ namespace Magento\Wishlist\Model\Resource\Item\Option; use Magento\Catalog\Model\Product; use Magento\Wishlist\Model\Item; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Array of option ids grouped by item id diff --git a/app/code/Magento/Wishlist/Model/Resource/Wishlist.php b/app/code/Magento/Wishlist/Model/Resource/Wishlist.php index 58b6b4bccc07bc67f06250d664cf21c0123a14a2..cd727a342c0a3a2b5e0a7cdce2f43d530d7a12eb 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Resource/Wishlist.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource; -class Wishlist extends \Magento\Core\Model\Resource\Db\AbstractDb +class Wishlist extends \Magento\Model\Resource\Db\AbstractDb { /** * Store wishlist items count @@ -65,7 +65,7 @@ class Wishlist extends \Magento\Core\Model\Resource\Db\AbstractDb * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) diff --git a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php index f766a82d82735fe7422fa0c57e944bdd06f466a4..b22fe690c95d208bff6d9baa8d615a3cfc2a2121 100644 --- a/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php +++ b/app/code/Magento/Wishlist/Model/Resource/Wishlist/Collection.php @@ -34,7 +34,7 @@ */ namespace Magento\Wishlist\Model\Resource\Wishlist; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection extends \Magento\Model\Resource\Db\Collection\AbstractCollection { /** * Initialize resource diff --git a/app/code/Magento/Wishlist/Model/Wishlist.php b/app/code/Magento/Wishlist/Model/Wishlist.php index 0b7cd9cba33bc58378de45e2c15bbf61a341c896..1bb6fa98b8866a7bf655e377fe4f3a06ffcb18ab 100644 --- a/app/code/Magento/Wishlist/Model/Wishlist.php +++ b/app/code/Magento/Wishlist/Model/Wishlist.php @@ -25,7 +25,7 @@ */ namespace Magento\Wishlist\Model; -use Magento\Core\Exception; +use Magento\Model\Exception; use Magento\Customer\Model\Customer; use Magento\Wishlist\Model\Resource\Item\CollectionFactory; use Magento\Wishlist\Model\Resource\Wishlist as ResourceWishlist; @@ -43,7 +43,7 @@ use Magento\Wishlist\Model\Resource\Wishlist\Collection; * @method string getUpdatedAt() * @method \Magento\Wishlist\Model\Wishlist setUpdatedAt(string $value) */ -class Wishlist extends \Magento\Core\Model\AbstractModel implements \Magento\Object\IdentityInterface +class Wishlist extends \Magento\Model\AbstractModel implements \Magento\Object\IdentityInterface { /** * Cache tag @@ -180,23 +180,19 @@ class Wishlist extends \Magento\Core\Model\AbstractModel implements \Magento\Obj } /** - * Load wishlist by customer + * Load wishlist by customer id * - * @param Customer|int $customer + * @param int $customerId * @param bool $create Create wishlist if don't exists * @return $this */ - public function loadByCustomer($customer, $create = false) + public function loadByCustomerId($customerId, $create = false) { - if ($customer instanceof Customer) { - $customer = $customer->getId(); - } - - $customer = (int)$customer; + $customerId = (int)$customerId; $customerIdFieldName = $this->_getResource()->getCustomerIdFieldName(); - $this->_getResource()->load($this, $customer, $customerIdFieldName); + $this->_getResource()->load($this, $customerId, $customerIdFieldName); if (!$this->getId() && $create) { - $this->setCustomerId($customer); + $this->setCustomerId($customerId); $this->setSharingCode($this->_getSharingRandomCode()); $this->save(); } diff --git a/app/design/adminhtml/magento_backend/css/admin.css b/app/design/adminhtml/magento_backend/css/admin.css index b42a4da9d2654ed88c89f47fbf54d580520035db..f35e355d900341a23b8a9ab9c3fca2ea0de1d943 100644 --- a/app/design/adminhtml/magento_backend/css/admin.css +++ b/app/design/adminhtml/magento_backend/css/admin.css @@ -131,7 +131,7 @@ button.primary, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -256,9 +256,9 @@ button.primary:active, .catalog-search-index .page-actions .add:hover, .catalog-search-index .page-actions .add:focus, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:hover, -.catalog-product-review-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:hover, +.review-product-index .page-actions .add:focus, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:hover, .catalog-rule-promo-catalog-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:active, @@ -405,7 +405,7 @@ button.primary:active, .adminhtml-catalog-event-index .page-actions .add:active, .adminhtml-urlrewrite-index .page-actions .add:active, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:active, .sales-rule-promo-quote-index .page-actions .add:active, .adminhtml-reminder-index .page-actions .add:active, @@ -470,7 +470,7 @@ button.primary:visited, .adminhtml-catalog-event-index .page-actions .add:visited, .adminhtml-urlrewrite-index .page-actions .add:visited, .catalog-search-index .page-actions .add:visited, -.catalog-product-review-index .page-actions .add:visited, +.review-product-index .page-actions .add:visited, .catalog-rule-promo-catalog-index .page-actions .add:visited, .sales-rule-promo-quote-index .page-actions .add:visited, .adminhtml-reminder-index .page-actions .add:visited, @@ -557,8 +557,8 @@ button.primary.disabled, .adminhtml-urlrewrite-index .page-actions .add.disabled, .catalog-search-index .page-actions .add[disabled], .catalog-search-index .page-actions .add.disabled, -.catalog-product-review-index .page-actions .add[disabled], -.catalog-product-review-index .page-actions .add.disabled, +.review-product-index .page-actions .add[disabled], +.review-product-index .page-actions .add.disabled, .catalog-rule-promo-catalog-index .page-actions .add[disabled], .catalog-rule-promo-catalog-index .page-actions .add.disabled, .sales-rule-promo-quote-index .page-actions .add[disabled], @@ -731,10 +731,10 @@ button.primary.disabled:active, .catalog-search-index .page-actions .add.disabled:hover, .catalog-search-index .page-actions .add[disabled]:active, .catalog-search-index .page-actions .add.disabled:active, -.catalog-product-review-index .page-actions .add[disabled]:hover, -.catalog-product-review-index .page-actions .add.disabled:hover, -.catalog-product-review-index .page-actions .add[disabled]:active, -.catalog-product-review-index .page-actions .add.disabled:active, +.review-product-index .page-actions .add[disabled]:hover, +.review-product-index .page-actions .add.disabled:hover, +.review-product-index .page-actions .add[disabled]:active, +.review-product-index .page-actions .add.disabled:active, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, .catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, @@ -914,7 +914,7 @@ button.primary, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -989,8 +989,8 @@ button.primary:hover, .adminhtml-urlrewrite-index .page-actions .add:hover, .catalog-search-index .page-actions .add:focus, .catalog-search-index .page-actions .add:hover, -.catalog-product-review-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:hover, +.review-product-index .page-actions .add:focus, +.review-product-index .page-actions .add:hover, .catalog-rule-promo-catalog-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:hover, .sales-rule-promo-quote-index .page-actions .add:focus, @@ -1090,7 +1090,7 @@ button.primary:active, .adminhtml-catalog-event-index .page-actions .add:active, .adminhtml-urlrewrite-index .page-actions .add:active, .catalog-search-index .page-actions .add:active, -.catalog-product-review-index .page-actions .add:active, +.review-product-index .page-actions .add:active, .catalog-rule-promo-catalog-index .page-actions .add:active, .sales-rule-promo-quote-index .page-actions .add:active, .adminhtml-reminder-index .page-actions .add:active, @@ -1150,7 +1150,7 @@ button.primary:visited, .adminhtml-catalog-event-index .page-actions .add:visited, .adminhtml-urlrewrite-index .page-actions .add:visited, .catalog-search-index .page-actions .add:visited, -.catalog-product-review-index .page-actions .add:visited, +.review-product-index .page-actions .add:visited, .catalog-rule-promo-catalog-index .page-actions .add:visited, .sales-rule-promo-quote-index .page-actions .add:visited, .adminhtml-reminder-index .page-actions .add:visited, @@ -1253,10 +1253,10 @@ button.primary.disabled:active, .catalog-search-index .page-actions .add.disabled:hover, .catalog-search-index .page-actions .add[disabled]:active, .catalog-search-index .page-actions .add.disabled:active, -.catalog-product-review-index .page-actions .add[disabled]:hover, -.catalog-product-review-index .page-actions .add.disabled:hover, -.catalog-product-review-index .page-actions .add[disabled]:active, -.catalog-product-review-index .page-actions .add.disabled:active, +.review-product-index .page-actions .add[disabled]:hover, +.review-product-index .page-actions .add.disabled:hover, +.review-product-index .page-actions .add[disabled]:active, +.review-product-index .page-actions .add.disabled:active, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:hover, .catalog-rule-promo-catalog-index .page-actions .add.disabled:hover, .catalog-rule-promo-catalog-index .page-actions .add[disabled]:active, @@ -1428,7 +1428,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add, .adminhtml-urlrewrite-index .page-actions .add, .catalog-search-index .page-actions .add, -.catalog-product-review-index .page-actions .add, +.review-product-index .page-actions .add, .catalog-rule-promo-catalog-index .page-actions .add, .sales-rule-promo-quote-index .page-actions .add, .adminhtml-reminder-index .page-actions .add, @@ -1479,7 +1479,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add:focus, .adminhtml-urlrewrite-index .page-actions .add:focus, .catalog-search-index .page-actions .add:focus, -.catalog-product-review-index .page-actions .add:focus, +.review-product-index .page-actions .add:focus, .catalog-rule-promo-catalog-index .page-actions .add:focus, .sales-rule-promo-quote-index .page-actions .add:focus, .adminhtml-reminder-index .page-actions .add:focus, @@ -1525,7 +1525,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add > span, .adminhtml-urlrewrite-index .page-actions .add > span, .catalog-search-index .page-actions .add > span, -.catalog-product-review-index .page-actions .add > span, +.review-product-index .page-actions .add > span, .catalog-rule-promo-catalog-index .page-actions .add > span, .sales-rule-promo-quote-index .page-actions .add > span, .adminhtml-reminder-index .page-actions .add > span, @@ -1574,7 +1574,7 @@ button.primary.disabled:active, .adminhtml-catalog-event-index .page-actions .add > span:before, .adminhtml-urlrewrite-index .page-actions .add > span:before, .catalog-search-index .page-actions .add > span:before, -.catalog-product-review-index .page-actions .add > span:before, +.review-product-index .page-actions .add > span:before, .catalog-rule-promo-catalog-index .page-actions .add > span:before, .sales-rule-promo-quote-index .page-actions .add > span:before, .adminhtml-reminder-index .page-actions .add > span:before, @@ -1634,7 +1634,7 @@ button.primary.disabled:active, .eq-ie9 .adminhtml-catalog-event-index .page-actions .add > span:before, .eq-ie9 .adminhtml-urlrewrite-index .page-actions .add > span:before, .eq-ie9 .catalog-search-index .page-actions .add > span:before, -.eq-ie9 .catalog-product-review-index .page-actions .add > span:before, +.eq-ie9 .review-product-index .page-actions .add > span:before, .eq-ie9 .catalog-rule-promo-catalog-index .page-actions .add > span:before, .eq-ie9 .sales-rule-promo-quote-index .page-actions .add > span:before, .eq-ie9 .adminhtml-reminder-index .page-actions .add > span:before, @@ -6291,7 +6291,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .col-1-layout, .adminhtml-urlrewrite-index .col-1-layout, .catalog-search-index .col-1-layout, -.catalog-product-review-index .col-1-layout, +.review-product-index .col-1-layout, .catalog-rule-promo-catalog-index .col-1-layout, .sales-rule-promo-quote-index .col-1-layout, .adminhtml-reminder-index .col-1-layout, @@ -6374,7 +6374,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .grid-actions, .adminhtml-urlrewrite-index .grid-actions, .catalog-search-index .grid-actions, -.catalog-product-review-index .grid-actions, +.review-product-index .grid-actions, .catalog-rule-promo-catalog-index .grid-actions, .sales-rule-promo-quote-index .grid-actions, .adminhtml-reminder-index .grid-actions, @@ -6418,7 +6418,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .page-actions.fixed, .adminhtml-urlrewrite-index .page-actions.fixed, .catalog-search-index .page-actions.fixed, -.catalog-product-review-index .page-actions.fixed, +.review-product-index .page-actions.fixed, .catalog-rule-promo-catalog-index .page-actions.fixed, .sales-rule-promo-quote-index .page-actions.fixed, .adminhtml-reminder-index .page-actions.fixed, @@ -6463,7 +6463,7 @@ table .col-draggable .draggable-handle { .adminhtml-catalog-event-index .page-actions, .adminhtml-urlrewrite-index .page-actions, .catalog-search-index .page-actions, -.catalog-product-review-index .page-actions, +.review-product-index .page-actions, .catalog-rule-promo-catalog-index .page-actions, .sales-rule-promo-quote-index .page-actions, .adminhtml-reminder-index .page-actions, diff --git a/app/etc/di.xml b/app/etc/di.xml index 4e9b0158b602892a7bce75afc76db3be76c91f8e..189debd0ccdc805bf3cad44179dbbeb02d1635b7 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -30,7 +30,6 @@ <preference for="Magento\App\RouterListInterface" type="Magento\App\RouterList" /> <preference for="Magento\App\FrontControllerInterface" type="Magento\App\FrontController" /> <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updater" /> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> <preference for="Magento\App\CacheInterface" type="Magento\App\Cache\Proxy" /> <preference for="Magento\App\Cache\StateInterface" type="Magento\App\Cache\State" /> <preference for="Magento\App\Cache\TypeListInterface" type="Magento\App\Cache\TypeList" /> @@ -87,7 +86,12 @@ <preference for="Magento\Mview\ProcessorInterface" type="Magento\Mview\Processor" /> <preference for="Magento\Mview\View\CollectionInterface" type="Magento\Mview\View\Collection" /> <preference for="Magento\Mview\View\SubscriptionInterface" type="Magento\Mview\View\Subscription" /> - <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> + <preference for="Magento\Mview\View\ChangelogInterface" type="Magento\Mview\View\Changelog" /> + <type name="Magento\Model\Context"> + <arguments> + <argument name="actionValidator" xsi:type="object">Magento\Model\ActionValidator\RemoveAction\Proxy</argument> + </arguments> + </type> <type name="Magento\Message\Manager"> <arguments> <argument name="session" xsi:type="object">Magento\Message\Session\Proxy</argument> @@ -141,12 +145,12 @@ </type> <type name="Magento\Module\Declaration\Reader\Filesystem"> <arguments> - <argument name="allowedModules" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_ALLOWED_MODULES</argument> + <argument name="allowedModules" xsi:type="init_parameter">Magento\Module\Declaration\Reader\Filesystem::PARAM_ALLOWED_MODULES</argument> </arguments> </type> <type name="Magento\App\Cache\Frontend\Factory"> <arguments> - <argument name="enforcedOptions" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_CACHE_FORCED_OPTIONS</argument> + <argument name="enforcedOptions" xsi:type="init_parameter">Magento\App\Cache\Frontend\Factory::PARAM_CACHE_FORCED_OPTIONS</argument> <argument name="decorators" xsi:type="array"> <item name="tag" xsi:type="array"> <item name="class" xsi:type="string">Magento\Cache\Frontend\Decorator\TagScope</item> @@ -160,19 +164,26 @@ </type> <type name="Magento\App\Cache\State"> <arguments> - <argument name="banAll" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_BAN_CACHE</argument> + <argument name="banAll" xsi:type="init_parameter">Magento\App\Cache\State::PARAM_BAN_CACHE</argument> </arguments> </type> <type name="Magento\Core\Model\StoreManager"> <arguments> - <argument name="scopeCode" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_RUN_CODE</argument> - <argument name="scopeType" xsi:type="init_parameter">Magento\Core\Model\App::PARAM_RUN_TYPE</argument> + <argument name="scopeCode" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_CODE</argument> + <argument name="scopeType" xsi:type="init_parameter">Magento\Core\Model\StoreManager::PARAM_RUN_TYPE</argument> </arguments> </type> <type name="Magento\Translate"> <arguments> <argument name="cache" xsi:type="object">Magento\App\Cache\Type\Translate</argument> <argument name="locale" xsi:type="object">Magento\Locale\Resolver\Proxy</argument> + <argument name="translate" xsi:type="object">Magento\Translate\ResourceInterface\Proxy</argument> + <argument name="request" xsi:type="object">Magento\App\Request\Http\Proxy</argument> + </arguments> + </type> + <type name="Magento\App\Helper\Context"> + <arguments> + <argument name="translateInline" xsi:type="object">Magento\Translate\InlineInterface\Proxy</argument> </arguments> </type> <type name="Magento\Data\Structure" shared="false" /> @@ -326,7 +337,7 @@ </type> <type name="Magento\Mview\View"> <arguments> - <argument name="state" xsi:type="object" shared="false">Magento\Core\Model\Mview\View\State</argument> + <argument name="state" xsi:type="object" shared="false">Magento\Indexer\Model\Mview\View\State</argument> <argument name="changelog" xsi:type="object" shared="false">Magento\Mview\View\Changelog</argument> </arguments> </type> @@ -368,4 +379,9 @@ </argument> </arguments> </type> + <type name="Magento\Translate\Inline"> + <arguments> + <argument name="parser" xsi:type="object">Magento\Translate\Inline\ParserInterface\Proxy</argument> + </arguments> + </type> </config> diff --git a/app/etc/local.xml.template b/app/etc/local.xml.template index a54acc9e4a5f9a362f462b7114f7aadaf4fc9d8b..5c517a2403da27937da281acb6b2412fafd5e548 100644 --- a/app/etc/local.xml.template +++ b/app/etc/local.xml.template @@ -55,7 +55,7 @@ <!-- DB model layer. Used to determine names of resource helpers and specific installs/upgrades for a DB vendor. --> <model>{{db_model}}</model> - <adapter>Magento\Core\Model\Resource\Type\Db\Pdo\Mysql</adapter> + <adapter>Magento\Model\Resource\Type\Db\Pdo\Mysql</adapter> <!-- Connection activation. Default connection is last level of fallback, thus it must be always left active. --> <active>1</active> diff --git a/dev/shell/indexer.php b/dev/shell/indexer.php index 7ac4fca66c177a8a27a88ad93a854e7e7ddac171..5de788f9c0cc16e174d84da4e6230f417951d059 100644 --- a/dev/shell/indexer.php +++ b/dev/shell/indexer.php @@ -25,9 +25,11 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/dev/shell/log.php b/dev/shell/log.php index b026dc0330dce4a305082249e3f13824f4e56c88..87a85315b0f36501f35f33fc391b01a59ddf1e26 100644 --- a/dev/shell/log.php +++ b/dev/shell/log.php @@ -25,9 +25,12 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); + $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); $entryPoint->run('Magento\Log\App\Shell', array('entryFileName' => basename(__FILE__))); diff --git a/dev/shell/newindexer.php b/dev/shell/newindexer.php index 5aba5c90f7506fca2b86437dfe85f4db588b356d..d6ecda69728081b34a4eaedb3b12f1cbd0b8fb30 100644 --- a/dev/shell/newindexer.php +++ b/dev/shell/newindexer.php @@ -25,9 +25,11 @@ */ require_once __DIR__ . '/../../app/bootstrap.php'; +use Magento\Core\Model\StoreManager; + $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store' + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store' ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/dev/tests/integration/framework/Magento/TestFramework/App.php b/dev/tests/integration/framework/Magento/TestFramework/App.php deleted file mode 100644 index ad1a721139913effbee4d6e5aabf4385495551c8..0000000000000000000000000000000000000000 --- a/dev/tests/integration/framework/Magento/TestFramework/App.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\TestFramework; - -/** - * App class for integration test framework - */ -class App extends \Magento\Core\Model\App -{ - public function loadArea($code) - { - $area = $this->getArea($code); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode($code); - $area->load(); - } -} diff --git a/dev/tests/integration/framework/Magento/TestFramework/Application.php b/dev/tests/integration/framework/Magento/TestFramework/Application.php index 55c422a26f9af2c055e88ca91d1c7a1e06e66a19..237f60f66b1e77b09056887444e164dbebbfbea6 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Application.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Application.php @@ -231,8 +231,7 @@ class Application $objectManager->configure( array( 'preferences' => array( - 'Magento\App\State' => 'Magento\TestFramework\App\State', - 'Magento\Core\Model\App' => 'Magento\TestFramework\App' + 'Magento\App\State' => 'Magento\TestFramework\App\State' ) ) ); @@ -253,7 +252,7 @@ class Application ); $this->loadArea(\Magento\TestFramework\Application::DEFAULT_APP_AREA); - \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\Renderer\Placeholder')); + \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\RendererInterface')); /** @var \Magento\App\Filesystem\DirectoryList\Verification $verification */ $verification = $objectManager->get('Magento\App\Filesystem\DirectoryList\Verification'); @@ -346,12 +345,8 @@ class Application /* Initialize an application in non-installed mode */ $this->initialize(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - 'install', - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('install')->load(\Magento\Core\Model\App\Area::PART_CONFIG); /* Run all install and data-install scripts */ /** @var $updater \Magento\Module\Updater */ @@ -518,11 +513,11 @@ class Application $areaCode ) ); - $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); + $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList'); if ($areaCode == \Magento\TestFramework\Application::DEFAULT_APP_AREA) { - $app->loadAreaPart($areaCode, \Magento\Core\Model\App\Area::PART_CONFIG); + $app->getArea($areaCode)->load(\Magento\Core\Model\App\Area::PART_CONFIG); } else { - $app->loadArea($areaCode); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($areaCode); } } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php b/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php index a4b7b4475934aedec0a57827475a8ac5194e2e3f..f5807f9f2ac070f68176a32a401ae2ff710ac22c 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php @@ -25,7 +25,7 @@ */ namespace Magento\TestFramework\Db; -class ConnectionAdapter extends \Magento\Core\Model\Resource\Type\Db\Pdo\Mysql +class ConnectionAdapter extends \Magento\Model\Resource\Type\Db\Pdo\Mysql { /** * Retrieve DB adapter class name diff --git a/dev/tests/integration/framework/Magento/TestFramework/Entity.php b/dev/tests/integration/framework/Magento/TestFramework/Entity.php index 318dfbe561273711f898b4bb5d42b862aedea3f8..b579163a30e651d5b3ff558cbde7d76d3a2712c6 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Entity.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Entity.php @@ -26,20 +26,20 @@ */ /** - * Class that implements CRUP tests for \Magento\Core\Model\AbstractModel based objects + * Class that implements CRUP tests for \Magento\Model\AbstractModel based objects */ namespace Magento\TestFramework; class Entity { /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $_model; protected $_updateData; - public function __construct(\Magento\Core\Model\AbstractModel $model, array $updateData) + public function __construct(\Magento\Model\AbstractModel $model, array $updateData) { $this->_model = $model; $this->_updateData = $updateData; @@ -59,7 +59,7 @@ class Entity } /** - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _getEmptyModel() { diff --git a/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php b/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php index 140f0dd2c097a9a53983cccaacfd857825c3f9d5..024c4cf05cbf8b5b47a94632980f687f849733a5 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Helper/Bootstrap.php @@ -177,4 +177,14 @@ class Bootstrap { return $this->_bootstrap; } + + /** + * Load area + * @param string $areaCode + */ + public function loadArea($areaCode) + { + self::$_objectManager->get('Magento\App\State')->setAreaCode($areaCode); + self::$_objectManager->get('Magento\App\AreaList')->getArea($areaCode)->load(); + } } diff --git a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php index 06c4db3428b1c8f6a4bab0ada8a11a1501f4d0e0..0690631c2a16506e4a697a2b97249a96d29b4734 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php +++ b/dev/tests/integration/framework/Magento/TestFramework/TestCase/AbstractController.php @@ -116,7 +116,7 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase /** * Request getter * - * @return \Magento\App\RequestInterface + * @return \Magento\TestFramework\Request */ public function getRequest() { @@ -129,7 +129,7 @@ abstract class AbstractController extends \PHPUnit_Framework_TestCase /** * Response getter * - * @return \Magento\App\ResponseInterface + * @return \Magento\TestFramework\Response */ public function getResponse() { diff --git a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php index 3f6efda1e69b4154001ef40a5983f7a04c49c964..32a6b2d77e388d6ebaf332fe03de13123948034f 100644 --- a/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php +++ b/dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/EntityTest.php @@ -29,7 +29,7 @@ namespace Magento\Test; class EntityTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -79,7 +79,7 @@ class EntityTest extends \PHPUnit_Framework_TestCase $this->setExpectedException($expectedException); $this->_model = $this->getMock( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array('load', 'save', 'delete', 'getIdFieldName', '__wakeup'), array(), '', diff --git a/dev/tests/integration/phpunit.xml.dist b/dev/tests/integration/phpunit.xml.dist index 3fa1f5dd9865a534592ab00e9b86f014aede2977..2477b7ef3c420ad808ed19fafb778153cbf4a2db 100644 --- a/dev/tests/integration/phpunit.xml.dist +++ b/dev/tests/integration/phpunit.xml.dist @@ -41,14 +41,12 @@ </testsuites> <!-- Code coverage filters --> <filter> - <whitelist> - <!-- All CE modules --> + <whitelist addUncoveredFilesFromWhiteList="true"> <directory suffix=".php">../../../app/code/Magento</directory> + <directory suffix=".php">../../../lib/Magento</directory> <exclude> - <!-- Excluding installation and upgrade scripts --> - <directory>../../../app/code/Magento/*/sql</directory> - <!-- Excluding data installation and upgrade scripts --> - <directory>../../../app/code/Magento/*/data</directory> + <directory suffix=".php">../../../app/code/Magento/*/sql</directory> + <directory suffix=".php">../../../app/code/Magento/*/data</directory> </exclude> </whitelist> </filter> @@ -57,7 +55,7 @@ <includePath>.</includePath> <ini name="date.timezone" value="America/Los_Angeles"/> <ini name="xdebug.max_nesting_level" value="200"/> - <ini name="memory_limit" value="2048M"/> + <ini name="memory_limit" value="4096M"/> <!-- Local XML configuration file ('.dist' extension will be added, if the specified file doesn't exist) --> <const name="TESTS_LOCAL_CONFIG_FILE" value="etc/local-mysql.xml"/> <!-- Semicolon-separated 'glob' patterns, that match global XML configuration files --> diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php index d770ead3f318e3465e7f218415eda5011de381f9..80d5dd29b23784ea47d11eec4ca28e9639a9fe18 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/System/Config/FormTest.php @@ -25,6 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Backend\Block\System\Config; +use Magento\App\Cache\State; /** * @magentoAppArea adminhtml @@ -251,20 +252,15 @@ class FormTest extends \PHPUnit_Framework_TestCase */ protected function _setupFieldsInheritCheckbox($useConfigField, $isConfigDataEmpty, $configDataValue) { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array(\Magento\Core\Model\App::PARAM_BAN_CACHE => true) - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Config\ScopeInterface' - )->setCurrentScope( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + State::PARAM_BAN_CACHE => true, + )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Config\ScopeInterface') + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); $fileResolverMock = $this->getMockBuilder( 'Magento\Core\Model\Config\FileResolver' diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php index 23331fa9de28774558ede70a108a028ba66247fe..d4126a6b6cb37a5ad6d0e24f29aa7733cdc97201 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/Widget/Grid/MassactionTest.php @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ namespace Magento\Backend\Block\Widget\Grid; - +use Magento\Core\Model\StoreManager; /** * @magentoDataFixture Magento/Backend/Block/_files/backend_theme.php * @@ -67,15 +67,13 @@ class MassactionTest extends \PHPUnit_Framework_TestCase */ protected function _setFixtureTheme() { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', - \Magento\Core\Model\App::PARAM_RUN_TYPE => 'store', - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/../../_files/design') - ) - ) - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + StoreManager::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_TYPE => 'store', + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => __DIR__ . '/../../_files/design') + ), + )); } /** diff --git a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php index 2c76ae39c8338710f7280e7845b9608dbe910bdf..f0e47ab05bacbb1e0be51358c01a645618ed730b 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Block/_files/backend_theme.php @@ -22,13 +22,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** @var $registration \Magento\Core\Model\Theme\Registration */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\Theme\Registration'); +$registration->register( + __DIR__ . '/design', + '*/*/theme.xml' ); -$registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Theme\Registration' -); -$registration->register(__DIR__ . '/design', '*/*/theme.xml'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php index 21912f882d13fc09d64f7e5497858028254ad7b1..369e00ff6c94dc3c778abacd6373f1fe9743b6b9 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Controller/Adminhtml/AuthTest.php @@ -128,9 +128,7 @@ class AuthTest extends \Magento\TestFramework\TestCase\AbstractController $this->dispatch('backend/admin/index/index'); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertTrue($code >= 300 && $code < 400, 'Incorrect response code'); diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php index 50a44f70e0757b7ce5754e50d77a56d7a18a890a..7a445822d2f6f45e76260918fdb9231b1e751a75 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/AuthTest.php @@ -42,14 +42,10 @@ class AuthTest extends \PHPUnit_Framework_TestCase { parent::setUp(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Backend\Model\Auth' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Backend\Model\Auth'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index cde89d2f052d6afe6caf6acb36c4d0accbc2e7c4..f130e87a05c02f2ff7c4b61e08923bc61ad72109 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -117,7 +117,7 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase * @param string $path * @param string $value * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @dataProvider validationExceptionDataProvider */ public function testValidationException($path, $value) diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php index 1e5eb35f7b1ea1bea277f55b390d0ecbdb496ce7..d395b6ef718a519d921066a2b45143a69e770e2a 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/Config/Backend/Image/AdapterTest.php @@ -42,7 +42,7 @@ class AdapterTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * expectedExceptionMessage The specified image adapter cannot be used because of some missed dependencies. * @magentoDbIsolation enabled * @magentoAppIsolation enabled diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php index 82129c29d2dd7b3ee89a07ecf819b8301b422a3b..eb49b87ed336108058808e0abc3a8aca0be5b7d4 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/MenuTest.php @@ -41,19 +41,12 @@ class MenuTest extends \PHPUnit_Framework_TestCase protected function setUp() { parent::setUp(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Backend\Model\Auth' - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Config\ScopeInterface' - )->setCurrentScope( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Backend\Model\Auth'); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Config\ScopeInterface') + ->setCurrentScope(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); } public function testMenuItemManipulation() diff --git a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php index 7cb0ce99e77e32485091420d2658aaa35137847d..27961d87326dbebf7d69effd55992c20054602e0 100644 --- a/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Backend/Model/ObserverTest.php @@ -71,9 +71,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $observer = $this->_buildObserver(); $this->_model->actionPreDispatchAdmin($observer); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertTrue($code >= 300 && $code < 400); @@ -94,9 +92,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $observer = $this->_buildObserver(); $this->_model->actionPreDispatchAdmin($observer); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getResponse(); + $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\ResponseInterface'); $code = $response->getHttpResponseCode(); $this->assertFalse($code >= 300 && $code < 400); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php index fd73a81248b730546afe2ab9fa8dab32299a2d9e..df1eff680af346aa150f314f5593b4092c64f4e2 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/Block/Adminhtml/Catalog/Product/Edit/Tab/Bundle/Option/Search/GridTest.php @@ -33,11 +33,8 @@ class GridTest extends \PHPUnit_Framework_TestCase */ public function testToHtmlHasOnClick() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $layout \Magento\View\LayoutInterface */ $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Layout', diff --git a/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php b/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php index 59123f02fc8b3abd4c3df85fc115d5f230cd9b99..abd97027ec6d83bd8e4cb28f4c0f9ce075819d50 100644 --- a/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php +++ b/dev/tests/integration/testsuite/Magento/Captcha/_files/dummy_user.php @@ -28,11 +28,8 @@ /** * Create dummy user */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $user \Magento\User\Model\User */ $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php index b5a8ff217c8f353f81dafd0871c2451803580ff3..329b1529bb16dfebf8e854dbe724d1c2f7c95acc 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/NewTest.php @@ -40,7 +40,7 @@ class NewTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') + \Magento\TestFramework\Helper\Bootstrap::getInstance() ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Http\Context') ->setValue( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php index 4705f5fa8f8b4e8ce79efa54effada03136572ab..663b8090b624ce1c5080997f800ef5ca0de27dfe 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/CrosssellTest.php @@ -35,14 +35,10 @@ class CrosssellTest extends \PHPUnit_Framework_TestCase { public function testAll() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(2); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php index 8a4de53a87a6e17e332003ccb021cb2a7c693b95..03634ace170ba2d2f11e2c3674e92139aa9af2ad 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ProductList/RelatedTest.php @@ -35,14 +35,10 @@ class RelatedTest extends \PHPUnit_Framework_TestCase { public function testAll() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(2); /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php new file mode 100644 index 0000000000000000000000000000000000000000..96d9d0ac5f332b54a1505eada9b12482c19d8e3a --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Block/Product/SendTest.php @@ -0,0 +1,72 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Block\Product; + +use Magento\TestFramework\Helper\Bootstrap; +use Magento\Customer\Model\Session; + +class SendTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Send + */ + protected $block; + + /** + * @var Session + */ + protected $customerSession; + + protected function setUp() + { + $objectManager = Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\State')->setAreaCode('frontend'); + + $this->customerSession = $objectManager->get('Magento\Customer\Model\Session'); + $this->block = $objectManager->get('Magento\View\LayoutInterface') + ->createBlock( + 'Magento\Catalog\Block\Product\Send', + '', + ['customerSession' => $this->customerSession] + ); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetUserName() + { + $this->customerSession->setCustomerId(1); + $this->assertEquals('Firstname Lastname', $this->block->getUserName()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetEmail() + { + $this->customerSession->setCustomerId(1); + $this->assertEquals('customer@example.com', $this->block->getEmail()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php index 8152599f13be942f7241de3848a263527c6c04a7..489ef47e82ff44c0f47b4f1ac805c9fc2151c7ef 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/AttributeTest.php @@ -73,21 +73,21 @@ class AttributeTest extends \Magento\Backend\Utility\Controller } /** - * @magentoDataFixture Magento/Core/_files/db_translate_admin_store.php + * @magentoDataFixture Magento/Translation/_files/db_translate_admin_store.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/all_types_enabled.php * @magentoDataFixture Magento/Catalog/controllers/_files/attribute_user_defined.php * @magentoAppIsolation enabled */ public function testSaveActionCleanAttributeLabelCache() { - /** @var \Magento\Core\Model\Resource\Translate\String $string */ - $string = $this->_objectManager->create('Magento\Core\Model\Resource\Translate\String'); - $this->assertEquals($this->_translate('string to translate'), 'predefined string translation'); + /** @var \Magento\Translation\Model\Resource\String $string */ + $string = $this->_objectManager->create('Magento\Translation\Model\Resource\String'); + $this->assertEquals('predefined string translation', $this->_translate('string to translate')); $string->saveTranslate('string to translate', 'new string translation'); $postData = $this->_getAttributeData() + array('attribute_id' => 1); $this->getRequest()->setPost($postData); $this->dispatch('backend/catalog/product_attribute/save'); - $this->assertEquals($this->_translate('string to translate'), 'new string translation'); + $this->assertEquals('new string translation', $this->_translate('string to translate')); } /** @@ -105,9 +105,9 @@ class AttributeTest extends \Magento\Backend\Utility\Controller 1 ); /** @var \Magento\TranslateInterface $translate */ - $translate = $this->_objectManager->create('Magento\TranslateInterface'); - $translate->init(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, null, true); - return $translate->translate(array($string)); + $translate = $this->_objectManager->get('Magento\TranslateInterface'); + $translate->loadData(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, true); + return __($string); } /** diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php index 15c73dc4638f48c4f12e4cea793407b467e22bb1..a84d6b38e6859a335866cade79e23cba368e6d1b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/Product/ReviewTest.php @@ -42,7 +42,7 @@ class ReviewTest extends \Magento\Backend\Utility\Controller 1, 'entity_pk_value' )->getId(); - $this->dispatch('backend/catalog/product_review/edit/id/' . $reviewId); + $this->dispatch('backend/review/product/edit/id/' . $reviewId); $responseBody = $this->getResponse()->getBody(); $this->assertContains('<script>alert("xss");</script>', $responseBody); $this->assertNotContains('<script>alert("xss");</script>', $responseBody); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php index 55c9d3f96606b7c9547d5c6ac41f3fa4a7e28d64..d709a83cc9638f6419418ad6edd611d73dda1096 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php @@ -83,6 +83,23 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->_assertCompareListEquals(array(1)); } + public function testRemoveActionWithSession() + { + $this->_requireCustomerWithTwoProducts(); + + $this->dispatch('catalog/product_compare/remove/product/1'); + + /** @var $messageManager \Magento\Message\Manager */ + $messageManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Message\Manager'); + $this->assertInstanceOf('Magento\Message\Success', $messageManager->getMessages()->getLastAddedMessage()); + $this->assertContains('Simple Product 1 Name', + (string)$messageManager->getMessages()->getLastAddedMessage()->getText()); + + $this->assertRedirect(); + + $this->_assertCompareListEquals(array(2)); + } + public function testIndexActionDisplay() { $this->_requireVisitorWithTwoProducts(); @@ -211,6 +228,64 @@ class CompareTest extends \Magento\TestFramework\TestCase\AbstractController $this->_assertCompareListEquals(array(1, 2)); } + protected function _requireCustomerWithTwoProducts() + { + $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Customer'); + /** @var \Magento\Customer\Model\Customer $customer */ + $customer + ->setWebsiteId(1) + ->setId(1) + ->setEntityTypeId(1) + ->setAttributeSetId(1) + ->setEmail('customer@example.com') + ->setPassword('password') + ->setGroupId(1) + ->setStoreId(1) + ->setIsActive(1) + ->setFirstname('Firstname') + ->setLastname('Lastname') + ->setDefaultBilling(1) + ->setDefaultShipping(1) + ; + $customer->isObjectNew(true); + $customer->save(); + + /** @var $session \Magento\Customer\Model\Session */ + $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $session->setCustomerId(1); + + /** @var $visitor \Magento\Log\Model\Visitor */ + $visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); + $visitor->setSessionId(md5(time()) . md5(microtime())) + ->setLastVisitAt($dateTime->now()) + ->save(); + + /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ + $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\Item'); + $item->setVisitorId($visitor->getId()) + ->setCustomerId(1) + ->setProductId(1) + ->save(); + + /** @var $item \Magento\Catalog\Model\Product\Compare\Item */ + $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\Item'); + $item->setVisitorId($visitor->getId()) + ->setProductId(2) + ->save(); + + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Log\Model\Visitor') + ->load($visitor->getId()); + + $this->_assertCompareListEquals(array(1, 2)); + } + /** * Assert that current visitor has exactly expected products in compare list * diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..bf50deadd19bb6c5037c7d57bb8aa97229c14aea --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/CompositeTest.php @@ -0,0 +1,93 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Helper\Product; + +use Magento\Customer\Controller\RegistryConstants; +use Magento\Registry; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Test Composite + */ +class CompositeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Composite + */ + protected $helper; + + /** + * @var Registry + */ + protected $registry; + + protected function setUp() + { + $this->helper = Bootstrap::getObjectManager()->get('Magento\Catalog\Helper\Product\Composite'); + $this->registry = Bootstrap::getObjectManager()->get('Magento\Registry'); + } + + protected function tearDown() + { + $this->registry->unregister('composite_configure_result_error_message'); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER); + $this->registry->unregister('current_product'); + $this->registry->unregister('product'); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testRenderConfigureResult() + { + $configureResult = new \Magento\Object(); + $configureResult->setOk(true) + ->setProductId(1) + ->setCurrentCustomerId(1); + + $this->helper->renderConfigureResult($configureResult); + + $customerId = $this->registry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->assertEquals(1, $customerId); + $errorMessage = $this->registry->registry('composite_configure_result_error_message'); + $this->assertNull($errorMessage); + } + + public function testRenderConfigureResultNotOK() + { + $configureResult = new \Magento\Object(); + $configureResult->setError(true) + ->setMessage('Test Message'); + + $this->helper->renderConfigureResult($configureResult); + + $customerId = $this->registry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->assertNull($customerId); + $errorMessage = $this->registry->registry('composite_configure_result_error_message'); + $this->assertEquals('Test Message', $errorMessage); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php new file mode 100644 index 0000000000000000000000000000000000000000..944b4be6795231634f745619539ac56d0a44c786 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/PriceTest.php @@ -0,0 +1,65 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Helper\Product; + +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\TestFramework\Helper\Bootstrap; + +/** + * Test class for Magento\Catalog\Helper\Product\Price + */ +class PriceTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Helper\Product\Price + */ + protected $_helper; + + /** + * @var CustomerGroupServiceInterface CustomerAccountServiceInterface + */ + protected $_customerAccountService; + + protected function setUp() + { + $this->_helper = Bootstrap::getObjectManager()->get('Magento\Catalog\Helper\Product\Price'); + $this->_customerAccountService = Bootstrap::getObjectManager()->get( + 'Magento\Customer\Service\V1\CustomerAccountServiceInterface' + ); + + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testSetCustomer() + { + $customerData = $this->_customerAccountService->getCustomer(1); + $this->assertInstanceOf('Magento\Catalog\Helper\Product\Price', $this->_helper->setCustomer($customerData)); + $customerDataRetrieved = $this->_helper->getCustomer(); + $this->assertEquals($customerData->__toArray(), $customerDataRetrieved->__toArray()); + } + +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php index d03c3ce0bab88b7ee776566c70f8b69e07174d37..8c228f0b96ecede0290519984546050c47954643 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Helper/Product/ViewTest.php @@ -132,7 +132,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @magentoAppIsolation enabled */ public function testPrepareAndRenderWrongController() @@ -144,7 +144,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase /** * @magentoAppIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testPrepareAndRenderWrongProduct() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php index da1ae41fdd67d9c11a71373b5de1a701b2d65dff..504b447c66761085988ae4635818f1c0f9db7832 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryTreeTest.php @@ -97,7 +97,7 @@ class CategoryTreeTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testMoveWrongParent() { @@ -106,7 +106,7 @@ class CategoryTreeTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testMoveWrongId() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index 37b48822102b718ee8eedde7936dd85a70cdb6f9..d44ac5689cb1b7251c0445734764e99d0a526835 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -72,12 +72,11 @@ class RowTest extends \Magento\TestFramework\Indexer\TestCase */ public function testProductUpdate() { - $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\CategoryFactory' - ); - $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Block\Product\ListProduct' - ); + $this->markTestSkipped('Incomplete due to MAGETWO-21369'); + $categoryFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\CategoryFactory'); + $listProduct = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Block\Product\ListProduct'); $this->_processor->getIndexer()->setScheduled(false); $this->assertFalse( diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php index 6ca3b3b07dd7f51a06d385d3b4d1b2905e3544ed..a08681eed03b49b2c09b001b9ac51b5ce2a0204d 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/CategoryTest.php @@ -150,7 +150,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase ->create('Magento\Catalog\Model\Layer\Category'); $model->setCurrentCategory(new \Magento\Object()); $this->fail('Assign category of invalid class.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { } try { @@ -159,7 +159,7 @@ class CategoryTest extends \PHPUnit_Framework_TestCase $model->setCurrentCategory(\Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Catalog\Model\Category')); $this->fail('Assign category with invalid id.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php index a055f201ea33be438e321947e1a3b12ca75fe2fd..4d7e45a7d4beba9d4e7be3d6e08a413c169a8726 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php @@ -59,7 +59,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetFilterException() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php index 039725871b9ef5c201cdeb268cb7aa64dd2e5eb8..274000f36d166643bf0b16b6d99add38617e1b4b 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/TierpriceTest.php @@ -66,7 +66,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDuplicate() { @@ -82,7 +82,7 @@ class TierpriceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDuplicateWebsite() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b2190e5060251c2fd49ccbbe1456dda203c094ea --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Compare/ListCompareTest.php @@ -0,0 +1,88 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Product\Compare; + +/** + * @magentoDataFixture Magento/Catalog/_files/product_simple.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ +class ListCompareTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Catalog\Model\Product\Compare\ListCompare + */ + protected $_model; + + /** + * @var \Magento\Log\Model\Visitor + */ + protected $_visitor; + + /** @var \Magento\Customer\Model\Session */ + protected $_session; + + protected function setUp() + { + /** @var $session \Magento\Customer\Model\Session */ + $this->_session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $this->_visitor = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor'); + /** @var \Magento\Stdlib\DateTime $dateTime */ + $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); + $this->_visitor->setSessionId(md5(time()) . md5(microtime())) + ->setLastVisitAt($dateTime->now()) + ->save(); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product\Compare\ListCompare', ['logVisitor' => $this->_visitor]); + } + + protected function tearDown() + { + $this->_session->setCustomerId(null); + } + + public function testAddProductWithSession() + { + $this->_session->setCustomerId(1); + /** @var $product \Magento\Catalog\Model\Product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product') + ->load(1); + $this->_model->addProduct($product); + $this->assertTrue($this->_model->hasItems(1, $this->_visitor->getId())); + } + + public function testAddProductWithoutSession() + { + /** @var $product \Magento\Catalog\Model\Product */ + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product') + ->load(1); + $this->_model->addProduct($product); + $this->assertFalse($this->_model->hasItems(1, $this->_visitor->getId())); + $this->assertTrue($this->_model->hasItems(0, $this->_visitor->getId())); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php index 717c91cb6f1bbe850fadd6467acfaf74aabe4b13..abc83afbef278e87533e8be349245369574e6429 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Type/AbstractTest.php @@ -247,7 +247,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Catalog/_files/product_simple.php - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCheckProductBuyStateException() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php index 29fdd966c805280d36886bfc90f0c0a459a05e4c..fb2e8b2c25ac8558c28f097fd28318cd5ec876ad 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/ProductTest.php @@ -110,21 +110,13 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testCleanCache() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->saveCache( - 'test', - 'catalog_product_999', - array('catalog_product_999') - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->save('test', 'catalog_product_999', array('catalog_product_999')); // potential bug: it cleans by cache tags, generated from its ID, which doesn't make much sense $this->_model->setId(999)->cleanCache(); $this->assertFalse( - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - 'catalog_product_999' - ) + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load('catalog_product_999') ); } @@ -216,7 +208,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** * Delete model * - * @param \Magento\Core\Model\AbstractModel $duplicate + * @param \Magento\Model\AbstractModel $duplicate */ protected function _undo($duplicate) { @@ -399,7 +391,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase /** * Check is model empty or not * - * @param \Magento\Core\Model\AbstractModel $model + * @param \Magento\Model\AbstractModel $model */ protected function _assertEmpty($model) { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php index 3910fc992d1d15c6290173f4cbedee820cfc39dc..8b6ef68f0088705d6d9eb84154e049c88bf1da7a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/Product/CollectionTest.php @@ -26,6 +26,8 @@ */ namespace Magento\Catalog\Model\Resource\Product; +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + class CollectionTest extends \PHPUnit_Framework_TestCase { /** @@ -90,4 +92,21 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($expectedResult, $this->_collection->getColumnValues('request_path')); } + + /** + * @magentoDataFixture Magento/Catalog/Model/Resource/_files/product_simple.php + */ + public function testAddTierPriceData() + { + $this->_collection->setFlag('tier_price_added', false); + $this->_collection->addIdFilter(2); + $this->assertInstanceOf( + '\Magento\Catalog\Model\Resource\Product\Collection', + $this->_collection->addTierPriceData() + ); + $tierPrice = $this->_collection->getFirstItem()->getDataByKey('tier_price'); + $this->assertEquals(CustomerGroupServiceInterface::NOT_LOGGED_IN_ID, current($tierPrice)['cust_group']); + $this->assertEquals(CustomerGroupServiceInterface::CUST_GROUP_ALL, next($tierPrice)['cust_group']); + $this->assertTrue($this->_collection->getFlag('tier_price_added')); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php new file mode 100644 index 0000000000000000000000000000000000000000..1426f5ec5348cd0e123323b46dcf4aedfc56b218 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Resource/_files/product_simple.php @@ -0,0 +1,67 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Catalog + * @subpackage integration_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +use Magento\Customer\Service\V1\CustomerGroupServiceInterface; + +/** @var $product \Magento\Catalog\Model\Product */ +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); +$product->isObjectNew(true); +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(2) + ->setAttributeSetId(4) + ->setWebsiteIds(array(1)) + ->setName('Simple Products') + ->setSku('simple products') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrice( + array( + array( + 'website_id' => 0, + 'cust_group' => CustomerGroupServiceInterface::NOT_LOGGED_IN_ID, + 'price_qty' => 2, + 'price' => 8, + ), + array( + 'website_id' => 0, + 'cust_group' => CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 21, + 'price' => 81, + ) + ) + ) + ->setDescription('Description with <b>html tag</b>') + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + ->setUrlKey('url-key') + ->setUrlPath('url-key.html') + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php index 18e43419627cfff2ae14ac3efb80891915db9c8a..acc9d791f59d9c5b8f92b9d0189357b9daf491cd 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/UrlTest.php @@ -186,7 +186,7 @@ class UrlTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGeneratePathDefault() { diff --git a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php index 04fa15a5d3b709804a63645bce818f9388438a2e..d9cd3b8ea96ab884b113c179a1f044c632a0fb22 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/_files/product_simple.php @@ -18,147 +18,138 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Catalog - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** @var $product \Magento\Catalog\Model\Product */ -$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); +$product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->isObjectNew(true); -$product->setTypeId( - \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE -)->setId( - 1 -)->setAttributeSetId( - 4 -)->setWebsiteIds( - array(1) -)->setName( - 'Simple Product' -)->setSku( - 'simple' -)->setPrice( - 10 -)->setWeight( - 1 -)->setShortDescription( - "Short description" -)->setTaxClassId( - 0 -)->setTierPrice( - array( +$product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) + ->setId(1) + ->setAttributeSetId(4) + ->setWebsiteIds(array(1)) + ->setName('Simple Product') + ->setSku('simple') + ->setPrice(10) + ->setWeight(1) + ->setShortDescription("Short description") + ->setTaxClassId(0) + ->setTierPrice( array( - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'price_qty' => 2, - 'price' => 8 - ), - array( - 'website_id' => 0, - 'cust_group' => \Magento\Customer\Model\Group::CUST_GROUP_ALL, - 'price_qty' => 5, - 'price' => 5 + array( + 'website_id' => 0, + 'cust_group' => \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 2, + 'price' => 8, + ), + array( + 'website_id' => 0, + 'cust_group' => \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL, + 'price_qty' => 5, + 'price' => 5, + ), ) ) -)->setDescription( - 'Description with <b>html tag</b>' -)->setMetaTitle( - 'meta title' -)->setMetaKeyword( - 'meta keyword' -)->setMetaDescription( - 'meta description' -)->setVisibility( - \Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH -)->setStatus( - \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED -)->setCategoryIds( - array(2) -)->setStockData( - array('use_config_manage_stock' => 1, 'qty' => 100, 'is_qty_decimal' => 0, 'is_in_stock' => 1) -)->setCanSaveCustomOptions( - true -)->setProductOptions( - array( - array( - 'id' => 1, - 'option_id' => 0, - 'previous_group' => 'text', - 'title' => 'Test Field', - 'type' => 'field', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 1, - 'price_type' => 'fixed', - 'sku' => '1-text', - 'max_characters' => 100 - ), + ->setDescription('Description with <b>html tag</b>') + + ->setMetaTitle('meta title') + ->setMetaKeyword('meta keyword') + ->setMetaDescription('meta description') + + ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) + ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) + + ->setCategoryIds(array(2)) + + ->setStockData( array( - 'id' => 2, - 'option_id' => 0, - 'previous_group' => 'date', - 'title' => 'Test Date and Time', - 'type' => 'date_time', - 'is_require' => 1, - 'sort_order' => 0, - 'price' => 2, - 'price_type' => 'fixed', - 'sku' => '2-date' - ), + 'use_config_manage_stock' => 1, + 'qty' => 100, + 'is_qty_decimal' => 0, + 'is_in_stock' => 1, + ) + ) + ->setCanSaveCustomOptions(true) + ->setProductOptions( array( - 'id' => 3, - 'option_id' => 0, - 'previous_group' => 'select', - 'title' => 'Test Select', - 'type' => 'drop_down', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => array( - array( - 'option_type_id' => -1, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-1-select' - ), - array( - 'option_type_id' => -1, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '3-2-select' + array( + 'id' => 1, + 'option_id' => 0, + 'previous_group' => 'text', + 'title' => 'Test Field', + 'type' => 'field', + 'is_require'=> 1, + 'sort_order'=> 0, + 'price' => 1, + 'price_type'=> 'fixed', + 'sku' => '1-text', + 'max_characters' => 100 + ), + array( + 'id' => 2, + 'option_id' => 0, + 'previous_group' => 'date', + 'title' => 'Test Date and Time', + 'type' => 'date_time', + 'is_require'=> 1, + 'sort_order'=> 0, + 'price' => 2, + 'price_type'=> 'fixed', + 'sku' => '2-date', + ), + array( + 'id' => 3, + 'option_id' => 0, + 'previous_group' => 'select', + 'title' => 'Test Select', + 'type' => 'drop_down', + 'is_require'=> 1, + 'sort_order'=> 0, + 'values' => array( + array( + 'option_type_id'=> -1, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-1-select', + ), + array( + 'option_type_id'=> -1, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '3-2-select', + ), ) - ) - ), - array( - 'id' => 4, - 'option_id' => 0, - 'previous_group' => 'select', - 'title' => 'Test Radio', - 'type' => 'radio', - 'is_require' => 1, - 'sort_order' => 0, - 'values' => array( - array( - 'option_type_id' => -1, - 'title' => 'Option 1', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-1-radio' - ), - array( - 'option_type_id' => -1, - 'title' => 'Option 2', - 'price' => 3, - 'price_type' => 'fixed', - 'sku' => '4-2-radio' + ), + array( + 'id' => 4, + 'option_id' => 0, + 'previous_group' => 'select', + 'title' => 'Test Radio', + 'type' => 'radio', + 'is_require'=> 1, + 'sort_order'=> 0, + 'values' => array( + array( + 'option_type_id'=> -1, + 'title' => 'Option 1', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-1-radio', + ), + array( + 'option_type_id'=> -1, + 'title' => 'Option 2', + 'price' => 3, + 'price_type' => 'fixed', + 'sku' => '4-2-radio', + ), ) - ) + ), ) ) -)->setHasOptions( - true -)->save(); + ->setHasOptions(true) + ->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php index 04208ae05fa0489c6c041844bba8c9728c4287bd..76ea3b2ce32000296085d7c7282a99e40145975c 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Block/Cart/Item/RendererTest.php @@ -38,16 +38,10 @@ class RendererTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Checkout\Block\Cart\Item\Renderer' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Checkout\Block\Cart\Item\Renderer'); /** @var $item \Magento\Sales\Model\Quote\Item */ $item = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Quote\Item'); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php index a617c39b47d3e0cdd7f56482fe1f7cafb6649c25..ab31955c328ebc0596bcfe5276903d00ac92411b 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/RouterTest.php @@ -81,7 +81,7 @@ class ManagerStub extends Manager * * @param string $eventName * @param array $params - * @return \Magento\Core\Model\App|null + * @return null */ public function dispatch($eventName, array $params = array()) { diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index 139798f0e2c1df41e04b81376ef18633b85bf933..a07d77ea11de395a3e1931a7075b03dbecd66e42 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -60,13 +60,11 @@ class StorageTest extends \PHPUnit_Framework_TestCase */ public function testGetFilesCollection() { + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); + $objectManager->get('Magento\View\DesignInterface') + ->setDesignTheme('magento_backend'); /** @var $model \Magento\Cms\Model\Wysiwyg\Images\Storage */ $model = $objectManager->create('Magento\Cms\Model\Wysiwyg\Images\Storage'); $collection = $model->getFilesCollection(self::$_baseDir, 'media'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php index 329605f9c4a918b5fc8fcf1fcb23a1fbe01f855a..9e322f8d53ea3ea31132792747e9698691628e0f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/JsTest.php @@ -40,17 +40,12 @@ class JsTest extends \PHPUnit_Framework_TestCase $this->_helper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Helper\Js'); } - public function testGetTranslateJson() - { - $this->assertNotNull(json_decode($this->_helper->getTranslateJson())); - } - public function testGetTranslatorScript() { $this->assertEquals( "<script type=\"text/javascript\">//<![CDATA[\n" . '(function($) {$.mage.translate.add(' . - $this->_helper->getTranslateJson() . + $this->_helper->encode($this->_helper->getTranslateData()) . ')})(jQuery);' . "\n//]]></script>", $this->_helper->getTranslatorScript() diff --git a/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php b/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php index e73f666000b15c8b9c613e5eb93715cf8ec16959..8dc1a337975740effaf8ff8de3eb5a913ef2229d 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Helper/Url/RewriteTest.php @@ -50,7 +50,7 @@ class RewriteTest extends \PHPUnit_Framework_TestCase /** * @dataProvider requestPathExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateRequestPathException($requestPath) { @@ -67,7 +67,7 @@ class RewriteTest extends \PHPUnit_Framework_TestCase /** * @dataProvider requestPathExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateSuffixException($suffix) { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php index 671539966ca78725a2af72d39f7b4939b0fb1689..a61d4d77ea450199c2317264d9f33e6baeecd9b0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/AreaTest.php @@ -35,11 +35,8 @@ class AreaTest extends \PHPUnit_Framework_TestCase public static function tearDownAfterClass() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->cleanCache( - array(\Magento\Core\Model\Design::CACHE_TAG) - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface')-> + clean(array(\Magento\Core\Model\Design::CACHE_TAG)); } protected function setUp() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php index d387d2b552df8b7a97585b0c5f414c74688268ec..c00cf351fb6423fd121021a385e96fddc3626741 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/App/EmulationTest.php @@ -39,15 +39,12 @@ class EmulationTest extends \PHPUnit_Framework_TestCase */ public function testEnvironmentEmulation() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\App\Emulation' - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface'); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Core\Model\App\Emulation'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\DesignInterface'); $initialEnvInfo = $this->_model->startEnvironmentEmulation(1); $initialDesign = $initialEnvInfo->getInitialDesign(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php deleted file mode 100644 index fb3a67252b51a2ca94e070f3030f9af487480be6..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Core/Model/AppTest.php +++ /dev/null @@ -1,155 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Core\Model; - -class AppTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Core\Model\App - */ - protected $_model; - - /** - * Application instance initialized with environment - * Is used in some tests that require initialization - * - * @var \Magento\Core\Model\App - */ - protected $_mageModel; - - /** - * Callback test flag - * - * @var bool - */ - protected $_errorCatchFlag = false; - - protected function setUp() - { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\App'); - $this->_mageModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); - } - - public function testGetCookie() - { - $this->assertInstanceOf('Magento\Stdlib\Cookie', $this->_model->getCookie()); - } - - public function testSetErrorHandler() - { - $this->_model->setErrorHandler(array($this, 'errorHandler')); - try { - trigger_error('test', E_USER_NOTICE); - if (!$this->_errorCatchFlag) { - $this->fail('Error handler is not working'); - } - restore_error_handler(); - } catch (\Exception $e) { - restore_error_handler(); - throw $e; - } - } - - public function errorHandler() - { - $this->_errorCatchFlag = true; - } - - public function testGetArea() - { - $area = $this->_model->getArea('frontend'); - $this->assertInstanceOf('Magento\Core\Model\App\Area', $area); - $this->assertSame($area, $this->_model->getArea('frontend')); - } - - public function testGetDistroLocaleCode() - { - $this->assertEquals(\Magento\Core\Model\App::DISTRO_LOCALE_CODE, $this->_model->getDistroLocaleCode()); - } - - public function testGetBaseCurrencyCode() - { - $this->assertEquals('USD', $this->_model->getBaseCurrencyCode()); - } - - public function testGetCacheInstance() - { - $cache = $this->_mageModel->getCacheInstance(); - $this->assertInstanceOf('Magento\App\CacheInterface', $cache); - $this->assertSame($cache, $this->_mageModel->getCacheInstance()); - } - - public function testGetCache() - { - $this->assertInstanceOf('Magento\Cache\FrontendInterface', $this->_mageModel->getCache()); - } - - public function testLoadSaveRemoveCache() - { - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - $this->_mageModel->saveCache('test_data', 'test_id'); - $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id')); - $this->_mageModel->removeCache('test_id'); - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - } - - public function testCleanCache() - { - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - $this->_mageModel->saveCache('test_data', 'test_id', array('test_tag')); - $this->assertEquals('test_data', $this->_mageModel->loadCache('test_id')); - $this->_mageModel->cleanCache(array('test_tag')); - $this->assertEmpty($this->_mageModel->loadCache('test_id')); - } - - public function testSetGetRequest() - { - $this->assertInstanceOf('Magento\App\RequestInterface', $this->_model->getRequest()); - /** @var $objectManager \Magento\TestFramework\ObjectManager */ - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $request \Magento\TestFramework\Request */ - $request = $objectManager->get('Magento\TestFramework\Request'); - $this->_model->setRequest($request); - $this->assertSame($request, $this->_model->getRequest()); - } - - public function testSetGetResponse() - { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\App\ResponseInterface' - )->headersSentThrowsException = false; - $this->assertInstanceOf('Magento\App\ResponseInterface', $this->_model->getResponse()); - $expectedHeader = array('name' => 'Content-Type', 'value' => 'text/html; charset=UTF-8', 'replace' => false); - $this->assertContains($expectedHeader, $this->_model->getResponse()->getHeaders()); - $response = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\App\ResponseInterface' - ); - $this->_model->setResponse($response); - $this->assertSame($response, $this->_model->getResponse()); - $this->assertEmpty($this->_model->getResponse()->getHeaders()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php index f3a0cac935d29e8b1caf407fc2284f486c7a7b4a..0e1ad4f572dfd0be97f3e8372c9ece221628d9d4 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Config/DataTest.php @@ -63,11 +63,8 @@ class DataTest extends \PHPUnit_Framework_TestCase */ protected static function _refreshConfiguration() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->cleanCache( - array(\Magento\App\Config::CACHE_TAG) - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->clean(array(\Magento\App\Config::CACHE_TAG)); \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php index f458f19e5dab39a8d1cd5aa8337d740a81c9f005..b00b4757e09b5c6e36ebdd3bac261965357ec9eb 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Design/Backend/ExceptionsTest.php @@ -120,7 +120,7 @@ class ExceptionsTest extends \PHPUnit_Framework_TestCase /** * @var array $value - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @dataProvider saveWrongExceptionDataProvider * @magentoDbIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php index bea1b0a7d4fd797b8b521b59aea0028262c2d7d0..b3a1fe9a28b7c9dc945ef227c70ef299f4d175a6 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/DesignTest.php @@ -88,7 +88,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase $model->setId(null); $model->save(); $this->fail('A validation failure is expected.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { // intentionally swallow exception } @@ -132,11 +132,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - $cacheId - ); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load($cacheId); $cachedDesign = unserialize($cachedDesign); $this->assertInternalType('array', $cachedDesign); @@ -148,11 +145,8 @@ class DesignTest extends \PHPUnit_Framework_TestCase $design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Design'); $design->loadChange($storeId, $date); - $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadCache( - $cacheId - ); + $cachedDesign = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\CacheInterface') + ->load($cacheId); $cachedDesign = unserialize($cachedDesign); $this->assertTrue(is_array($cachedDesign)); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php index a3b1d44d6bec1afc8fe6b46b8e075b26624e94a5..e92faeecdb10c75fa474fdcfffffe6756ae5913b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/LayoutTest.php @@ -246,7 +246,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase /** * @dataProvider blockNotExistsDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateBlockNotExists($name) { @@ -391,7 +391,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testAddBlockInvalidType() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php index 8c8e0f712e74c99dab2dd84f16acedcff4aca8f5..d5ccdd5ca942478b49342d4e8f7f0352260b7670 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/ObserverTest.php @@ -64,8 +64,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Model\Theme\Registration', array('register'), array( - $this->_objectManager->create('Magento\Core\Model\Resource\Theme\CollectionFactory'), - $this->_objectManager->create('Magento\Core\Model\Theme\Collection'), + $this->_objectManager->create('Magento\Core\Model\Resource\Theme\Data\CollectionFactory'), + $this->_objectManager->create('Magento\Core\Model\Theme\Data\Collection'), $this->_objectManager->create('Magento\App\Filesystem') ) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php index c72b28c2ba885dd9fc822cb819d100d8ae3015d0..35a6958e1a353a4240ad879c74e7a602bc80ae25 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/HelperTest.php @@ -29,7 +29,7 @@ namespace Magento\Core\Model\Resource; class HelperTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Helper + * @var \Magento\DB\Helper */ protected $_model; @@ -41,7 +41,7 @@ class HelperTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Helper', + 'Magento\DB\Helper', array('modulePrefix' => 'core') ); $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php index 4fb7e91b4ac70fab4a1ff382dd609bb56b2c8542..cad51a5602ba00e1b3aebf902e331928824c1de5 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Store/CollectionTest.php @@ -112,8 +112,8 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::addFieldToSelect - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::removeFieldFromSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::addFieldToSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::removeFieldFromSelect */ public function testAddRemoveFieldToSelect() { @@ -132,7 +132,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::addExpressionFieldToSelect + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::addExpressionFieldToSelect */ public function testAddExpressionFieldToSelect() { @@ -142,7 +142,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::getAllIds + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::getAllIds */ public function testGetAllIds() { @@ -150,7 +150,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::getData + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::getData */ public function testGetData() { @@ -158,7 +158,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Resource\Db\Collection\AbstractCollection::join + * @covers \Magento\Model\Resource\Db\Collection\AbstractCollection::join */ public function testJoin() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php index 2dac3dd7440cdd48ee1c52d922d19bfae3ece95e..5d8ba652c0efd373b8dcd3af3c433922d4502482 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Resource/TransactionTest.php @@ -29,15 +29,14 @@ namespace Magento\Core\Model\Resource; class TransactionTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Transaction + * @var \Magento\DB\Transaction */ protected $_model; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' - ); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); } /** diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php index 1534e6e91a27bc0e44115676887066ef209bd210..66c121d3f4f411f1af6667641d745da606b3ece0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/StoreTest.php @@ -64,7 +64,8 @@ class StoreTest extends \PHPUnit_Framework_TestCase 'storeManager' => $objectManager->get('Magento\Core\Model\StoreManager'), 'sidResolver' => $objectManager->get('Magento\Session\SidResolverInterface'), 'cookie' => $objectManager->get('Magento\Stdlib\Cookie'), - 'httpContext' => $objectManager->get('Magento\App\Http\Context') + 'httpContext' => $objectManager->get('Magento\App\Http\Context'), + 'config' => $objectManager->get('Magento\App\ConfigInterface') ); return $this->getMock('Magento\Core\Model\Store', array('getUrl'), $this->_modelParams); @@ -322,7 +323,7 @@ class StoreTest extends \PHPUnit_Framework_TestCase * @dataProvider saveValidationDataProvider * @magentoAppIsolation enabled * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testSaveValidation($badStoreData) { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php index 051cc76719b62d720175d686625f8dcf6e97120e..9e38fe746a427145b7cf29784d51ad82c69c4987 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/Theme/RegistrationTest.php @@ -50,13 +50,17 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase ) ) ); - $this->_theme = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\View\Design\ThemeInterface' - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Theme\Registration', - array('theme' => $this->_theme) - ); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $objectManager->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + + $objectManager->get('Magento\App\State') + ->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_theme = $objectManager + ->create('Magento\View\Design\ThemeInterface'); + $this->_model = $objectManager + ->create('Magento\Core\Model\Theme\Registration'); } /** @@ -128,4 +132,15 @@ class RegistrationTest extends \PHPUnit_Framework_TestCase $testTheme->load($testTheme->getId()); $this->assertNotEquals((int)$testTheme->getType(), \Magento\View\Design\ThemeInterface::TYPE_PHYSICAL); } + + /** + * @magentoDbIsolation enabled + */ + public function testRegister() + { + $this->registerThemes(); + $themePath = implode(\Magento\View\Design\ThemeInterface::PATH_SEPARATOR, array('frontend', 'test_test_theme')); + $theme = $this->_model->getThemeFromDb($themePath); + $this->assertEquals($themePath, $theme->getFullPath()); + } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php index e3003369722477df607484eb125887c8ac5f2695..d9ca1292b9ad7a957c7574c1ef27f3ff44b99ba0 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/View/DesignTest.php @@ -89,15 +89,13 @@ class DesignTest extends \PHPUnit_Framework_TestCase */ protected function _emulateFixtureTheme($themePath = 'test_default') { - \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array( - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')) - ) - ) - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__ . '/../_files/design')), + ), + )); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend'); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get('Magento\Core\Model\App')->loadArea('frontend'); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme($themePath); $this->_viewFileSystem = $objectManager->create('Magento\View\FileSystem'); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3c9b11dae2719b47bf95d41e69136f1e56ce2904 Binary files /dev/null and b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/images/preview_image.jpg differ diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml index 5dd26d0b174eeb37696e8fcdd4c5671f907ec2ce..d0008b53c35d88d17e0c54e27f5d7f266b95b13b 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml +++ b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/frontend/magento_default_iphone/theme.xml @@ -30,6 +30,6 @@ <version>2.0.0.0</version> <parent>magento_default</parent> <media> - <preview_image>images/preview.png</preview_image> + <preview_image>images/preview_image.jpg</preview_image> </media> </theme> diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php index 4a7f9b246f7f0d1710a5d333a32d8f9d55a1cf06..0f27598254d34534998fc09398ce4b1d64489e18 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/Core/Model/_files/design/themes.php @@ -24,19 +24,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); -\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize( - array( - \Magento\App\Filesystem::PARAM_APP_DIRS => array( - \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__)) - ) - ) -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->reinitialize(array( + \Magento\App\Filesystem::PARAM_APP_DIRS => array( + \Magento\App\Filesystem::THEMES_DIR => array('path' => realpath(__DIR__)), + ), +)); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure( array('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data')) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php index 78d27c15c797e55dac6b7b3aa8ed75d9b039d485..14503047369b9800b2bc69b719b6e89b0b4d21d8 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/layout_update.php @@ -27,12 +27,9 @@ /** @var $objectManager \Magento\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$objectManager->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); +$objectManager->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $theme \Magento\View\Design\ThemeInterface */ $theme = $objectManager->create('Magento\View\Design\ThemeInterface'); $theme->setThemePath( diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php index 2fedb1e7fb5864d78939a3e3db376df7ebc212a6..1d68e592624563276b617e266e45fc25bb7c378c 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php +++ b/dev/tests/integration/testsuite/Magento/Core/_files/media_for_change.php @@ -24,12 +24,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); $designDir = \Magento\TestFramework\Helper\Bootstrap::getInstance()->getAppInstallDir() . '/media_for_change'; $themeDir = $designDir . '/frontend/test_default'; $sourcePath = dirname(__DIR__) . '/Model/_files/design/frontend/test_publication/'; diff --git a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php index 6324ac62a81b4e5b03cd13410b55dd7c5e82cb28..e00fbd91cb3bcc1aefde18fd8f913266cf6b8332 100644 --- a/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/integration/testsuite/Magento/Cron/Model/ObserverTest.php @@ -32,15 +32,11 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - 'crontab', - \Magento\Core\Model\App\Area::PART_CONFIG - ); - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Cron\Model\Observer' - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('crontab') + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Cron\Model\Observer'); $this->_model->dispatch('this argument is not used'); } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index e633f021be8666fc9503324068bd8638d2ba335e..3e34b3df8e61f190bcd664ff4263a973d6046918 100755 --- a/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -1299,7 +1299,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase /** * @magentoDataFixture Magento/Customer/_files/customer.php - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Customer website ID must be specified when using the website scope */ public function testIsEmailAvailableNoWebsiteSpecified() diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php index 2963668e8bd360c685915d95935cca67a71c2c82..085756b56570f963b5a7574da47483854e335b2e 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/quote.php @@ -22,11 +22,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); diff --git a/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php b/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php index b191d14f1c465099efa834b979b0e3907bd8ff1f..a199ee03649910b2118d365702ddb85699ffffea 100644 --- a/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php +++ b/dev/tests/integration/testsuite/Magento/Data/Argument/Interpreter/StringTest.php @@ -26,7 +26,7 @@ namespace Magento\Data\Argument\Interpreter; class StringTest extends \PHPUnit_Framework_TestCase { /** - * @var Number + * @var \Magento\Data\Argument\Interpreter\String */ protected $_model; @@ -50,7 +50,7 @@ class StringTest extends \PHPUnit_Framework_TestCase $translateRenderer->expects($this->any())->method('render')->will( $this->returnCallback( function ($input) { - return $input . ' (translated)'; + return end($input) . ' (translated)'; } ) ); diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php similarity index 96% rename from dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php rename to dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php index 0abeb4fd815a9006c6d6f37903d3b634fde59502..d22c4e4ea93919622388b881651fa265d78f6186 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineVdeTest.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/Translate/InlineTest.php @@ -26,10 +26,10 @@ */ namespace Magento\DesignEditor\Model\Translate; -class InlineVdeTest extends \PHPUnit_Framework_TestCase +class InlineTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\DesignEditor\Model\Translate\InlineVde + * @var \Magento\DesignEditor\Model\Translate\Inline */ protected $_model; @@ -57,7 +57,7 @@ class InlineVdeTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $objectManager->get('Magento\DesignEditor\Model\Translate\InlineVde'); + $this->_model = $objectManager->get('Magento\DesignEditor\Model\Translate\Inline'); $this->_request = $objectManager->get('Magento\App\RequestInterface'); $this->_request->setParam('translation_mode', 'text'); @@ -67,7 +67,7 @@ class InlineVdeTest extends \PHPUnit_Framework_TestCase public function testObjectCreation() { - $this->assertInstanceOf('Magento\DesignEditor\Model\Translate\InlineVde', $this->_model); + $this->assertInstanceOf('Magento\DesignEditor\Model\Translate\Inline', $this->_model); $this->assertInstanceOf('Magento\App\RequestInterface', $this->_request); $this->assertInstanceOf('Magento\DesignEditor\Helper\Data', $this->_helperData); } diff --git a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php index 857074ed4f8a944da73d9e8d96b38fccb054f01c..f93fc4b0bfe4a79e7a3aad1a6e1e477b2194f5ca 100644 --- a/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/DesignEditor/Model/_files/design/themes.php @@ -32,13 +32,13 @@ ) ) ); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\State') + ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a7c0bad0e14147a5fe249d074c2e91f36a6897ff --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Downloadable/Block/Catalog/Product/LinksTest.php @@ -0,0 +1,176 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Downloadable\Block\Catalog\Product; + +use Magento\Customer\Controller\RegistryConstants; + +/** + * Tests Magento\Downloadable\Block\Catalog\Product\Links.php + * + */ +class LinksTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\TestFramework\ObjectManager */ + private $objectManager; + + /** @var \Magento\Tax\Model\Calculation */ + private $taxCalculationModel; + + /** @var \Magento\Registry */ + private $registry; + + /** @var \Magento\Downloadable\Block\Catalog\Product\Links */ + private $linksBlock; + + public function setUp() + { + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get('Magento\Registry'); + $this->taxCalculationModel = $this->objectManager->create('Magento\Tax\Model\Calculation'); + + $this->linksBlock = $this->objectManager->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Downloadable\Block\Catalog\Product\Links'); + } + + public function tearDown() + { + $this->registry->unregister('product'); + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rule'); + $this->registry->unregister('_fixture/Magento_Tax_Model_Calculation_Rate'); + } + + /** + * Test that has no customer registered. + * + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + */ + public function testGetFormattedLinkPriceNoCustomer() + { + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $this->registry->register('product', $product); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals('<span class="price-notice">+<span class="price">$15.00</span></span>', $formattedLink); + } + + /** + * Test that uses customer's billing address as tax calculation base. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoConfigFixture current_store tax/calculation/based_on billing + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Tax/_files/tax_classes.php + */ + public function testGetFormattedLinkPriceCustomerBasedTax() + { + /** set the product and tax classes from tax_class fixture */ + $this->setUpTaxClasses(); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals( + '<span class="price-notice">+<span class="price">$15.00</span>'. + ' (+<span class="price">$16.13</span> Incl. Tax)</span>', + $formattedLink + ); + } + + /** + * Test a customer outside of region. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoConfigFixture current_store tax/calculation/based_on billing + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Customer/_files/customer_group.php + * @magentoDataFixture Magento/Tax/_files/tax_classes.php + */ + public function testGetFormattedLinkPriceCustomerBasedTaxDiffRegion() + { + /** set the product and tax classes from tax_class fixture */ + $this->setUpTaxClasses(13); + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals('<span class="price-notice">+<span class="price">$15.00</span></span>', $formattedLink); + } + + /** + * Test that has a customer but product based tax. + * + * @magentoConfigFixture current_store tax/display/type 3 + * @magentoDataFixture Magento/Downloadable/_files/product_with_files.php + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testGetFormattedLinkPriceCustomerProductTax() + { + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $product->setTaxPercent(10); + $product->save(); + + $this->registry->register('product', $product); + $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); + + $link = array_values($this->linksBlock->getLinks())[0]; + $formattedLink = $this->linksBlock->getFormattedLinkPrice($link); + $this->assertEquals( + '<span class="price-notice">+<span class="price">$15.00</span>'. + ' (+<span class="price">$16.50</span> Incl. Tax)</span>', + $formattedLink + ); + } + + /** + * Set the product and tax classes from tax_class fixture + * + * @param int $addressRegionId Region to use for customer billing address. + * Defaults to 12 which is the same as in tax rate fixture + */ + private function setUpTaxClasses($addressRegionId = 12) + { + $taxRule = $this->registry->registry('_fixture/Magento_Tax_Model_Calculation_Rule'); + $customerTaxClasses = $taxRule->getTaxCustomerClass(); + $productTaxClasses = $taxRule->getTaxProductClass(); + + $customerGroup = $this->objectManager->create('Magento\Customer\Model\Group')->load(1); + $customerGroup->setTaxClassId($customerTaxClasses[0]); + $customerGroup->save(); + + $address = $this->objectManager->create('Magento\Customer\Model\Address')->load(1); + $address->setRegionId($addressRegionId); + $address->save(); + + $product = $this->objectManager->create('Magento\Catalog\Model\Product')->load(1); + $product->setTaxClassId($productTaxClasses[0]); + $product->save(); + + $this->registry->register('product', $product); + $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, 1); + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php index 68b2f55c08fca17c012e4aae26a9f1f8d7345ac9..e09e7ed7c91061dc09045e8bd77da1287bdfbe92 100644 --- a/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractTest.php @@ -40,17 +40,12 @@ class AbstractTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $objectManager->get('Magento\View\DesignInterface')->setDefaultDesignTheme(); - $entityType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Eav\Model\Config' - )->getEntityType( - 'customer' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $objectManager->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $entityType = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Eav\Model\Config') + ->getEntityType('customer'); $model = $objectManager->create('Magento\Customer\Model\Attribute'); $model->setEntityTypeId($entityType->getId()); $objectManager->get('Magento\Registry')->register('entity_attribute', $model); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php index 9fe9222bfd58e3e4ac98bec2cd8a43e8ad696663..780676ae0d78dbc3bbbf41ef6d3b0b6957cbe79a 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -67,10 +67,12 @@ class FilterTest extends \PHPUnit_Framework_TestCase ); $this->assertStringMatchesFormat('http://example.com/%sarbitrary_url/', $url); - $url = $this->_model->storeDirective( - array('{{store url="core/ajax/translate"}}', 'store', ' url="core/ajax/translate"') - ); - $this->assertStringMatchesFormat('http://example.com/%score/ajax/translate/', $url); + $url = $this->_model->storeDirective(array( + '{{store url="translation/ajax/index"}}', + 'store', + ' url="translation/ajax/index"', + )); + $this->assertStringMatchesFormat('http://example.com/%stranslation/ajax/index/', $url); } public function testEscapehtmlDirective() @@ -126,7 +128,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase $design = $objectManager->create('Magento\Core\Model\View\Design', array('themes' => $themes)); $objectManager->addSharedInstance($design, 'Magento\Core\Model\View\Design'); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $collection = $objectManager->create('Magento\Core\Model\Resource\Theme\Collection'); $themeId = $collection->getThemeByFullPath('frontend/test_default')->getId(); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index 636278dc7ca9de14bd4dd450e59fa0d81eaa22f5..9b4000f1eccd5d8775a94c5a6fc038446b04a3c8 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -115,11 +115,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplate() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); @@ -163,11 +160,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateDesignChange() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_model->setTemplateText('{{view url="Magento_Theme::favicon.ico"}}'); $this->assertStringEndsWith( 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico', @@ -181,11 +175,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetProcessedTemplateSubject() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->_setNotDefaultThemeForFixtureStore(); $expectedViewUrl = 'static/frontend/magento_plushe/en_US/Magento_Theme/favicon.ico'; $this->_model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}'); @@ -208,11 +199,8 @@ class TemplateTest extends \PHPUnit_Framework_TestCase */ public function testGetDefaultEmailLogo() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->getArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - )->load(); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND)->load(); $this->assertStringEndsWith( 'static/frontend/magento_blank/en_US/Magento_Email/logo_email.gif', $this->_model->getDefaultEmailLogo() diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php index 52d32b03a68a34f4bac4bdf6836f42f646e15038..de6263e690b1d0c072ce7f051577d09b828e5893 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/_files/themes.php @@ -29,13 +29,15 @@ ) ); $objectManger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); -$objectManger->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); -$objectManger->configure(array('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data'))); +$objectManger->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + +$objectManger->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) +)); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = $objectManger->create('Magento\Core\Model\Theme\Registration'); $registration->register(implode('/', array('*', '*', 'theme.xml'))); diff --git a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php index 5b46b8fe1cd18109b065a591c98442d07dd2e41d..b4d19dd52363c589beab6dda84bb6df393881876 100644 --- a/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/GiftMessage/Block/Message/InlineTest.php @@ -47,14 +47,10 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ public function testThumbnail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getThumbnailSize(); diff --git a/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php b/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php index 6666010115eb3cd254d888c597a423adb2cedb07..d4d8469fe5145e148a6853aa09a41dfcfdd03535 100644 --- a/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php +++ b/dev/tests/integration/testsuite/Magento/GoogleShopping/Model/_files/flag_expired.php @@ -31,9 +31,8 @@ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $flag = $objectManager->create('Magento\GoogleShopping\Model\Flag'); $flag->lock(); -/** @var $flagResource \Magento\Core\Model\Resource\Flag */ -$flagResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Flag' -); +/** @var $flagResource \Magento\Flag\Resource */ +$flagResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Flag\Resource'); $flag->setLastUpdate(date('Y-m-d H:i:s', time() - \Magento\GoogleShopping\Model\Flag::FLAG_TTL - 1)); $flagResource->save($flag); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php index c41d2c84cef80c03466f8d9a9db395de7d780562..388b2241a95f2ff367bd58bec5f5c1450e75ceff 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Block/Adminhtml/Export/FilterTest.php @@ -37,17 +37,12 @@ class FilterTest extends \PHPUnit_Framework_TestCase */ public function testGetDateFromToHtmlWithValue() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\ImportExport\Block\Adminhtml\Export\Filter' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\ImportExport\Block\Adminhtml\Export\Filter'); $method = new \ReflectionMethod( 'Magento\ImportExport\Block\Adminhtml\Export\Filter', '_getDateFromToHtmlWithValue' diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php index 1e09e70f8efc0f769202c3fe5e1079a68e0088f7..016c68038e18e79a7ad04dffd65d9487b2f61330 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Export/EntityAbstractTest.php @@ -86,7 +86,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase /** * Check that method throw exception when writer was not defined * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetWriterThrowsException() { diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php index 54e79d021e81a3a0de3be1fb33de49ac77b7914e..5acebb9b3f3fc7a757ed15b0fb4c9fff456a47f2 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ExportTest.php @@ -86,7 +86,7 @@ class ExportTest extends \PHPUnit_Framework_TestCase /** * Test method '_getEntityAdapter' in case when entity is invalid * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @covers \Magento\ImportExport\Model\Export::_getEntityAdapter */ public function testGetEntityAdapterWithInvalidEntity() diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index 39fbf61a6f1cd46427875e40323c986eba4383a0..57f0cb8fcb4131288e1c57cbf9c8a95b60ad89cb 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -155,18 +155,10 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase * @dataProvider importDataDataProvider * @covers \Magento\ImportExport\Model\Import\Entity\CustomerComposite::_importData */ - public function testImportData( - $behavior, - $sourceFile, - array $dataBefore, - array $dataAfter, - array $errors = array() - ) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); + public function testImportData($behavior, $sourceFile, array $dataBefore, array $dataAfter, array $errors = array()) + { + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); // set entity adapter parameters $this->_entityAdapter->setParameters(array('behavior' => $behavior)); /** @var \Magento\App\Filesystem $filesystem */ diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php index e79b45dc89a885ac828ca53c233737ff5c734ee8..0c3e669d3d9f2022bc7afe707862395e5b203d5c 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/Customer/AddressTest.php @@ -257,13 +257,8 @@ class AddressTest extends \PHPUnit_Framework_TestCase 'Magento\Customer\Model\Address' ); $tableName = $addressModel->getResource()->getEntityTable(); - $addressId = $objectManager->get( - 'Magento\Core\Model\Resource\HelperPool' - )->get( - 'Magento_ImportExport' - )->getNextAutoincrement( - $tableName - ); + $addressId = $objectManager->get('Magento\ImportExport\Model\Resource\Helper') + ->getNextAutoincrement($tableName); /** @var \Magento\Stdlib\DateTime $dateTime */ $dateTime = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Stdlib\DateTime'); diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php index 11126cde90ff46ba9145df18897781ccab634bfc..4525ed9cc4662ac81549d9885928d3604c26ae18 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Import/Entity/Eav/CustomerImportTest.php @@ -139,11 +139,8 @@ class CustomerImportTest extends \PHPUnit_Framework_TestCase */ public function testDeleteData() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $source = new \Magento\ImportExport\Model\Import\Source\Csv( __DIR__ . '/_files/customers_to_import.csv', $this->directoryWrite diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php index abc8436c9af3bdfe021611a0af5edaa601680fe6..2e1c65079b3b1a6369208f37012409179e279660 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/ImportTest.php @@ -125,7 +125,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Entity is unknown */ public function testValidateSourceException() @@ -147,7 +147,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Entity is unknown */ public function testGetEntityEntityIsNotSet() @@ -175,7 +175,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase /** * Test getEntityBehaviors with not existing behavior class * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid behavior token for customer */ public function testGetEntityBehaviorsWithUnknownBehavior() diff --git a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php index 4da2db25b3c2efd03edf25aece3250181e3adec9..5f9915d729cd197ec358a043b613f1134d82dcfb 100644 --- a/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php +++ b/dev/tests/integration/testsuite/Magento/ImportExport/Model/Resource/Import/DataTest.php @@ -67,7 +67,7 @@ class DataTest extends \PHPUnit_Framework_TestCase /** * Test getUniqueColumnData() in case when in data stored in requested column is NOT unique * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetUniqueColumnDataException() { diff --git a/dev/tests/integration/testsuite/Magento/Less/_files/themes.php b/dev/tests/integration/testsuite/Magento/Less/_files/themes.php index 5d43a26038aae2a5ccbb87b45069c6c451070f14..3f3db4f663f7328326dfe0cf60237e7196f346a7 100644 --- a/dev/tests/integration/testsuite/Magento/Less/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Less/_files/themes.php @@ -29,6 +29,8 @@ ) ); $objectManger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); +$objectManger->get('Magento\App\State') + ->setAreaCode(\Magento\View\DesignInterface::DEFAULT_AREA); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = $objectManger->create('Magento\Core\Model\Theme\Registration'); diff --git a/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..6bc9125cb2f61082a30c60df908a84a456394e68 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Log/Model/Resource/Visitor/Online/CollectionTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Log\Model\Resource\Visitor\Online; + +use Magento\TestFramework\Helper\Bootstrap; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Log/_files/visitor_online.php + */ + public function testAddCustomerData() + { + /** @var \Magento\Log\Model\Resource\Visitor\Online\Collection $visitorOnlineCollection */ + $visitorOnlineCollection = Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Resource\Visitor\Online\Collection'); + + $visitorOnlineCollection->addCustomerData(); + + $this->assertEquals(1, $visitorOnlineCollection->count(), "Invalid collection items quantity."); + /** @var \Magento\Log\Model\Visitor\Online $collectionItem */ + $collectionItem = $visitorOnlineCollection->getFirstItem(); + + /** @var \Magento\Log\Model\Visitor\Online $visitorOnline */ + $visitorOnline = Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor\Online') + ->load(1); + + $visitorOnline->addData([ + 'customer_email' => 'customer@example.com', + 'customer_firstname' => 'Firstname', + 'customer_lastname' => 'Lastname' + ]); + + foreach ($visitorOnline->getData() as $field => $expectedValue) { + $this->assertEquals( + $expectedValue, + $collectionItem->getData($field), + "'{$field}' field value is invalid." + ); + } + } +} diff --git a/app/code/Magento/Backend/Model/Resource/Translate/String.php b/dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php similarity index 65% rename from app/code/Magento/Backend/Model/Resource/Translate/String.php rename to dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php index 44129bdf32438ec0ed119944777122ff9458007d..4712a7b0422bc589d33ce9f0b0bc65d7ca7e5e35 100644 --- a/app/code/Magento/Backend/Model/Resource/Translate/String.php +++ b/dev/tests/integration/testsuite/Magento/Log/_files/visitor_online.php @@ -18,26 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Backend * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Resource\Translate; - -/** - * Backend string translate resource model - */ -class String extends \Magento\Core\Model\Resource\Translate\String -{ - /** - * Get current store id - * Use always default scope for store id - * - * @return int - */ - protected function _getStoreId() - { - return \Magento\Core\Model\Store::DEFAULT_STORE_ID; - } -} +/** @var \Magento\Log\Model\Visitor\Online $visitorOnline */ +$visitorOnline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Log\Model\Visitor\Online'); +$visitorOnline->setData(array( + 'visitor_type' => 'c', + 'remote_addr' => '10101010', + 'first_visit_at' => '2014-03-02 00:00:00', + 'last_visit_at' => '2014-03-02 01:01:01', + 'customer_id' => 1, + 'last_url' => 'http://last_url', +)); +$visitorOnline->save(); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php index 4b9a949d53b93fbe805536f981baff9bd6c0bfd1..6023ae8e2481459daba43767539c509609682514 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/AbstractTest.php @@ -19,25 +19,24 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Lib * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_model; protected function setUp() { $resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); - $this->_model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $this->_model = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array('resource' => $resource) ); } @@ -74,8 +73,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase array('tablePrefix' => 'prefix_') ); - $model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $model = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array('resource' => $resource) ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php similarity index 78% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php index 88e1e6dde2e664d26ce45acc5d1089156cbd7ab1..370453181c85710df23b54abd1b7e81d9aa59d28 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/Collection/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/Collection/AbstractTest.php @@ -21,26 +21,21 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db\Collection; +namespace Magento\Model\Resource\Db\Collection; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_model = null; protected function setUp() { - $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\Resource'); - $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array($resourceModel), - '', - true, - true, - true, - array('getMainTable', 'getIdFieldName') + $resourceModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\App\Resource'); + $resource = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', + array($resourceModel), '', true, true, true, array('getMainTable', 'getIdFieldName') ); $resource->expects( @@ -58,13 +53,13 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'Magento\Event\ManagerInterface' ); - $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\EntityFactory' - ); - $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Logger'); + $entityFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Core\Model\EntityFactory'); + $logger = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Logger'); $this->_model = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection', array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $resource) ); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php index 1773df4f0b8da8198a76cf959c7df2287b8380b4..e66925ce7b856885722447219da047be9ae91590 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Db/ProfilerTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Db/ProfilerTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Core\Model\Resource\Db\Profiler + * Test for \Magento\Model\Resource\Db\Profiler * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class ProfilerTest extends \PHPUnit_Framework_TestCase { @@ -63,7 +63,7 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $localConfig = $objectManager->get('Magento\App\Arguments'); $connectionConfig = $localConfig->getConnection('default'); $connectionConfig['profiler'] = array( - 'class' => 'Magento\Core\Model\Resource\Db\Profiler', + 'class' => 'Magento\Model\Resource\Db\Profiler', 'enabled' => 'true' ); $connectionConfig['dbname'] = $connectionConfig['dbName']; @@ -92,9 +92,9 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $result->fetchAll(); } - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $queryProfiles = $profiler->getQueryProfiles($queryType); $this->assertCount(1, $queryProfiles); @@ -150,9 +150,9 @@ class ProfilerTest extends \PHPUnit_Framework_TestCase $testTableName = $resource->getTableName('core_resource'); $connection->query('SELECT * FROM ' . $testTableName); - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $queryProfiles = $profiler->getQueryProfiles(\Magento\DB\Profiler::SELECT); $this->assertCount(2, $queryProfiles); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php similarity index 88% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php index 019a03f82d936ba8aab04915fcf13933efc064d4..8b3b9f60d567520b430565e56c286f117520e2ea 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/Entity/TableTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/Entity/TableTest.php @@ -24,12 +24,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; class TableTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Entity\Table + * @var \Magento\Model\Resource\Entity\Table */ protected $_model; @@ -41,10 +41,8 @@ class TableTest extends \PHPUnit_Framework_TestCase $config->test_key = 'test'; // @codingStandardsIgnoreEnd - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Entity\Table', - array('config' => $config) - ); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Model\Resource\Entity\Table', array('config' => $config)); } public function testGetTable() diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php similarity index 74% rename from dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php rename to dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php index b863dc5187505161dcc65930558e1adb1aabbe4c..de6e27ee3303dce8c6fdb67cd78fcd55320cd494 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Resource/IteratorTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/Resource/IteratorTest.php @@ -24,12 +24,12 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; class IteratorTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Iterator + * @var \Magento\Model\Resource\Iterator */ protected $_model; @@ -42,18 +42,8 @@ class IteratorTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Iterator' - ); - } - - public function testWalk() - { - $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Store\Collection' - ); - $this->_model->walk($collection->getSelect(), array(array($this, 'walkCallback'))); - $this->assertGreaterThan(0, $this->_callbackCounter); + $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Model\Resource\Iterator'); } /** @@ -69,7 +59,7 @@ class IteratorTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testWalkException() { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php similarity index 86% rename from dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php rename to dev/tests/integration/testsuite/Magento/Model/ResourceTest.php index 601946d8f234e9c195b73683eddfcf9efed831b2..4fd86172af5ed1ed797c00f3cb70e636d89a5b2f 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/ResourceTest.php +++ b/dev/tests/integration/testsuite/Magento/Model/ResourceTest.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Core\Model\Resource + * Test for \Magento\Model\Resource * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; class ResourceTest extends \PHPUnit_Framework_TestCase { @@ -66,7 +66,10 @@ class ResourceTest extends \PHPUnit_Framework_TestCase 'Magento\TestFramework\Db\Adapter\Mysql', array( 'config' => array( - 'profiler' => array('class' => 'Magento\Core\Model\Resource\Db\Profiler', 'enabled' => 'true'), + 'profiler' => array( + 'class' => 'Magento\Model\Resource\Db\Profiler', + 'enabled' => 'true' + ), 'username' => 'username', 'password' => 'password', 'host' => 'host', @@ -76,10 +79,10 @@ class ResourceTest extends \PHPUnit_Framework_TestCase ) ); - /** @var \Magento\Core\Model\Resource\Db\Profiler $profiler */ + /** @var \Magento\Model\Resource\Db\Profiler $profiler */ $profiler = $connection->getProfiler(); - $this->assertInstanceOf('Magento\Core\Model\Resource\Db\Profiler', $profiler); + $this->assertInstanceOf('Magento\Model\Resource\Db\Profiler', $profiler); $this->assertTrue($profiler->getEnabled()); } } diff --git a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php index a04c44c0412f40003928a417db79fd7f87a22587..575383d026672e44ca77ff0ff8426b136e85d0b2 100644 --- a/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php +++ b/dev/tests/integration/testsuite/Magento/Multishipping/Block/Checkout/OverviewTest.php @@ -40,20 +40,18 @@ class OverviewTest extends \PHPUnit_Framework_TestCase protected function setUp() { + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); - $this->_block = $this->_objectManager->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Multishipping\Block\Checkout\Overview', - 'checkout_overview', - array( - 'data' => array( - 'renderer_template' => 'Magento_Multishipping::checkout/item/default.phtml', - 'row_renderer_template' => 'Magento_Multishipping::checkout/overview/item.phtml' + $this->_block = $this->_objectManager->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Multishipping\Block\Checkout\Overview', + 'checkout_overview', + array( + 'data' => array( + 'renderer_template' => 'Magento_Multishipping::checkout/item/default.phtml', + 'row_renderer_template' => 'Magento_Multishipping::checkout/overview/item.phtml' + ), ) - ) - ); + ); $this->_block->addChild('renderer.list', '\Magento\View\Element\RendererList'); $this->_block->getChildBlock( diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index 75202219d5fb5fcf77f8f0f2e54d699dc09604e0..735e14d41ddc17610084e474c29c467f6248199f 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -38,9 +38,9 @@ class QueueTest extends \PHPUnit_Framework_TestCase /** @var $objectManager \Magento\TestFramework\ObjectManager */ $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var $app \Magento\TestFramework\App */ - $app = $objectManager->get('Magento\Core\Model\App'); - $app->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager->get('Magento\App\State')->setAreaCode(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $area = $objectManager->get('Magento\App\AreaList')->getArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $area->load(); /** @var $filter \Magento\Newsletter\Model\Template\Filter */ $filter = $objectManager->get('Magento\Newsletter\Model\Template\Filter'); @@ -77,8 +77,10 @@ class QueueTest extends \PHPUnit_Framework_TestCase { $errorMsg = md5(microtime()); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $transport = $this->getMock('\Magento\Mail\TransportInterface'); $transport->expects( diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php deleted file mode 100644 index 6670f8be51e3a83183498fc453d650a26ebbe743..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -use Magento\Outbound\Authentication\Factory as AuthenticationFactory; -use Magento\Outbound\EndpointInterface; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var AuthenticationFactory */ - protected $_authFactory; - - protected function setUp() - { - $this->_authFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Outbound\Authentication\Factory', - array( - 'authenticationMap' => array( - EndpointInterface::AUTH_TYPE_HMAC => 'Magento\Outbound\Authentication\Hmac' - ) - ) - ); - } - - public function testGetFormatter() - { - $authObject = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $this->assertInstanceOf('Magento\Outbound\Authentication\Hmac', $authObject); - } - - public function testGetFormatterIsCached() - { - $authObject = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $authObject2 = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); - $this->assertSame($authObject, $authObject2); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php deleted file mode 100644 index 7d31e8189bac83eb0cf754f2e9abc54cfea06620..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -use Magento\Outbound\Formatter\Factory as FormatterFactory; -use Magento\Outbound\EndpointInterface; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var FormatterFactory */ - protected $_formatterFactory; - - protected function setUp() - { - $this->_formatterFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Outbound\Formatter\Factory', - array('formatterMap' => array(EndpointInterface::FORMAT_JSON => 'Magento\Outbound\Formatter\Json')) - ); - } - - public function testGetFormatter() - { - $formatter = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $this->assertInstanceOf('Magento\Outbound\Formatter\Json', $formatter); - } - - public function testGetFormatterIsCached() - { - $formatter = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $formatter2 = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); - $this->assertSame($formatter, $formatter2); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php deleted file mode 100644 index 4d5e8d28b75a9e3eef9b61da8face8b6f7ebc086..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\JsonTest - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - - -require_once __DIR__ . '/JsonTest/Data.php'; -class JsonTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Outbound\Formatter\Json */ - protected $_formatter; - - protected function setUp() - { - $this->_formatter = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Outbound\Formatter\Json' - ); - } - - /** - * @dataProvider encodeDataProvider - * - * @param $body - * @param $formattedBody - */ - public function testFormat($body, $formattedBody) - { - $this->assertSame($formattedBody, $this->_formatter->format($body)); - } - - /** - * DataProvider for testing the JSON formatter. - * - * @return array - */ - public function encodeDataProvider() - { - return array( - array(array(), "[]"), - array(array('a' => array('b' => 'c', 'd' => 'e'), 'f' => 'g'), '{"a":{"b":"c","d":"e"},"f":"g"}'), - array(array(null), '[null]'), - array(array(true), '[true]'), - array(array(false), '[false]'), - array(array(-1), '[-1]'), - array(array(0), '[0]'), - array(array(1), '[1]'), - array(array(2.4), '[2.4]'), - array(array(2.0), '[2]'), - array(array(new \Magento\Outbound\Formatter\JsonTest\Data('public', 'protected')), '[{"dataA":"public"}]') - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php deleted file mode 100644 index 9c5f1be9ce1e3c3c41dd9f38026a79205d724d3e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Class Data is a simple class to test converting a PHP class into JSON data - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage integration_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter\JsonTest; - -class Data -{ - public $dataA; - - protected $_dataB; - - public function __construct($first, $second) - { - $this->dataA = $first; - $this->_dataB = $second; - } - - public function getB() - { - return $this->_dataB; - } -} diff --git a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php index c23344c327cea3ae1c28348a330722c96c9a9fd7..6c9d5bc0304b3470b9e5c2545dcccf8fed8807ed 100644 --- a/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php +++ b/dev/tests/integration/testsuite/Magento/PageCache/Model/System/Config/Backend/TtlTest.php @@ -73,7 +73,7 @@ class TtlTest extends \PHPUnit_Framework_TestCase */ public function testBeforeSaveWithException($value, $path) { - $this->setExpectedException('\Magento\Core\Exception'); + $this->setExpectedException('\Magento\Model\Exception'); $this->_prepareData($value, $path); } diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php index 74a0963f0b64a3c080d8b1c9682bb255bc2fdec4..c5c02f63ee6cd798647e601d1d2e460ece8f3e02 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_express.php @@ -21,19 +21,11 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'payment/paypal_express/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('payment/paypal_express/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php index 08630bc7ba8abf73a6b125d95f0d21a45d38f2c2..54aba2fe7eed9cdee1e7bb643189a4234a830f1b 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_payflow.php @@ -22,13 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php index dc2b80c3f5b77dcc9a665052ed5dd9e44f11c95d..e255ed2b24e4ea35aa64c39057e8afdba1ffb13b 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/_files/quote_payment_standard.php @@ -21,13 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('adminhtml'); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\StoreManagerInterface' -)->getStore()->setConfig( - 'carriers/flatrate/active', - 1 -); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('adminhtml'); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface')->getStore() + ->setConfig('carriers/flatrate/active', 1); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( diff --git a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php index fa24b92209dbe115ad0df7696d1f9e8da430c5b9..cbd299281a7fb91a05595f298d6c4207864433fa 100644 --- a/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php +++ b/dev/tests/integration/testsuite/Magento/ProductAlert/Block/Email/StockTest.php @@ -47,14 +47,9 @@ class StockTest extends \PHPUnit_Framework_TestCase */ public function testThumbnail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getThumbnailSize(); diff --git a/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php b/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php deleted file mode 100644 index aebb49fa21ff5f7eafe8cef2c572b9fe4c70291e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/PubSub/EventTest.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - public function testGetters() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $this->assertEquals(array(), $event->getHeaders()); - $this->assertEquals($bodyData, $event->getBodyData()); - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals(\Magento\PubSub\Event::STATUS_READY_TO_SEND, $event->getStatus()); - } - - public function testMarkProcessed() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $event->complete(); - - $this->assertEquals(\Magento\PubSub\Event::STATUS_PROCESSED, $event->getStatus()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php index 8453d769cb5e5c338b076640865fe82651bb8e94..132642503a6bc07f24551078846611dcbdd964e4 100644 --- a/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php +++ b/dev/tests/integration/testsuite/Magento/Reports/_files/viewed_products.php @@ -22,12 +22,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - 'adminhtml', - \Magento\Core\Model\App\Area::PART_CONFIG -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea('adminhtml') + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_duplicated.php'; diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php new file mode 100644 index 0000000000000000000000000000000000000000..af89aac89ffc972d05a5e79d5798a6f8b10f07b6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/Edit/FormTest.php @@ -0,0 +1,54 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml\Edit; + +class FormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Review/_files/customer_review.php + */ + public function testCustomerOnForm() + { + /** @var \Magento\Customer\Model\Customer $customer */ + $customer = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Model\Customer') + ->setWebsiteId(1) + ->loadByEmail('customer@example.com'); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Review\Block\Adminhtml\Edit\Form'); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A' . __('<a href="%1" onclick="this.target=\'blank\'">%2 %3</a> <a href="mailto:%4">(%4)</a>', + '%A', + $escaper->escapeHtml($customer->getFirstname()), + $escaper->escapeHtml($customer->getLastname()), + $escaper->escapeHtml($customer->getEmail()) + ) . '%A', + $block->toHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ab88f39e7f7c365059ecf5a887c0390e1005870f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/Adminhtml/MainTest.php @@ -0,0 +1,53 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml; + +class MainTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea adminhtml + */ + public function testConstruct() + { + $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + /** @var \Magento\Customer\Service\V1\CustomerAccountService $service */ + $service = $objectManager->create('Magento\Customer\Service\V1\CustomerAccountService'); + $customer = $service->authenticate('customer@example.com', 'password'); + $request = $objectManager->get('Magento\App\RequestInterface'); + $request->setParam('customerId', $customer->getId()); + /** @var \Magento\View\LayoutInterface $layout */ + $layout = $objectManager->get('Magento\View\LayoutInterface'); + $block = $layout->createBlock('Magento\Review\Block\Adminhtml\Main'); + $customerName = $customer->getFirstname() . ' ' . $customer->getLastname(); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A' . __('All Reviews of Customer `%1`', $escaper->escapeHtml($customerName)) . '%A', + $block->getHeaderHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e43088ec2b2ad9692f2592009578e40f19330850 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/Block/FormTest.php @@ -0,0 +1,52 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Review\Block; + +class FormTest extends \PHPUnit_Framework_TestCase +{ + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea frontend + */ + public function testCustomerOnForm() + { + $session = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Customer\Model\Session'); + $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Customer\Service\V1\CustomerAccountService'); + $customer = $service->authenticate('customer@example.com', 'password'); + $session->setCustomerDataAsLoggedIn($customer); + $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Review\Block\Form'); + /** @var \Magento\Escaper $escaper */ + $escaper = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\Escaper'); + $this->assertStringMatchesFormat( + '%A<input type="text" name="nickname" id="nickname_field" class="input-text"' + . ' data-validate="{required:true}" value="' + . $escaper->escapeHtml($customer->getFirstname()) . '" />%A', + $block->toHtml() + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php new file mode 100644 index 0000000000000000000000000000000000000000..1535b4f74d33c5422df7d0a27606ca2a9d4d59f7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Review/_files/customer_review.php @@ -0,0 +1,59 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +); + +require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; + +$review = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( + 'Magento\Review\Model\Review', + ['data' => [ + 'customer_id' => $customer->getId(), + 'title' => 'Review Summary', + 'detail' => 'Review text', + 'nickname' => 'Nickname', + ]] +); + +$review + ->setEntityId($review->getEntityIdByCode(\Magento\Review\Model\Review::ENTITY_PRODUCT_CODE)) + ->setEntityPkValue($product->getId()) + ->setStatusId(\Magento\Review\Model\Review::STATUS_PENDING) + ->setStoreId( + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + ->getStore()->getId() + ) + ->setStores([ + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') + ->getStore()->getId() + ]) + ->save(); + +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Registry')->register( + 'review_data', + $review +); diff --git a/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php new file mode 100644 index 0000000000000000000000000000000000000000..edf9cb192e52e80d8c292fc7dce5a0fce3a86e7e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Rss/Block/WishlistTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Block; + +class WishlistTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * Core data + * + * @var \Magento\Core\Helper\Data + */ + protected $_coreData; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + protected function setUp() + { + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_customerSession = $this->_objectManager->create('Magento\Customer\Model\Session'); + $this->_coreData = $this->_objectManager->create('Magento\Core\Helper\Data'); + + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testCustomerTitle() + { + $fixtureCustomerId = 1; + $this->_customerSession->loginById($fixtureCustomerId); + + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($fixtureCustomerId); + + /** @var \Magento\App\Helper\Context $contextHelper */ + $contextHelper = $this->_objectManager->create('Magento\App\Helper\Context'); + + $wishlistHelper = $this->_objectManager->create('Magento\Rss\Helper\WishlistRss', + [ + 'context' => $contextHelper, + 'customerSession' => $this->_customerSession + ] + ); + + /** @var \Magento\Catalog\Block\Product\Context $context */ + $contextBlock = $this->_objectManager->create( + 'Magento\Rss\Block\Context', + [ + 'request' => $contextHelper->getRequest(), + 'wishlistHelper' => $wishlistHelper + ] + ); + /** @var \Magento\App\Request\Http $request */ + $request = $contextHelper->getRequest(); + $request->setParam('wishlist_id', $wishlist->getId()); + $request->setParam('data', $this->_coreData->urlEncode($fixtureCustomerId)); + + /** @var \Magento\Rss\Block\Wishlist $block */ + $block = $this->_objectManager->create('Magento\Rss\Block\Wishlist', + [ + 'context' => $contextBlock + ] + ); + + /** @var \Magento\Escaper $escaper */ + $escaper = $this->_objectManager->create('Magento\Escaper'); + + $expectedSting = '%A' . __("<title><![CDATA[%1 %2's Wishlist]]></title>", + $escaper->escapeHtml($this->_customerSession->getCustomerDataObject()->getFirstname()), + $escaper->escapeHtml($this->_customerSession->getCustomerDataObject()->getLastname()) + ) . '%A'; + $this->assertStringMatchesFormat($expectedSting, $block->toHtml()); + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php index 1147544f6b2ba03fdb435d63ae7b183d9b31eb56..847c96368a982de1119f415423b199e1bc47dab3 100644 --- a/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php +++ b/dev/tests/integration/testsuite/Magento/Rss/Controller/CatalogTest.php @@ -164,22 +164,15 @@ class CatalogTest extends \Magento\TestFramework\TestCase\AbstractController */ protected function _loginAdmin() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $this->getRequest()->setServer( - array( - 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, - 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD - ) - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Backend\Model\UrlInterface' - )->turnOffSecretKey(); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $this->getRequest()->setServer(array( + 'PHP_AUTH_USER' => \Magento\TestFramework\Bootstrap::ADMIN_NAME, + 'PHP_AUTH_PW' => \Magento\TestFramework\Bootstrap::ADMIN_PASSWORD + )); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Backend\Model\UrlInterface') + ->turnOffSecretKey(); } } diff --git a/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php b/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php new file mode 100644 index 0000000000000000000000000000000000000000..88799cf4a052ed6ac79bd4b79f2d072eb393eaca --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Rss/Helper/WishlistRssTest.php @@ -0,0 +1,129 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Rss\Helper; + +class WishlistRssTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Customer\Model\Session + */ + protected $_customerSession; + + /** + * Core data + * + * @var \Magento\Core\Helper\Data + */ + protected $_coreData; + + /** + * @var \Magento\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\App\Helper\Context + */ + protected $_contextHelper; + + /** + * @var \Magento\Rss\Helper\WishlistRss + */ + protected $_wishlistHelper; + + /** + * @var int + */ + protected $_fixtureCustomerId; + + protected function setUp() + { + $this->_fixtureCustomerId = 1; + + $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->_customerSession = $this->_objectManager->create('Magento\Customer\Model\Session'); + $this->_coreData = $this->_objectManager->create('Magento\Core\Helper\Data'); + + $this->_contextHelper = $this->_objectManager->create('Magento\App\Helper\Context'); + $request = $this->_contextHelper->getRequest(); + $request->setParam('data', $this->_coreData->urlEncode($this->_fixtureCustomerId)); + + $this->_wishlistHelper = $this->_objectManager->create('Magento\Rss\Helper\WishlistRss', + [ + 'context' => $this->_contextHelper, + 'customerSession' => $this->_customerSession + ] + ); + + $this->_customerSession->loginById($this->_fixtureCustomerId); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoAppArea frontend + */ + public function testGetCustomer() + { + $this->assertEquals($this->_customerSession->getCustomerDataObject(), $this->_wishlistHelper->getCustomer()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testGetWishlistByParam() + { + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($this->_fixtureCustomerId); + $wishlist->load($wishlist->getId()); + + /** @var \Magento\App\Request\Http $request */ + $request = $this->_contextHelper->getRequest(); + $request->setParam('wishlist_id', $wishlist->getId()); + + $this->assertEquals($wishlist, $this->_wishlistHelper->getWishlist()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_increments.php + * @magentoAppArea frontend + */ + public function testGetWishlistByCustomerId() + { + /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ + $wishlist = $this->_objectManager->create('Magento\Wishlist\Model\Wishlist') + ->loadByCustomerId($this->_fixtureCustomerId); + + /** @var \Magento\App\Request\Http $request */ + $request = $this->_contextHelper->getRequest(); + $request->setParam('wishlist_id', ''); + + $this->assertEquals($wishlist, $this->_wishlistHelper->getWishlist()); + } +} + \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php index 85421462a8d87639d6dfa3d252c9cd676e41599c..908ea87a9b4aa5140f6376c26c5c92f2c3ebe72c 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Order/Create/Form/AbstractTest.php @@ -43,11 +43,8 @@ class AbstractTest extends \PHPUnit_Framework_TestCase public function testAddAttributesToForm() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface')->setDefaultDesignTheme(); $arguments = array( diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php index d990315e297e6ea066c6ae48b3f3e84cafffb51f..600ffdfb3297f8e6f4557ef0f6eafadff5dc8df0 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Adminhtml/Report/Filter/Form/CouponTest.php @@ -36,18 +36,17 @@ namespace Magento\Sales\Block\Adminhtml\Report\Filter\Form; class CouponTest extends \PHPUnit_Framework_TestCase { /** - * Application object + * Layout * - * @var \Magento\Core\Model\App + * @var \Magento\View\LayoutInterface */ - protected $_application; + protected $_layout; protected function setUp() { parent::setUp(); - $this->_application = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - ); + $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\LayoutInterface'); } /** @@ -56,9 +55,7 @@ class CouponTest extends \PHPUnit_Framework_TestCase public function testAfterToHtml() { /** @var $block \Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon */ - $block = $this->_application->getLayout()->createBlock( - 'Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon' - ); + $block = $this->_layout->createBlock('Magento\Sales\Block\Adminhtml\Report\Filter\Form\Coupon'); $block->setFilterData(new \Magento\Object()); $html = $block->toHtml(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php index 1bd919d5c5e8be5c12b08a1ad0acdbdf59259b59..cc15c5f001701dfb425236d158e0a82b47fe79df 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Block/Order/CommentsTest.php @@ -77,7 +77,7 @@ class CommentsTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetCommentsWrongEntityException() { diff --git a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php index e52fc87dd8495e962708a8d16bc865c8d2c1d540..b7c94c44d7078e3bbdf285af62dbc12f786a9fea 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreateTest.php @@ -157,4 +157,28 @@ class CreateTest extends \Magento\Backend\Utility\Controller array('', true, 'Magento_Sales::actions') ); } + + + /** + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @magentoAppArea adminhtml + */ + public function testConfigureProductToAddAction() + { + $this->getRequest()->setParam('id', 1) + ->setParam('isAjax', true); + + $this->dispatch('backend/sales/order_create/configureProductToAdd'); + + $body = $this->getResponse()->getBody(); + + $this->assertNotEmpty($body); + $this->assertContains('>Quantity</label>', $body); + $this->assertContains('>Test Configurable</label>', $body); + $this->assertContains('"code":"test_configurable","label":"Test Configurable"', $body); + $this->assertContains('"label":"Option 1","price":"5","oldPrice":"5","products":[', $body); + $this->assertContains('"label":"Option 2","price":"5","oldPrice":"5","products":[', $body); + $this->assertContains('"basePrice":"100","oldPrice":"100","productId":"1","chooseText":"Choose an Option..."', + $body); + } } diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php index 756cff856d1cfaf1200b7d3bd6fa404b3df32779..570c9abb8a67c58a5ad6f3da28c213023baf8031 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/AdminOrder/CreateTest.php @@ -277,7 +277,7 @@ class CreateTest extends \PHPUnit_Framework_TestCase try { $this->_model->createOrder(); $this->fail('Validation errors are expected to lead to exception during createOrder() call.'); - } catch (\Magento\Core\Exception $e) { + } catch (\Magento\Model\Exception $e) { /** createOrder is expected to throw exception with empty message when validation error occurs */ } $errorMessages = array(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php index 70a54bcff6d2b95e3a2491cfb401755611564383..940cf587a4e6fde4b70bfd96b161753c06a4a568 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/CreditmemoTest.php @@ -33,12 +33,10 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase */ public function testSendEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php index 45e8f74f42140fd3f7666103841780e54d027a37..cb747bc161a777f1221e384aa4dc98c1e334fbc7 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/InvoiceTest.php @@ -33,12 +33,10 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase */ public function testSendEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php index 986e00ea29289e7f77a5f385657966daaab76ca4..fc2f3d6342df3db521f6547076a1b7a484d00c30 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php +++ b/dev/tests/integration/testsuite/Magento/Sales/Model/Order/OrderTest.php @@ -33,12 +33,10 @@ class OrderTest extends \PHPUnit_Framework_TestCase */ public function testSendNewOrderEmail() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Sales\Model\Order'); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Sales\Model\Order'); $order->loadByIncrementId('100000001'); $order->setCustomerEmail('customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php index a64957bf7cfc65a29a8e457aefec234844d230c0..5cb6328ae1b0daf6985a9354c809d185399df9c1 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice.php @@ -34,7 +34,6 @@ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( $invoice = $orderService->prepareInvoice(); $invoice->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php index eae3988b0f89f21550d2e42e5b3f5cc6aa024f24..4a183d932f29098921a989340174c64d096d0efe 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_fixture_store_order.php @@ -34,7 +34,6 @@ $orderService = \Magento\TestFramework\ObjectManager::getInstance()->create( $invoice = $orderService->prepareInvoice(); $invoice->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php index 22519ca399d59bf1a35af9d17cfc7cfe14fb5f9e..74104e8bfbacc9b403893727a2e014b5ca7fcd1e 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/invoice_payflowpro.php @@ -35,7 +35,6 @@ $invoice = $orderService->prepareInvoice(); /** To allow invoice cancelling it should be created without capturing. */ $invoice->setRequestedCaptureCase(\Magento\Sales\Model\Order\Invoice::NOT_CAPTURE)->register(); $order->setIsInProcess(true); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction'); $transactionSave->addObject($invoice)->addObject($order)->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php index 229758d86870b0d4bfd65abf99517d760df61308..cdfa0326eb98178116ea88312cf6edffa5960850 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_info.php @@ -25,11 +25,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); /** @var $product \Magento\Catalog\Model\Product */ $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); @@ -136,13 +133,10 @@ foreach ($creditmemo->getAllItems() as $creditmemoItem) { $creditmemo->register(); $creditmemo->save(); -$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Transaction' -)->addObject( - $creditmemo -)->addObject( - $creditmemo->getOrder() -); +$transactionSave = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\DB\Transaction') + ->addObject($creditmemo) + ->addObject($creditmemo->getOrder()); if ($creditmemo->getInvoice()) { $transactionSave->addObject($creditmemo->getInvoice()); } diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php index 4342c567bd8680afa1de6dbe434aa133533c6783..51e48d41f0bea7f98ccc38100622f3809e620c08 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/order_paid_with_saved_cc.php @@ -25,9 +25,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\App $app */ -$app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); -$app->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $addressData = include __DIR__ . '/address_data.php'; diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php index d1e5c8066758bae39f73c72d0593c9acb1e615c3..da673e38d43a02d9af3cca5dde51a27b0ca2fe16 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php @@ -24,7 +24,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea('frontend'); +\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea('frontend'); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Catalog\Model\Product'); $product->setTypeId( 'simple' diff --git a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php index 8cb1e7b6e990d30e954815a66d7d70c33e288ae6..b88a6634f8d5b75790748cad80616e1926497cb5 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rate/ImportExportTest.php @@ -35,16 +35,10 @@ class ImportExportTest extends \PHPUnit_Framework_TestCase protected function setUp() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); - $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\LayoutInterface' - )->createBlock( - 'Magento\Tax\Block\Adminhtml\Rate\ImportExport' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); + $this->_block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\LayoutInterface') + ->createBlock('Magento\Tax\Block\Adminhtml\Rate\ImportExport'); } protected function tearDown() diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php index ed356b343ecec66427fb5a7448267438a9802449..859a109f8efe0320d49bd572d6dae815a095924b 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/ClassTest.php @@ -48,7 +48,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase \Magento\Tax\Model\ClassModel::TAX_CLASS_TYPE_CUSTOMER )->getFirstItem(); - $this->setExpectedException('Magento\Core\Exception'); + $this->setExpectedException('Magento\Model\Exception'); $model->checkClassCanBeDeleted(); } @@ -90,7 +90,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase $model->getId() )->save(); - $this->setExpectedException('Magento\Core\Exception'); + $this->setExpectedException('Magento\Model\Exception'); $model->checkClassCanBeDeleted(); } @@ -130,7 +130,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\ClassModel */ $model = $this->_objectManager->create('Magento\Tax\Model\ClassModel')->load($customerClasses[0]); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', 'You cannot delete this tax class because it is used in' . ' Tax Rules. You have to delete the rules it is used in first.' ); @@ -152,7 +152,7 @@ class ClassTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\ClassModel */ $model = $this->_objectManager->create('Magento\Tax\Model\ClassModel')->load($productClasses[0]); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', 'You cannot delete this tax class because it is used in' . ' Tax Rules. You have to delete the rules it is used in first.' ); diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php index 1978887042cc954858f7ea40e6d5fe4372a931fa..184bd170800c8593583983af4e5fe2e2d64faa8f 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Rate/CsvImportHandlerTest.php @@ -75,7 +75,7 @@ class CsvImportHandlerTest extends \PHPUnit_Framework_TestCase /** * @magentoDbIsolation enabled - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage One of the countries has invalid code. */ public function testImportFromCsvFileThrowsExceptionWhenCountryCodeIsInvalid() diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php index c0b86b6098968354644de1303890f0cb39a0ffb4..add9eae9b65bd12dd18c50fdc2b3d0f81c949cba 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/Resource/Calculation/Rule/CollectionTest.php @@ -73,7 +73,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase /** * Test setClassTypeFilter with wrong Class Type * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testSetClassTypeFilterWithWrongType() { diff --git a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php index c7a948789687643d5718e914714bca7be4f70f72..fa9b2a2413ecddd6a7a3032a4630a4e763c82e62 100644 --- a/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php +++ b/dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php @@ -58,7 +58,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase /** @var $model \Magento\Tax\Model\TaxClass\Type\Customer */ $model = $this->_objectManager->create('Magento\Tax\Model\TaxClass\Type\Customer'); $model->setId(self::TAX_CLASS_ID); - /** @var $collection \Magento\Core\Model\Resource\Db\Collection\AbstractCollection */ + /** @var $collection \Magento\Model\Resource\Db\Collection\AbstractCollection */ $collection = $model->getAssignedToObjects(); $this->assertEquals(self::TAX_CLASS_ID, $collection->getFirstItem()->getData('tax_class_id')); $this->assertEquals(self::GROUP_CODE, $collection->getFirstItem()->getData('customer_group_code')); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php index 342ae4db75a7aca811a2570a42268e3fb836fa5e..6a86defe013cb4d83261aee65c4d5db20ea28844 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/BlockInstantiationTest.php @@ -57,9 +57,7 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID, \Magento\Customer\Model\Group::NOT_LOGGED_IN_ID ); - /** @var \Magento\Core\Model\App $app */ - $app = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App'); - $app->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create($class); $this->assertNotNull($block); @@ -145,13 +143,11 @@ class BlockInstantiationTest extends \Magento\TestFramework\TestCase\AbstractInt ) { $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); - $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] = array($module, $blockClass, $area); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); + $templateBlocks[$module . ', ' . $blockClass . ', ' . $area] + = array($module, $blockClass, $area); return $templateBlocks; } } diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php index 83a956a9c77f4be60b70e9ca899ee76e55a9e069..cecd3f6f219a1861b2faffed14431add5b9ce3fe 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -49,7 +49,7 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase */ public function testLayoutArguments($area, $layoutFile) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App')->loadArea($area); + \Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea($area); $dom = new \DOMDocument(); $dom->load($layoutFile); $xpath = new \DOMXPath($dom); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php index 6d2639cc8233f2e953f0ff753e8437374f71b3b8..7094313503b71b15d1be46c1469cb5270be3e475 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/TemplateFilesTest.php @@ -106,12 +106,9 @@ class TemplateFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrit $area = 'adminhtml'; } - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - $area, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea($area) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->get('Magento\Config\ScopeInterface') ->setCurrentScope($area); diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php index 1cc5cbfe1b042fd57dcd1b5e9496bce6b322b577..158eba67b8cbfd3258ae6013e53901f6d721981b 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/ViewFilesTest.php @@ -37,19 +37,14 @@ class ViewFilesTest extends \Magento\TestFramework\TestCase\AbstractIntegrity * @param string $file */ function ($application, $file) { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - $application - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\FileSystem' - )->getViewFile( - $file - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea($application); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $result = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->get('Magento\View\FileSystem') + ->getViewFile($file); $this->assertFileExists($result); }, $this->viewFilesFromModulesViewDataProvider() diff --git a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php index 78de4a3d734ef515f17155838e07fc62ac9b4337..5b542f6c50714b673727501f3396779de48f8030 100644 --- a/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php +++ b/dev/tests/integration/testsuite/Magento/Translate/InlineTest.php @@ -35,6 +35,11 @@ class InlineTest extends \PHPUnit_Framework_TestCase */ protected $_storeId = 'default'; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $state; + public static function setUpBeforeClass() { \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\State')->setAreaCode('frontend'); @@ -50,6 +55,9 @@ class InlineTest extends \PHPUnit_Framework_TestCase $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Translate\Inline' ); + $this->state = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( + 'Magento\Translate\Inline\StateInterface' + ); /* Called getConfig as workaround for setConfig bug */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( 'Magento\Core\Model\StoreManagerInterface' @@ -81,7 +89,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase ) ) ); - $this->_model->disable(); + $this->state->suspend(); $this->assertFalse($this->_model->isAllowed()); $this->assertFalse($this->_model->isAllowed($this->_storeId)); $this->assertFalse( diff --git a/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html b/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html index 979aa22786d5a78861e8948df5c455f1b9f69b6d..a031b1ee3228e89612857f8faf0512f014b79afd 100644 --- a/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html +++ b/dev/tests/integration/testsuite/Magento/Translate/_files/_inline_page_expected.html @@ -43,7 +43,7 @@ (function($){ $(document).ready(function() { $(this).translateInline({ - ajaxUrl: 'http://localhost/index.php/core/ajax/translate/', + ajaxUrl: 'http://localhost/index.php/translation/ajax/index/', area: 'frontend', editTrigger: {img: 'http://localhost/pub/media/theme/static/frontend/{{design_package}}/default/en_US/Magento_Core/fam_book_open.png'} }); diff --git a/dev/tests/integration/testsuite/Magento/TranslateTest.php b/dev/tests/integration/testsuite/Magento/TranslateTest.php index 7f066d9f7aa067fcf7210a57ab9ab7e97715b73d..0ad27a46c0c86f7203ddd35d70e6edf2b7001ba0 100644 --- a/dev/tests/integration/testsuite/Magento/TranslateTest.php +++ b/dev/tests/integration/testsuite/Magento/TranslateTest.php @@ -48,18 +48,6 @@ class TranslateTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $pathChunks = array( - __DIR__, - 'Core', - 'Model', - '_files', - 'design', - 'frontend', - 'test_default', - 'i18n', - 'en_US.csv' - ); - $this->_viewFileSystem = $this->getMock( 'Magento\View\FileSystem', array('getFilename', 'getDesignTheme'), @@ -68,13 +56,12 @@ class TranslateTest extends \PHPUnit_Framework_TestCase false ); - $this->_viewFileSystem->expects( - $this->any() - )->method( - 'getFilename' - )->will( - $this->returnValue(implode('/', $pathChunks)) - ); + $this->_viewFileSystem->expects($this->any()) + ->method( + 'getFilename' + )->will( + $this->returnValue(__DIR__ . '/Core/Model/_files/design/frontend/test_default/i18n/en_US.csv') + ); $theme = $this->getMock('\Magento\View\Design\ThemeInterface', array()); $theme->expects($this->any())->method('getId')->will($this->returnValue(10)); @@ -110,37 +97,38 @@ class TranslateTest extends \PHPUnit_Framework_TestCase $objectManager->addSharedInstance($this->_designModel, 'Magento\Core\Model\View\Design\Proxy'); $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND); + $objectManager->addSharedInstance($this->_model, 'Magento\Translate'); + $objectManager->removeSharedInstance('Magento\Phrase\Renderer\Composite'); + $objectManager->removeSharedInstance('Magento\Phrase\Renderer\Translate'); + \Magento\Phrase::setRenderer($objectManager->get('Magento\Phrase\RendererInterface')); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND); } /** - * @magentoDataFixture Magento/Core/_files/db_translate.php + * @magentoDataFixture Magento/Translation/_files/db_translate.php * @magentoDataFixture Magento/Backend/controllers/_files/cache/all_types_enabled.php * @covers \Magento\Backend\Model\Resource\Translate::_getStoreId * @covers \Magento\Backend\Model\Resource\Translate\String::_getStoreId */ - public function testInitCaching() + public function testLoadDataCaching() { - // ensure string translation is cached - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null); - - /** @var \Magento\Core\Model\Resource\Translate\String $translateString */ + /** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('Fixture String', 'New Db Translation'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->assertEquals( - 'Fixture Db Translation', - $this->_model->translate(array('Fixture String')), + 'Fixture Db Translation', + __('Fixture String'), 'Translation is expected to be cached' ); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND, null, true); + $this->_model->loadData(\Magento\Core\Model\App\Area::AREA_FRONTEND, true); $this->assertEquals( - 'New Db Translation', - $this->_model->translate(array('Fixture String')), + 'New Db Translation', + __('Fixture String'), 'Forced load should not use cache' ); } @@ -151,10 +139,7 @@ class TranslateTest extends \PHPUnit_Framework_TestCase */ public function testTranslate($inputText, $expectedTranslation) { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate'); - $this->_model->init(\Magento\Core\Model\App\Area::AREA_FRONTEND); - - $actualTranslation = $this->_model->translate(array($inputText)); + $actualTranslation = __($inputText); $this->assertEquals($expectedTranslation, $actualTranslation); } @@ -170,11 +155,4 @@ class TranslateTest extends \PHPUnit_Framework_TestCase array('Design value to translate', 'Design translated value') ); } - - public function testGetSetTranslateInline() - { - $this->assertEquals(true, $this->_model->getTranslateInline()); - $this->_model->setTranslateInline(false); - $this->assertEquals(false, $this->_model->getTranslateInline()); - } } diff --git a/dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php similarity index 79% rename from dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php index 17fa32f5b2721e05abb31a95b3b80e78c2ab41cb..385dc44315ee23bc27fb6e1ecf9a8eed7659fd5c 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Controller/AjaxTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Controller/AjaxTest.php @@ -18,27 +18,25 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Controller; + +namespace Magento\Translation\Controller; class AjaxTest extends \Magento\TestFramework\TestCase\AbstractController { /** - * @dataProvider translateActionDataProvider + * @dataProvider indexActionDataProvider */ - public function testTranslateAction($postData) + public function testIndexAction($postData) { $this->getRequest()->setPost('translate', $postData); - $this->dispatch('core/ajax/translate'); + $this->dispatch('translation/ajax/index'); $this->assertEquals('{success:true}', $this->getResponse()->getBody()); } - public function translateActionDataProvider() + public function indexActionDataProvider() { return array(array('test'), array(array('test'))); } diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php similarity index 91% rename from dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php index dab5c946478ccbea7050b6949201973792c692ef..5211f3c32c7d3832339d5f9093dc338cc8a52477 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/InlineParserTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/InlineParserTest.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate; + +namespace Magento\Translation\Model; class InlineParserTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Translate\Inline\Parser + * @var \Magento\Translation\Model\Inline\Parser */ protected $_inlineParser; @@ -48,9 +46,10 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase protected function setUp() { /** @var $inline \Magento\Translate\Inline */ - $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Translate\Inline'); + $inline = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Translate\Inline'); $this->_inlineParser = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\Inline\Parser', + 'Magento\Translation\Model\Inline\Parser', array('translateInline' => $inline) ); /* Called getConfig as workaround for setConfig bug */ @@ -83,7 +82,7 @@ class InlineParserTest extends \PHPUnit_Framework_TestCase $this->_inlineParser->processAjaxPost($inputArray); $model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\String' + 'Magento\Translation\Model\String' ); $model->load($originalText); try { diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php similarity index 81% rename from dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php rename to dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php index a8c7d53497fa90e4f4b28b4fbc574d2451336550..1703515679b1883ad84a459813d0754d3dcc9477 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Translate/StringTest.php +++ b/dev/tests/integration/testsuite/Magento/Translation/Model/StringTest.php @@ -18,31 +18,29 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate; + +namespace Magento\Translation\Model; class StringTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Translate\String + * @var \Magento\Translation\Model\String */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Translate\String' + 'Magento\Translation\Model\String' ); } public function testConstructor() { - $this->assertInstanceOf('Magento\Core\Model\Resource\Translate\String', $this->_model->getResource()); + $this->assertInstanceOf('Magento\Translation\Model\Resource\String', $this->_model->getResource()); } public function testSetGetString() diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php similarity index 89% rename from dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php rename to dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php index f8a7fd6458e5d630919aadf16980b9bae7db75ca..97239d9ff2aaee7e0e9116fdf927373dd12c3842 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate.php @@ -22,8 +22,8 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** @var \Magento\Core\Model\Resource\Translate\String $translateString */ +/** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('Fixture String', 'Fixture Db Translation'); diff --git a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php similarity index 84% rename from dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php rename to dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php index 8007a6d4776741cbf21de8ebc6635273588ee8c2..51ef0a7601d8a2c6d86c78625dee8e2fbf1fec23 100644 --- a/dev/tests/integration/testsuite/Magento/Core/_files/db_translate_admin_store.php +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/db_translate_admin_store.php @@ -23,13 +23,14 @@ */ \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, + 'Magento\App\AreaList' +)->getArea( + \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE +)->load( \Magento\Core\Model\App\Area::PART_CONFIG ); -/** @var \Magento\Core\Model\Resource\Translate\String $translateString */ +/** @var \Magento\Translation\Model\Resource\String $translateString */ $translateString = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Core\Model\Resource\Translate\String' + 'Magento\Translation\Model\Resource\String' ); $translateString->saveTranslate('string to translate', 'predefined string translation', null); diff --git a/dev/tests/integration/testsuite/Magento/UrlTest.php b/dev/tests/integration/testsuite/Magento/UrlTest.php index c6a2dcd29566ce82921ccef3e48af25e747cf771..ea0b91fd9b61ef019ae3bb5c5e676f40f4832396 100644 --- a/dev/tests/integration/testsuite/Magento/UrlTest.php +++ b/dev/tests/integration/testsuite/Magento/UrlTest.php @@ -102,15 +102,14 @@ class UrlTest extends \PHPUnit_Framework_TestCase public function testGetBaseUrlWithTypeRestoring() { /** - * Get base ull with default type + * Get base URL with default type */ $this->assertEquals('http://localhost/index.php/', $this->_model->getBaseUrl(), 'Incorrect link url'); /** * Set specified type */ - $this->_model->setType(\Magento\UrlInterface::URL_TYPE_WEB); - $webUrl = $this->_model->getBaseUrl(); + $webUrl = $this->_model->getBaseUrl(['_type' => \Magento\UrlInterface::URL_TYPE_WEB]); $this->assertEquals('http://localhost/', $webUrl, 'Incorrect web url'); $this->assertEquals('http://localhost/index.php/', $this->_model->getBaseUrl(), 'Incorrect link url'); diff --git a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php index b1a03217d44261ca323c06c876005f75b29a3125..7c7254b3f6ea2d382f022e8a936bd4ddbd1e4be2 100644 --- a/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php +++ b/dev/tests/integration/testsuite/Magento/User/Model/UserTest.php @@ -184,10 +184,8 @@ class UserTest extends \PHPUnit_Framework_TestCase public function testGetCollection() { - $this->assertInstanceOf( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', - $this->_model->getCollection() - ); + $this->assertInstanceOf('Magento\Model\Resource\Db\Collection\AbstractCollection', + $this->_model->getCollection()); } public function testGetName() @@ -313,7 +311,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage User Name is a required field. * @expectedExceptionMessage First Name is a required field. * @expectedExceptionMessage Last Name is a required field. @@ -363,7 +361,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password confirmation must match your password. * @magentoDbIsolation enabled */ @@ -375,7 +373,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password must include both numeric and alphabetic characters. * @magentoDbIsolation enabled */ @@ -387,7 +385,7 @@ class UserTest extends \PHPUnit_Framework_TestCase /** * @dataProvider beforeSavePasswordInsecureDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Your password must include both numeric and alphabetic characters. * @magentoDbIsolation enabled * @param string $password @@ -404,7 +402,7 @@ class UserTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage A user with the same user name or email already exists. * @magentoDbIsolation enabled */ diff --git a/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php b/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php index 25980f5aca0e45f3046bee0f7ce0d836c1f1c9f8..0c3b7f65e03b59e4169f33f42fe5fa9620ac96c4 100644 --- a/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php +++ b/dev/tests/integration/testsuite/Magento/User/_files/dummy_user.php @@ -28,11 +28,9 @@ /** * Create dummy user */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); + +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( 'Dummy' @@ -47,11 +45,8 @@ $user->setFirstname( )->save(); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE -); +\Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\User\Model\User'); $user->setFirstname( 'CreateDate' diff --git a/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php b/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php index ecd6c253aa646de6aceb1c6ac9e6be2cb1096197..7cf081f70b4a1af10626d29dec93e6c2aa404c08 100644 --- a/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Design/Theme/ValidatorTest.php @@ -67,7 +67,7 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase /** * Get theme model * - * @return \Magento\Core\Model\AbstractModel + * @return \Magento\Model\AbstractModel */ protected function _getThemeModel() { diff --git a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php index d9bea1241e3d09863536733227420e7725a00e13..6713a818d90954c98a6735c97269a552327f322d 100644 --- a/dev/tests/integration/testsuite/Magento/View/PublicationTest.php +++ b/dev/tests/integration/testsuite/Magento/View/PublicationTest.php @@ -358,7 +358,8 @@ class PublicationTest extends \PHPUnit_Framework_TestCase ) ); - $objectManager->get('Magento\Core\Model\App')->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); $this->viewUrl->getViewFileUrl($cssViewFile, $designParams); @@ -643,12 +644,9 @@ class PublicationTest extends \PHPUnit_Framework_TestCase ) ) ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG - ); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $themeCollection \Magento\Core\Model\Theme\Collection */ $themeCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( diff --git a/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php b/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php index 6f40f04a19c8119a4fc38db8bce206daab2ec31d..707147d3a095f4c4da37153013e7e03b5148dff9 100644 --- a/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php +++ b/dev/tests/integration/testsuite/Magento/View/_files/design/themes.php @@ -24,15 +24,14 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure( - array('preferences' => array('Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data')) -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( + 'preferences' => array( + 'Magento\Core\Model\Theme' => 'Magento\Core\Model\Theme\Data' + ) +)); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Theme\Registration' diff --git a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php index 8a08c250006891aabd8f232961e2b342606cf2d3..03e3128ec5e54b7da101f3f219839711a73b8e98 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Model/WidgetTest.php @@ -69,11 +69,8 @@ class WidgetTest extends \PHPUnit_Framework_TestCase ' "new_products" widget in Catalog module' ); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); $objectManager->get('Magento\View\DesignInterface')->setDesignTheme('magento_backend'); $expectedFilePath = "/adminhtml/magento_backend/en_US/{$expectedFile}"; $expectedPubFile = $objectManager->get( diff --git a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php index 4e456f4493afa7e9a2398cf6ddaf044a1f767829..34815b00ba9257a73b1da2eeb626be2147de3f12 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php +++ b/dev/tests/integration/testsuite/Magento/Widget/_files/themes.php @@ -24,12 +24,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' -)->loadAreaPart( - \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE, - \Magento\Core\Model\App\Area::PART_CONFIG -); +\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\App\AreaList') + ->getArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) + ->load(\Magento\Core\Model\App\Area::PART_CONFIG); /** @var $registration \Magento\Core\Model\Theme\Registration */ $registration = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( 'Magento\Core\Model\Theme\Registration' diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php index 3a50eb01377678717f86df243ba533b0464724b2..eee2825692a56cc65183423547f7543931ef4294 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/AbstractTest.php @@ -37,19 +37,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); $this->_block = $this->getMockForAbstractClass( - 'Magento\Wishlist\Block\AbstractBlock', + 'Magento\Wishlist\Block\AbstractBlock', array( - $objectManager->get('Magento\View\Element\Template\Context'), - $objectManager->get('Magento\Catalog\Model\Config'), - $objectManager->get('Magento\Registry'), - $objectManager->get('Magento\Tax\Helper\Data'), - $objectManager->get('Magento\Catalog\Helper\Data'), - $objectManager->get('Magento\Math\Random'), - $objectManager->get('Magento\Checkout\Helper\Cart'), - $objectManager->get('Magento\Wishlist\Helper\Data'), - $objectManager->get('Magento\Catalog\Helper\Product\Compare'), - $objectManager->get('Magento\Theme\Helper\Layout'), - $objectManager->get('Magento\Catalog\Helper\Image'), + $objectManager->get('Magento\Catalog\Block\Product\Context'), $objectManager->get('Magento\App\Http\Context'), $objectManager->get('Magento\Catalog\Model\ProductFactory'), ) @@ -62,17 +52,12 @@ class AbstractTest extends \PHPUnit_Framework_TestCase */ public function testImage() { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\Core\Model\App' - )->loadArea( - \Magento\Core\Model\App\Area::AREA_FRONTEND - ); - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - 'Magento\View\DesignInterface' - )->setDefaultDesignTheme(); - $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Catalog\Model\Product' - ); + \Magento\TestFramework\Helper\Bootstrap::getInstance() + ->loadArea(\Magento\Core\Model\App\Area::AREA_FRONTEND); + \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\View\DesignInterface') + ->setDefaultDesignTheme(); + $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() + ->create('Magento\Catalog\Model\Product'); $product->load(1); $size = $this->_block->getImageSize(); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php index 3b030637ca0a49ab78fa27413b098567f60763d1..4051cf223e6f7ec1f27227758083c8e90490cc16 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist.php @@ -29,7 +29,7 @@ require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; $wishlist = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Wishlist\Model\Wishlist'); -$wishlist->loadByCustomer($customer->getId(), true); +$wishlist->loadByCustomerId($customer->getId(), true); $item = $wishlist->addNewItem($product, new \Magento\Object(array())); // 'product' => '1', // 'related_product' => '', diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php index 15820eb08e36c559357eacd04ad3a10f54abe5a2..8ad43321ad96a78c98d36d3f15969a851fe60aa4 100644 --- a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_increments.php @@ -37,6 +37,6 @@ $product->setStockData(array('enable_qty_increments' => 1, 'qty_increments' => 5 /** @var \Magento\Wishlist\Model\Wishlist $wishlist */ $wishlist = $objectManager->create('Magento\Wishlist\Model\Wishlist'); -$wishlist->loadByCustomer($customer->getId(), true); +$wishlist->loadByCustomerId($customer->getId(), true); $wishlist->addNewItem($product); $wishlist->save(); diff --git a/dev/tests/performance/framework/Magento/TestFramework/Application.php b/dev/tests/performance/framework/Magento/TestFramework/Application.php index d47b31f0d39802b35605e07989935b26e06088ac..1485f2535663843c69f89798984dc3fb2cf84c77 100644 --- a/dev/tests/performance/framework/Magento/TestFramework/Application.php +++ b/dev/tests/performance/framework/Magento/TestFramework/Application.php @@ -43,13 +43,6 @@ class Application */ protected $_config; - /** - * Application object - * - * @var \Magento\Core\Model\App - */ - protected $_application; - /** * Path to shell installer script * @@ -211,8 +204,6 @@ class Application */ protected function _bootstrap() { - /** @var $app \Magento\Core\Model\App */ - $this->_application = $this->getObjectManager()->get('Magento\Core\Model\App'); $this->getObjectManager()->configure( $this->getObjectManager()->get('Magento\App\ObjectManager\ConfigLoader')->load(self::AREA_CODE) ); diff --git a/dev/tests/performance/testsuite/home_page.jmx b/dev/tests/performance/testsuite/home_page.jmx index eb502c8233e4a6eb43c90e441e9120b1f606f6be..1c3a9155c3ec0376474b130fdd91318c4fec2932 100644 --- a/dev/tests/performance/testsuite/home_page.jmx +++ b/dev/tests/performance/testsuite/home_page.jmx @@ -25,7 +25,7 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<jmeterTestPlan version="1.2" properties="2.1"> +<jmeterTestPlan version="1.2" properties="2.5" jmeter="2.10 r1533061"> <hashTree> <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true"> <stringProp name="TestPlan.comments"></stringProp> @@ -63,7 +63,7 @@ <stringProp name="ThreadGroup.delay"></stringProp> </ThreadGroup> <hashTree> - <HTTPSampler guiclass="HttpTestSampleGui" testclass="HTTPSampler" testname="Home Page" enabled="true"> + <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="Home Page" enabled="true"> <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true"> <collectionProp name="Arguments.arguments"/> </elementProp> @@ -79,14 +79,15 @@ <boolProp name="HTTPSampler.auto_redirects">false</boolProp> <boolProp name="HTTPSampler.use_keepalive">true</boolProp> <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp> + <stringProp name="HTTPSampler.implementation">Java</stringProp> <boolProp name="HTTPSampler.monitor">false</boolProp> <stringProp name="HTTPSampler.embedded_url_re"></stringProp> - </HTTPSampler> + </HTTPSamplerProxy> <hashTree> <ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Assertion" enabled="true"> <collectionProp name="Asserion.test_strings"> <stringProp name="571386695"><title>Home page</title></stringProp> - <stringProp name="-769309143"><h2>Home Page</h2></stringProp> + <stringProp name="1747020609"><h1 class="title"><span class="base" data-ui-id="page-title" >Home Page</span></h1></stringProp> </collectionProp> <stringProp name="Assertion.test_field">Assertion.response_data</stringProp> <boolProp name="Assertion.assume_success">false</boolProp> diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt index 09c097335f2a1e6ed4b7554a0a92a44c539daa94..2796e1b0d7f2d441719ca01744703abe2ad698ee 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Library/_files/blacklist.txt @@ -62,7 +62,6 @@ lib/Magento/App/Module/ResourceResolver.php lib/Magento/Event/Invoker/InvokerDefault.php lib/Magento/Phrase/Renderer/Translate.php lib/Magento/Backup/Snapshot.php -lib/Magento/Outbound/Authentication/Hmac.php lib/Magento/Oauth/Exception.php lib/Magento/App/Helper/AbstractHelper.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt index c62d65bccd5891a8dc80e000f65a4e17aa73e57b..b8dc7df58440314e906937ce85c8d5b651071fb0 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/classes/blacklist.txt @@ -16,8 +16,8 @@ \Magento\Core\Model\Config\FileResolver \Magento\Core\Model\Config\Cache \Magento\Core\Model\Config\Base -\Magento\Core\Model\Translate\String -\Magento\Core\Model\Translate\Inline\Config -\Magento\Core\Model\Translate\Inline\Parser +\Magento\Translation\Model\String +\Magento\Translation\Model\Inline\Config +\Magento\Translation\Model\Inline\Parser \Magento\Translate \Magento\Email\Model\Template diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php index 1ad2e08bf7dbed2ec11eed4cc8ae6583dcd3deea..de6e42f208ebe047aaa2f363d2e59ebcf063202a 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/dependency_test/tables_ce.php @@ -332,6 +332,7 @@ return array( 'tax_class' => 'Magento_Tax', 'tax_order_aggregated_created' => 'Magento_Tax', 'tax_order_aggregated_updated' => 'Magento_Tax', + 'translation' => 'Magento_Translation', 'weee_discount' => 'Magento_Weee', 'weee_tax' => 'Magento_Weee', 'widget' => 'Magento_Widget', diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php index e8f9d28826980902a740458a879b0ce109ff75dc..1766f231afb5c27f3202bfb237d99a95766f1f20 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_classes.php @@ -793,9 +793,26 @@ return array( array('Mage_Core_Model_Config_System'), array('Mage_Core_Model_Design_Source_Apply'), array('Mage_Core_Model_Language'), + array('Magento\Core\Model\Flag', 'Magento\Flag'), + array('Magento\Core\Exception', 'Magento\Model\Exception'), + array('Magento\Core\Model\AbstractModel', 'Magento\Model\AbstractModel'), array('Magento\Core\Model\Email\Info', 'Magento\Mail\MessageInterface'), array('Magento\Core\Model\Email\Sender', 'Magento\Mail\Template\TransportBuilder'), array('Magento\Core\Model\Email\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'), + array('Magento\Core\Model\Resource\AbstractResource', 'Magento\Model\Resource\AbstractResource'), + array('Magento\Core\Model\Resource\Db\AbstractDb', 'Magento\Model\Resource\Db\AbstractDb'), + array('Magento\Core\Model\Resource\Db\Profiler', 'Magento\Model\Resource\Db\Profiler'), + array('Magento\Core\Model\Resource\Entity\AbstractEntity', 'Magento\Model\Resource\Entity\AbstractEntity'), + array('Magento\Core\Model\Resource\Entity\Table', 'Magento\Model\Resource\Entity\Table'), + array('Magento\Core\Model\Resource\Flag', 'Magento\Flag\Resource'), + array('Magento\Core\Model\Resource\Iterator', 'Magento\Model\Resource\Iterator'), + array('Magento\Core\Model\Resource\Type\AbstractType', 'Magento\Model\Resource\Type\AbstractType'), + array('Magento\Core\Model\Resource\Type\Db', 'Magento\Model\Resource\Type\Db'), + array('Magento\Core\Model\Resource\Type\Db\Pdo\Mysql', 'Magento\Model\Resource\Type\Db\Pdo\Mysql'), + array( + 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection' + ), array('Magento\Email\Model\Info', 'Magento\Mail\MessageInterface'), array('Magento\Email\Model\Sender', 'Magento\Mail\Template\TransportBuilder'), array('Magento\Email\Model\Template\Mailer', 'Magento\Mail\Template\TransportBuilder'), @@ -1260,7 +1277,12 @@ return array( ), array('Magento\Sales\Model\ResourceFactory'), array('Magento\Sales\Model\Resource\Helper\Mysql4', 'Magento\Sales\Model\Resource\Helper'), - array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\Core\Model\Resource\Helper'), + array('Magento\Core\Model\Resource\Helper\Mysql4', 'Magento\DB\Helper'), + array('Magento\Core\Model\Resource\Helper', 'Magento\DB\Helper'), + array('Magento\Core\Model\Resource\Helper\AbstractHelper', 'Magento\DB\Helper\AbstractHelper'), + array('Magento\Core\Model\Resource\HelperFactory'), + array('Magento\Core\Model\Resource\HelperPool'), + array('Magento\Core\Model\Resource\Transaction', 'Magento\DB\Transaction'), array('Magento\Catalog\Model\Resource\Helper\Mysql4', 'Magento\Catalog\Model\Resource\Helper'), array('Magento\Eav\Model\Resource\Helper\Mysql4', 'Magento\Eav\Model\Resource\Helper'), array( @@ -1320,6 +1342,7 @@ return array( array('Magento\Core\Model\ModuleListInterface'), array('Magento\Core\Model\RouterList'), array('Magento\Core\Model\App\State'), + array('Magento\Core\Model\App'), array('Magento\Core\Model\Event\Config\Converter'), array('Magento\Core\Model\Event\Config\Data'), array('Magento\Core\Model\Event\Config\Reader'), @@ -2103,5 +2126,43 @@ return array( array('Magento\Catalog\Helper\Product\Url', 'Magento\Filter\Translit'), array('Magento\Catalog\Model\Product\Indexer\Price'), array('Magento\Catalog\Model\Resource\Product\Indexer\Price'), - array('Magento\Indexer\Model\Processor\CacheInvalidate', 'Magento\Indexer\Model\Processor\InvalidateCache') + ['Magento\PubSub'], // unused library code which was removed + ['Magento\Outbound'], // unused library code which was removed + array('Magento\Indexer\Model\Processor\CacheInvalidate', 'Magento\Indexer\Model\Processor\InvalidateCache'), + array( + 'Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Reviews', + 'Magento\Review\Block\Adminhtml\Product\Edit\Tab\Reviews' + ), + array( + 'Magento\Catalog\Controller\Adminhtml\Product\Review', + 'Magento\Review\Controller\Adminhtml\Product' + ), + array( + 'Magento\Review\Block\Helper', + 'Magento\Review\Block\Product\ReviewRenderer' + ), + array( + 'Magento\LauncherInterface', + 'Magento\AppInterface', + ), + array('Magento\Convert\ConvertException'), + array('Magento\Convert\Container\AbstractContainer'), + array('Magento\Convert\Mapper\Column'), + array('Magento\Convert\Mapper\MapperInterface'), + ['Magento\Core\Controller\Ajax', 'Magento\Translation\Controller\Ajax'], + ['Magento\Core\Helper\Translate', 'Magento\Translation\Helper\Data'], + ['Magento\Core\Model\Translate\Inline\Config', 'Magento\Translation\Model\Inline\Config'], + ['Magento\Core\Model\Translate\Inline\Parser', 'Magento\Translation\Model\Inline\Parser'], + ['Magento\Core\Model\Resource\Translate\String', 'Magento\Translation\Model\Resource\String'], + ['Magento\Core\Model\Resource\Translate', 'Magento\Translation\Model\Resource\Translate'], + ['Magento\Core\Model\Translate\String', 'Magento\Translation\Model\String'], + ['Magento\Translation\Helper\Data'], + ['Magento\Translate\Factory'], + ['Magento\Backend\Model\Translate'], + ['Magento\Backend\Model\Resource\Translate'], + ['Magento\Backend\Model\Resource\Translate\String'], + ['Magento\DesignEditor\Model\Translate\InlineVde', 'Magento\DesignEditor\Model\Translate\Inline'], + ['Magento\Backend\Model\Translate\Inline'], + ['Magento\Backend\Model\Translate\Inline\ConfigFactory'], + ['Magento\Translate\Inline\ConfigFactory'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php index b2fbea660924433112c0f4d08fb9f9e71f78f3ea..bddf1b0120ca46f5bfc22fb7def4037bc7384476 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_constants.php @@ -34,7 +34,7 @@ return array( array('CACHE_TAG', 'Magento\AppInterface'), array( 'CACHE_TAG', - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection', + 'Magento\Model\Resource\Db\Collection\AbstractCollection', 'Magento_Core_Model_Cache_Type_Collection::CACHE_TAG' ), array('CACHE_TAG', 'Magento\Translate', 'Magento_Core_Model_Cache_Type_Translate::CACHE_TAG'), @@ -70,7 +70,6 @@ return array( 'Magento_Core_Model_Config_Resource::DEFAULT_WRITE_CONNECTION' ), array('DEFAULT_CURRENCY', 'Magento\Locale', 'Magento_Core_Model_LocaleInterface::DEFAULT_CURRENCY'), - array('DEFAULT_ERROR_HANDLER', 'Magento\Core\Model\App'), array('DEFAULT_READ_CONNECTION', 'Magento\App\Resource\Config'), array('DEFAULT_WRITE_CONNECTION', 'Magento\App\Resource\Config'), array('DEFAULT_ERROR_HANDLER', 'Mage'), @@ -593,5 +592,11 @@ return array( 'XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY', '\Magento\Catalog\Helper\Category\Flat', '\Magento\Catalog\Model\Indexer\Category\Flat\Config::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY' - ) + ), + array('CSV_SEPARATOR', 'Magento\Translate'), + array('SCOPE_SEPARATOR', 'Magento\Translate'), + array('CONFIG_KEY_AREA', 'Magento\Translate'), + array('CONFIG_KEY_LOCALE', 'Magento\Translate'), + array('CONFIG_KEY_SCOPE', 'Magento\Translate'), + array('CONFIG_KEY_DESIGN_THEME', 'Magento\Translate'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php index 93d322e683d60f8c7fdb2d0f0e8c3754581053ec..762f6fc6c6c71cca701978bb7e2fb1b82810026f 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php @@ -32,7 +32,7 @@ return array( array('_addLink', 'Magento\Customer\Block\Account\Link'), array('_addMinimalPrice', 'Magento\Catalog\Model\Resource\Product\Collection'), array('_addTaxPercents', 'Magento\Catalog\Model\Resource\Product\Collection'), - array('_afterSaveCommit', 'Magento\Core\Model\AbstractModel'), + array('_afterSaveCommit', 'Magento\Model\AbstractModel'), array('_afterSetConfig', 'Magento\Eav\Model\Entity\AbstractEntity'), array('_aggregateByOrderCreatedAt', 'Magento\SalesRule\Model\Resource\Report\Rule'), array('_amountByCookies', 'Magento\Sendfriend\Model\Sendfriend'), @@ -51,8 +51,6 @@ return array( array('_canShowField', 'Magento\Backend\Block\System\Config\Form'), array('_canUseCacheForInit', 'Magento\Core\Model\Config'), array('_canUseLocalModules'), - array('_checkCookieStore', 'Magento\Core\Model\App'), - array('_checkGetStore', 'Magento\Core\Model\App'), array('_checkUrlSettings', 'Magento\Backend\Controller\Adminhtml\Action'), array('_collectOrigData', 'Magento\Catalog\Model\Resource\AbstractResource'), array('_decodeInput', 'Magento\Catalog\Controller\Adminhtml\Product'), @@ -69,10 +67,8 @@ return array( array('_getAttributeFilterBlockName', 'Magento\CatalogSearch\Block\Layer'), array('_getAvailable', 'Magento\GiftMessage\Model\Observer'), array('_getBytesIniValue', 'Magento\Catalog\Model\Product\Option\Type\File'), - array('_getCacheId', 'Magento\Core\Model\App'), array('_getCacheKey', 'Magento\Catalog\Model\Layer\Filter\Price'), array('_getCacheLockId', 'Magento\Core\Model\Config'), - array('_getCacheTags', 'Magento\Core\Model\App'), array('_getCarrier', 'Magento\Shipping\Model\Config', 'Magento\Shipping\Model\CarrierFactory::create||get'), array('_getChildHtml'), array('_getConfig', 'Magento\Theme\Helper\Layout'), @@ -112,24 +108,15 @@ return array( array('_getSetData', 'Magento\Backend\Block\Catalog\Product\Attribute\Set\Main'), array('_getSession', 'Magento\Paygate\Model\Authorizenet', 'Magento_Paygate_Model_Authorizenet::_session'), array('_getSHAInSet', '', 'Magento_Ogone_Model_Api::getHash'), - array('_getStoreByGroup', 'Magento\Core\Model\App'), - array('_getStoreByWebsite', 'Magento\Core\Model\App'), array('_getStoreTaxRequest', 'Magento\Tax\Model\Sales\Total\Quote\Shipping'), array('_getUploadMaxFilesize', 'Magento\Catalog\Model\Product\Option\Type\File'), array('_hookQueries', 'Magento\Core\Model\Resource\Setup'), array('_importAddress', 'Magento\Paypal\Model\Api\Nvp'), array('_inheritDesign', 'Magento\Catalog\Model\Design'), - array('_initBaseConfig', 'Magento\Core\Model\App'), - array('_initCache', 'Magento\Core\Model\App'), - array('_initCurrentStore', 'Magento\Core\Model\App'), - array('_initFileSystem', 'Magento\Core\Model\App'), array('_initLayoutMessages', 'Magento\App\Action\Action'), - array('_initLogger', 'Magento\Core\Model\App'), - array('_initModules', 'Magento\Core\Model\App'), array('_initModulesPreNamespaces', 'Magento\Core\Model\Config'), array('_initOrder', 'Magento\Shipping\Block\Tracking\Popup'), array('_initShipment', 'Magento\Shipping\Block\Tracking\Popup'), - array('_initStores', 'Magento\Core\Model\App'), array('_inludeControllerClass', '', '_includeControllerClass'), array('_isApplyDesign', 'Magento\Catalog\Model\Design'), array('_isApplyFor', 'Magento\Catalog\Model\Design'), @@ -186,7 +173,6 @@ return array( array('isInStore', 'Magento\Customer\Model\Customer'), array('_sendUploadResponse', 'Magento\Newsletter\Controller\Adminhtml\Subscriber'), array('_setAttribteValue'), - array('_shouldSkipProcessUpdates', 'Magento\Core\Model\App'), array('_sort', 'Magento\Backend\Model\Config\Structure\Converter'), array( '_submitRecurringPaymentProfiles', @@ -209,6 +195,7 @@ return array( array('addConstraint', 'Magento\DB\Adapter\Pdo\Mysql'), array('addCss', 'Magento\Theme\Block\Html\Head'), array('addCssIe', 'Magento\Theme\Block\Html\Head'), + array('addCustomerData', 'Magento\Catalog\Model\Product\Item', 'setCustomerId'), array('addCustomersToAlertQueueAction'), array('addCustomerToSegments'), array('addHandle', 'Magento\Core\Model\Layout\Update', 'Magento\Core\Model\Layout\Merge'), @@ -270,7 +257,6 @@ return array( array('authFailed', '', '\Magento\HTTP\Authentication::setAuthenticationFailed'), array('authFrontend'), array('authValidate', '', '\Magento\HTTP\Authentication::getCredentials'), - array('baseInit', 'Magento\Core\Model\App'), array('bundlesAction', 'Magento\Catalog\Controller\Adminhtml\Product'), array('calcTaxAmount', 'Magento\Sales\Model\Quote\Item\AbstractItem'), array('callbackQueryHook', 'Magento\Core\Model\Resource\Setup'), @@ -306,7 +292,7 @@ return array( array('cloneIndexTable', 'Magento\Index\Model\Resource\AbstractResource'), array('collectRoutes', 'Magento\Backend\App\Router\DefaultRouter'), array('collectRoutes', 'Magento\Core\App\Router\Base'), - array('composeLocaleHierarchy', 'Magento\Core\Helper\Translate'), + array('composeLocaleHierarchy', 'Magento\Translation\Helper\Data'), array('convertOldTaxData', 'Magento\Tax\Model\Resource\Setup'), array('convertOldTreeToNew', 'Magento\Catalog\Model\Resource\Setup'), array('copyFieldset', 'Magento\Core\Helper\Data', 'copyFieldsetToTarget'), @@ -420,7 +406,6 @@ return array( array('getHeaderText', 'Magento_Bundle_Block_Adminhtml_Catalog_Product_Edit_Tab_Bundle_Option_Search'), array('getHelperClassName', 'Magento\Core\Model\Config'), array('getHtmlFormat', 'Magento\Customer\Model\Address\AbstractAddress'), - array('getInitParam', 'Magento\Core\Model\App'), array( 'getInitParams', 'Magento\TestFramework\Bootstrap', @@ -558,6 +543,16 @@ return array( array('getSectionNode', 'Magento\Core\Model\Config'), array('getSecure', 'Magento\Backend\Model\UrlInterface', 'isSecure'), array('getSecure', 'Magento\Url', 'isSecure'), + array('_prepareSessionUrlWithParams', 'Magento\Url'), + array('_getQueryParams', 'Magento\Url'), + array('_setRouteFrontName', 'Magento\Url'), + array('setType', 'Magento\Url'), + array('purgeQueryParams', 'Magento\Url', 'Use setQueryParams([]) instead'), + array('purgeQueryParams', 'Magento\Url\QueryParamsResolver', 'Use setQueryParams([]) instead'), + array('purgeQueryParams', 'Magento\Url\QueryParamsResolverInterface', 'Use setQueryParams([]) instead'), + array('_getDefaultActionName', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_ACTION_NAME'), + array('_getDefaultControllerName', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_CONTROLLER_NAME'), + array('_getDefaultUrlType', 'Magento\Url', 'Magento\UrlInterface::DEFAULT_URL_TYPE'), array('getSelectionFinalPrice', 'Magento\Bundle\Model\Product\Price'), array('getShipId', 'Magento\Shipping\Block\Tracking\Popup'), array('getShippingCarrier', 'Magento\Sales\Model\Order', 'Magento\Shipping\Model\CarrierFactory::create'), @@ -619,7 +614,6 @@ return array( ), array('getUploadMaxSize', 'Magento\Backend\Block\Media\Uploader', 'Magento_File_Size::getUploadMaxSize()'), array('getUrlForReferer', 'Magento\Backend\Block\Page\Footer'), - array('getUseCacheFilename', 'Magento\Core\Model\App'), array('getValidator', 'Magento\SalesRule\Model\Observer'), array('getValidatorData', 'Magento\Core\Model\Session\AbstractSession', 'use _getSessionEnvironment method'), array('getValueTable'), @@ -645,7 +639,6 @@ return array( array('implodeStreetAddress', 'Magento\Customer\Model\Address\AbstractAddress'), array('importFromTextArray'), array('init', 'Magento\App\FrontController'), - array('init', 'Magento\Core\Model\App'), array('init', 'Magento\Core\Model\Config'), array('init', 'Magento\Webapi\Controller\Front'), array('initCache'), @@ -654,7 +647,6 @@ return array( array('initLayoutMessages', 'Magento\App\Action\Action'), array('initSerializerBlock', 'Magento\Backend\Block\Catalog\Product\Edit\Tab\Ajax\Serializer'), array('initSerializerBlock', 'Magento\Backend\Block\Widget\Grid\Serializer'), - array('initSpecified', 'Magento\Core\Model\App'), array('insertProductPrice', 'Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice'), array('isAbsolutePath'), array('isAdmin', 'Magento\Core\Model\Store'), @@ -664,7 +656,6 @@ return array( array('isDirectOutput', 'Magento\Core\Model\Layout'), array('isDirectOutput', 'Magento\View\LayoutInterface'), array('isFulAmountCovered'), - array('isInstalled', 'Magento\Core\Model\App'), array('isLeyeredNavigationAllowed'), array('isLocalConfigLoaded', 'Magento\Core\Model\Config'), array('isModuleEnabled', 'Magento\Core\Model\Config', 'Magento_Core_Model_ModuleManager::isEnabled'), @@ -706,7 +697,6 @@ return array( array('postDispatchSystemImportExportRun'), array('prepareAddressInfo', 'Magento\Sales\Block\Recurring\Profile\View'), array('prepareAttributesForSave', 'Magento\ImportExport\Model\Import\Entity\Product'), - array('prepareCacheId', 'Magento\Core\Model\App'), array('prepareFeesInfo', 'Magento\Sales\Block\Recurring\Profile\View'), array('prepareGoogleOptimizerScripts'), array('prepareRedirect', 'Magento\Core\Controller\Varien\Exception'), @@ -910,12 +900,9 @@ return array( array('_getUsers', 'Magento\User\Block\Role\Grid\User', 'getUsers'), array('_getGridHtml', 'Magento\User\Block\Role\Tab\Users', 'getGridHtml'), array('_getSelectedRoles', 'Magento\User\Block\User\Edit\Tab\Roles', 'getSelectedRoles'), - array('_prepareSelect', 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection'), + array('_prepareSelect', 'Magento\Model\Resource\Db\Collection\AbstractCollection'), array('_prepareSelect', 'Magento\Data\Collection\Db'), array('_createOrderFromAddress', 'Magento\Checkout\Model\Type\AbstractType'), - array('castField', 'Magento\Core\Model\Resource\Helper'), - array('getQueryUsingAnalyticFunction', 'Magento\Core\Model\Resource\Helper'), - array('limitUnion', 'Magento\Core\Model\Resource\Helper'), array('_addLoadAttributesSelectFields', 'Magento\Catalog\Model\Resource\AbstractResource'), array('attributeSelectFields', 'Magento\Catalog\Model\Resource\Helper'), array('_addLoadAttributesSelectFields', 'Magento\Eav\Model\Entity\AbstractEntity'), @@ -955,7 +942,6 @@ return array( array('_helper', 'Magento\Catalog\Model\Product\Type\AbstractType'), array('getHelper', 'Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\Collection'), array('getHelper', 'Magento\Cms\Model\Wysiwyg\Images\Storage'), - array('getHelper', 'Magento\Core\Model\App'), array('getCatalogHelper', 'Magento\Backend\Block\Catalog\Category\Tabs'), array('getStabilityOptions', 'Magento\Connect\Model\Extension'), array('_getSession', 'Magento\Centinel\Model\Service'), @@ -986,10 +972,6 @@ return array( array('turnOnSerializableMode', 'Magento\Backup\Model\Resource\Db', 'prepareTransactionIsolationLevel'), array('_getResourceModel', '\Magento\Webapi\Model\Source\Acl\Role', '$this->_resource'), array('_getSession', '\Magento\GiftMessage\Model\Save', '$this->_session'), - array('_initRequest', '\Magento\Core\Model\App'), - array('run', '\Magento\Core\Model\App'), - array('_initFrontController', '\Magento\Core\Model\App'), - array('_getFrontControllerByCurrentArea', '\Magento\Core\Model\App'), array('run', '\Magento\AppInterface'), array('setModuleDir', 'Magento\Module\Dir\Reader'), array('setModuleDir', 'Magento\Core\Model\Config'), @@ -1069,8 +1051,8 @@ return array( array('validateIpAddr', '\Magento\Core\Helper\Http', '\Zend_Validate_Ip::isValid'), array('getRemoteAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\RemoteAddress::getRemoteAddress'), array('getServerAddr', '\Magento\Core\Helper\Http', 'Magento\HTTP\PhpEnvironment\ServerAddress::getServerAddress'), - array('formatDate', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::formatDate'), - array('mktime', 'Magento\Core\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::toTimestamp'), + array('formatDate', 'Magento\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::formatDate'), + array('mktime', 'Magento\Model\Resource\AbstractResource', '\Magento\Stdlib\DateTime::toTimestamp'), array('getPlainTemplateMode', '\Magento\Email\Model\Template\Filter'), array('getMessage', '\Magento\Core\Model\Session\Context', 'getMessageFactory'), array('getMessageFactory', '\Magento\Core\Model\Session\Context', 'getMessagesFactory'), @@ -1582,6 +1564,12 @@ return array( array('displayGirthValue', 'Magento\Usa\Helper\Data', 'Magento\Usps\Helper\Data::displayGirthValue'), array('reindexProductPrices', '\Magento\Catalog\Model\Observer'), array('getCustomer', 'Magento\Checkout\Block\Onepage\AbstractOnepage'), + ['_compareSortOrder', 'Magento\Sales\Model\Config\Ordered'], + [ + '_toOptionHashOptimized', + 'Magento\Data\Collection\Db', + 'Magento\Tax\Model\Resource\Calculation\Rate\Collection::toOptionHashOptimized' + ], array('getSwitchCurrencyUrl', 'Magento\Directory\Block\Currency'), array('getPageVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('getOrderVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), @@ -1592,5 +1580,32 @@ return array( array('getModeUrl', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('getLimitUrl', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_getAvailableLimit', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), - array('getCacheIdTags', 'Magento\Core\Model\AbstractModel') + array('getCacheIdTags', 'Magento\Core\Model\AbstractModel'), + array('addCustomerData', 'Magento\Log\Model\Visitor'), + array('quoteSubmitAfter', 'Magento\Customer\Model\Observer'), + array('loadByCustomer', 'Magento\Wishlist\Model\Wishlist'), + ['_sessionVarCallback', 'Magento\Url', 'Replaced with inlined closure'], + array( + 'reviewsAction', + 'Magento\Catalog\Controller\Adminhtml\Product', + 'Magento\Review\Controller\Adminhtml\Product\Reviews::gridAction' + ), + ['_insertInlineScriptsHtml', 'Magento\DesignEditor\Model\Translate\Inline', 'addInlineScript'], + ['initializeTranslation', 'Magento\Backend\Model\Observer'], + ['getTranslateJson', 'Magento\Core\Helper\Js'], + ['_isEmptyTranslateArg', 'Magento\Translate'], + ['_getTranslatedString', 'Magento\Translate'], + ['initLocale', 'Magento\Translate'], + ['_prepareDataString', 'Magento\Translate'], + ['getInlineObject', 'Magento\Translate'], + ['init', 'Magento\Translate', 'loadData'], + ['disable', 'Magento\Translate\Inline'], + ['_getAjaxUrl', 'Magento\Translate\Inline', 'getAjaxUrl'], + ['_stripInlineTranslations', 'Magento\Translate\Inline', 'stripInlineTranslations'], + ['isAllowed', 'Magento\Translate'], + ['translate', 'Magento\Translate'], + ['_getStoreId', 'Magento\Translation\Model\Resource\Translate', 'getScope'], + ['_getStoreId', 'Magento\Translation\Model\Resource\String', 'getScope'], + ['getAvailableModes', 'Magento\DesignEditor\Helper\Data'], + ['initializeTranslation', 'Magento\DesignEditor\Model\Observer'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php index 7cc83fa23259710ef5b730c616915c648bafaf5c..e0309177413d05aedf48157a7278b8002a762d96 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_properties.php @@ -196,7 +196,7 @@ return array( array('_dir', 'Magento\Backup\Model\Fs\Collection'), array('_dir', 'Magento\Cms\Model\Wysiwyg\Images\Storage'), array('_dirs', 'Magento\Core\Helper\Theme'), - array('_dirs', 'Magento\Core\Model\Resource\Type\Db\Pdo\Mysql'), + array('_dirs', 'Magento\Model\Resource\Type\Db\Pdo\Mysql'), array('_filesystem', 'Magento\GiftWrapping\Model\Wrapping'), array('_dirs', 'Magento\Index\Model\Lock\Storage'), array('_filesystem', 'Magento\Index\Model\Lock\Storage'), @@ -301,5 +301,36 @@ return array( array('_orderVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_directionVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), array('_modeVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), - array('_limitVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar') + array('_limitVarName', 'Magento\Catalog\Block\Product\ProductList\Toolbar'), + array('_encryptedSessionId', 'Magento\Url'), + ['_tokenRegex', 'Magento\Translate\Inline'], + ['_translator', 'Magento\Translate\Inline'], + ['_appState', 'Magento\Translate\Inline'], + ['_translateInline', 'Magento\Translate'], + ['_inlineInterface', 'Magento\Translate'], + ['_translateFactory', 'Magento\Translate'], + ['_placeholderRender', 'Magento\Translate'], + ['_canUseInline', 'Magento\Translate'], + ['_eventManager', 'Magento\Translate'], + ['_inlineFactory', 'Magento\App\Helper\Context', 'translateInline'], + ['_inlineFactory', 'Magento\App\Helper\AbstractHelper', 'translateInline'], + ['_storeManager', 'Magento\Translation\Model\Resource\Translate'], + ['_storeManager', 'Magento\Translation\Model\Resource\String'], + ['_isVdeRequest', 'Magento\DesignEditor\Helper\Data'], + ['_translator', 'Magento\Phrase\Renderer\Translate', 'translator'], + ['_translator', 'Magento\Core\Model\Validator\Factory'], + ['_configFactory', 'Magento\Core\Model\App\Emulation', 'inlineConfig'], + ['_coreStoreConfig', 'Magento\Translation\Model\Inline\Config', 'config'], + ['_translate', 'Magento\Directory\Model\Observer'], + ['_translate', 'Magento\Newsletter\Model\Subscriber'], + ['_translate', 'Magento\Sendfriend\Model\Sendfriend'], + ['_translateModel', 'Magento\Sitemap\Model\Observer'], + ['_translator', 'Magento\Checkout\Helper\Data'], + ['_translate', 'Magento\GiftRegistry\Model\Entity'], + ['_translate', 'Magento\Log\Model\Cron'], + ['_translate', 'Magento\ProductAlert\Model\Observer'], + ['translate', 'Magento\Reminder\Model\Rule'], + ['_translate', 'Magento\Rma\Model\Rma'], + ['_translate', 'Magento\Rma\Model\Rma\Status\History'], + ['_translate', 'Magento\Sales\Model\Order\Pdf\AbstractPdf'], ); diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt index 2c13d976008f5d080766bdcef7d59f1267e8f368..186e9737999df83037349618f05650b8af1924c5 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/blacklist/common.txt @@ -45,9 +45,6 @@ lib/Magento/Cache/Backend/Eaccelerator.php lib/Magento/Cache/Backend/Memcached.php lib/Magento/Cache/Core.php lib/Magento/Connect -lib/Magento/Convert/ConvertException.php -lib/Magento/Convert/Mapper/Column.php -lib/Magento/Convert/Mapper/MapperInterface.php lib/Magento/Data/Collection.php lib/Magento/Data/Collection/Db.php lib/Magento/Data/Collection/Db/FetchStrategy/Cache.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt index a468ec09ba31e999d1ad7e66636b4e7555fa910d..85dc1e4ba3ca4049ebb111e95a558990e16a4d26 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcs/blacklist/common.txt @@ -40,9 +40,9 @@ lib/Magento/Translate/Adapter.php lib/Magento/Translate/AdapterInterface.php # WrapperInterface methods cannot be camelCase as they follow method naming convention from framework classes lib/Magento/Filesystem/WrapperInterface.php -# Newer version of phpcs does not complain about spacing issue. This appears to be a bug in the phpcs version that is currently run in bamboo. -app/code/Magento/Sales/Model/Order/Payment/Transaction.php - -# Skipped for no reason +# PSR-1 not applied to dev/tests/integration/testsuite/Magento +# PSR-1 not applied to dev/tests/unit/testsuite/Magento +# Newer version of phpcs does not complain about spacing issue. This appears to be a bug in the phpcs version that is currently run in bamboo. +app/code/Magento/Sales/Model/Order/Payment/Transaction.php diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 16f31eec36e5b1789cb82fb81fa060a2bfd47d84..55ae9dfb68591cbad824ad5b7dfa7023e51de5f2 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -93,34 +93,33 @@ class Adminhtml extends \PHPUnit_Framework_TestCase protected function setUp() { // These mocks are accessed via context - $this->_designMock = $this->_makeMock('Magento\View\DesignInterface'); - $this->_sessionMock = $this->_makeMock('Magento\Core\Model\Session'); - $this->_sidResolver = $this->_makeMock('Magento\Core\Model\Session\SidResolver'); - $this->_translatorMock = $this->_makeMock('Magento\TranslateInterface'); - $this->_layoutMock = $this->_makeMock('Magento\Core\Model\Layout'); - $this->_requestMock = $this->_makeMock('Magento\App\RequestInterface'); - $this->_messagesMock = $this->_makeMock('Magento\View\Element\Messages'); - $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); - $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); - $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); - $this->_loggerMock = $this->_makeMock('Magento\Logger'); - $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); - $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); - $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); - $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); - $viewUrlMock = $this->_makeMock('Magento\View\Url'); - $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); - $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); - $templatePoolMock = $this->_makeMock('Magento\View\TemplateEnginePool'); - $authorizationMock = $this->_makeMock('Magento\AuthorizationInterface'); - $cacheStateMock = $this->_makeMock('Magento\App\Cache\StateInterface'); - $appMock = $this->_makeMock('Magento\Core\Model\App'); - $escaperMock = $this->_makeMock('Magento\Escaper'); - $filterManagerMock = $this->_makeMock('Magento\Filter\FilterManager'); - $backendSessionMock = $this->_makeMock('Magento\Backend\Model\Session'); - $appState = $this->_makeMock('Magento\App\State'); - $this->_mathMock = $this->_makeMock('Magento\Math\Random'); - $this->_formKey = $this->_makeMock('Magento\Data\Form\FormKey'); + $this->_designMock = $this->_makeMock('Magento\View\DesignInterface'); + $this->_sessionMock = $this->_makeMock('Magento\Core\Model\Session'); + $this->_sidResolver = $this->_makeMock('Magento\Core\Model\Session\SidResolver'); + $this->_translatorMock = $this->_makeMock('Magento\TranslateInterface'); + $this->_layoutMock = $this->_makeMock('Magento\Core\Model\Layout'); + $this->_requestMock = $this->_makeMock('Magento\App\RequestInterface'); + $this->_messagesMock = $this->_makeMock('Magento\View\Element\Messages'); + $this->_urlMock = $this->_makeMock('Magento\UrlInterface'); + $this->_eventManagerMock = $this->_makeMock('Magento\Event\ManagerInterface'); + $this->_controllerMock = $this->_makeMock('Magento\App\FrontController'); + $this->_loggerMock = $this->_makeMock('Magento\Logger'); + $this->_filesystemMock = $this->_makeMock('Magento\App\Filesystem'); + $this->_cacheMock = $this->_makeMock('Magento\App\CacheInterface'); + $this->_storeConfigMock = $this->_makeMock('Magento\Core\Model\Store\Config'); + $this->_storeManagerMock = $this->_makeMock('Magento\Core\Model\StoreManager'); + $viewUrlMock = $this->_makeMock('Magento\View\Url'); + $viewConfigMock = $this->_makeMock('Magento\View\ConfigInterface'); + $viewFileSystemMock = $this->_makeMock('Magento\View\FileSystem'); + $templatePoolMock = $this->_makeMock('Magento\View\TemplateEnginePool'); + $authorizationMock = $this->_makeMock('Magento\AuthorizationInterface'); + $cacheStateMock = $this->_makeMock('Magento\App\Cache\StateInterface'); + $escaperMock = $this->_makeMock('Magento\Escaper'); + $filterManagerMock = $this->_makeMock('Magento\Filter\FilterManager'); + $backendSessionMock = $this->_makeMock('Magento\Backend\Model\Session'); + $appState = $this->_makeMock('Magento\App\State'); + $this->_mathMock = $this->_makeMock('Magento\Math\Random'); + $this->_formKey = $this->_makeMock('Magento\Data\Form\FormKey'); $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); @@ -148,7 +147,6 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $viewConfigMock, $cacheStateMock, $this->_loggerMock, - $appMock, $escaperMock, $filterManagerMock, $this->_filesystemMock, diff --git a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php index 41595e761b91880361975f1499f9878bdda519e6..71895ee10704e41646bb0b6a8ec7277577437b1d 100644 --- a/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php +++ b/dev/tests/unit/framework/Magento/TestFramework/Helper/ObjectManager.php @@ -37,8 +37,8 @@ class ObjectManager * @var array */ protected $_specialCases = array( - 'Magento\Core\Model\Resource\AbstractResource' => '_getResourceModelMock', - 'Magento\TranslateInterface' => '_getTranslatorMock' + 'Magento\Model\Resource\AbstractResource' => '_getResourceModelMock', + 'Magento\TranslateInterface' => '_getTranslatorMock', ); /** diff --git a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php index c314e440bf512fca8b3b8d1a6a749bc150034656..0f48d33875a3b86d574c0a982912193c0bad952b 100644 --- a/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php +++ b/dev/tests/unit/framework/tests/unit/testsuite/Magento/TestFramework/Helper/ObjectManagerTest.php @@ -50,9 +50,9 @@ class ObjectManagerTest extends \PHPUnit_Framework_TestCase * @var array */ protected $_modelDependencies = array( - 'eventManager' => 'Magento\Event\ManagerInterface', - 'cacheManager' => 'Magento\App\CacheInterface', - 'resource' => 'Magento\Core\Model\Resource\AbstractResource', + 'eventManager' => 'Magento\Event\ManagerInterface', + 'cacheManager' => 'Magento\App\CacheInterface', + 'resource' => 'Magento\Model\Resource\AbstractResource', 'resourceCollection' => 'Magento\Data\Collection\Db' ); diff --git a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php index 03771fd42dea241c41619f3a0c75d8504e3cbaff..140119d4d7d5e974c24db56a6973cd23f78a3e74 100644 --- a/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/AdminNotification/Model/NotificationServiceTest.php @@ -79,7 +79,7 @@ class NotificationServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Wrong notification ID specified. */ public function testMarkAsReadThrowsExceptionWhenNotificationIdIsInvalid() diff --git a/dev/tests/unit/testsuite/Magento/App/AreaListTest.php b/dev/tests/unit/testsuite/Magento/App/AreaListTest.php index 0233b72b3c725be9e2c991a9e8bd52422421f2bd..1955c8bf559289054a94e897754a8ab11c8c7131 100644 --- a/dev/tests/unit/testsuite/Magento/App/AreaListTest.php +++ b/dev/tests/unit/testsuite/Magento/App/AreaListTest.php @@ -35,21 +35,23 @@ class AreaListTest extends \PHPUnit_Framework_TestCase */ protected $_resolverFactory; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + protected function setUp() { - $this->_resolverFactory = $this->getMock( - '\Magento\App\Area\FrontNameResolverFactory', - array(), - array(), - '', - false - ); + $this->objectManagerMock = $this->getMock('Magento\ObjectManager'); + $this->_resolverFactory = $this + ->getMock('\Magento\App\Area\FrontNameResolverFactory', array(), array(), '', false); } public function testGetCodeByFrontNameWhenAreaDoesNotContainFrontName() { $expected = 'expectedFrontName'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, array('testArea' => array('frontNameResolver' => 'testValue')), $expected @@ -74,8 +76,9 @@ class AreaListTest extends \PHPUnit_Framework_TestCase { $expected = 'testArea'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, - array('testArea' => array('frontName' => 'testFrontName')), + array('testArea'=>array('frontName' => 'testFrontName')), $expected ); @@ -87,6 +90,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase { $expected = 'testFrontName'; $this->_model = new \Magento\App\AreaList( + $this->objectManagerMock, $this->_resolverFactory, array('testAreaCode' => array('frontName' => 'testFrontName')), $expected @@ -98,7 +102,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase public function testGetFrontNameWhenAreaCodeAndFrontNameArentSet() { - $this->_model = new \Magento\App\AreaList($this->_resolverFactory, array(), ''); + $this->_model = new \Magento\App\AreaList($this->objectManagerMock, $this->_resolverFactory, array(), ''); $actual = $this->_model->getFrontName('testAreaCode'); $this->assertNull($actual); @@ -107,9 +111,7 @@ class AreaListTest extends \PHPUnit_Framework_TestCase public function testGetCodes() { $this->_model = new \Magento\App\AreaList( - $this->_resolverFactory, - array('area1' => 'value1', 'area2' => 'value2'), - '' + $this->objectManagerMock, $this->_resolverFactory, array('area1' => 'value1', 'area2' => 'value2'), '' ); $expected = array(0 => 'area1', 1 => 'area2'); diff --git a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php index 68455d27908b0a6384ed96664cd77c111ad38ff4..cf17a2030a14d0e2308234c0b0dcb86f82fda0cd 100644 --- a/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php +++ b/dev/tests/unit/testsuite/Magento/App/EntryPoint/EntryPointTest.php @@ -66,7 +66,7 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase public function testRunExecutesApplication() { $applicationName = '\Magento\App\TestApplication'; - $applicationMock = $this->getMock('\Magento\LauncherInterface'); + $applicationMock = $this->getMock('\Magento\AppInterface'); $applicationMock->expects($this->once())->method('launch')->will($this->returnValue($this->_responseMock)); $this->_objectManagerMock->expects( $this->once() @@ -84,7 +84,7 @@ class EntryPointTest extends \PHPUnit_Framework_TestCase public function testRunCatchesExceptionThrownByApplication() { $applicationName = '\Magento\App\TestApplication'; - $applicationMock = $this->getMock('\Magento\LauncherInterface'); + $applicationMock = $this->getMock('\Magento\AppInterface'); $applicationMock->expects( $this->once() )->method( diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php b/dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php similarity index 83% rename from dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php rename to dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php index 208f72a8c655eb6e4344c11a690d686ef8deb211..b20448c0468966495e80dbf63a879d9e13fd3db0 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Router/NoRouteHandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/App/Router/NoRouteHandlerTest.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Router; +namespace Magento\Backend\App\Router; class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase { @@ -35,6 +35,11 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase */ protected $_requestMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_routeConfigMock; + /** * @var \Magento\Backend\App\Router\NoRouteHandler */ @@ -43,9 +48,10 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->_routeConfigMock = $this->getMock('\Magento\App\Route\ConfigInterface'); $this->_helperMock = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); $this->_helperMock->expects($this->any())->method('getAreaFrontName')->will($this->returnValue('backend')); - $this->_model = new \Magento\Backend\App\Router\NoRouteHandler($this->_helperMock); + $this->_model = new \Magento\Backend\App\Router\NoRouteHandler($this->_helperMock, $this->_routeConfigMock); } /** @@ -53,13 +59,16 @@ class NoRouteHandlerTest extends \PHPUnit_Framework_TestCase */ public function testProcessWithBackendAreaFrontName() { - $this->_requestMock->expects( - $this->once() - )->method( - 'getPathInfo' - )->will( - $this->returnValue('backend/admin/custom') - ); + $this->_routeConfigMock + ->expects($this->once()) + ->method('getRouteFrontName') + ->with('adminhtml') + ->will($this->returnValue('admin')); + + $this->_requestMock + ->expects($this->once()) + ->method('getPathInfo') + ->will($this->returnValue('backend/admin/custom')); $this->_requestMock->expects( $this->once() diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php index 83003db94afd6efe5067338d495b9c5d2f2d37ec..a4c37c6cd56fe5e7e9e5045a0132e7c1b662e6b2 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/Widget/GridTest.php @@ -57,9 +57,6 @@ class GridTest extends \PHPUnit_Framework_TestCase $storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); - $appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); - $appMock->expects($this->any())->method('getStore')->will($this->returnValue($storeMock)); - $appMock->expects($this->any())->method('getDefaultStoreView')->will($this->returnValue($storeMock)); $urlBuilderMock = $this->getMock('Magento\Backend\Model\Url', array(), array(), '', false); @@ -67,13 +64,10 @@ class GridTest extends \PHPUnit_Framework_TestCase $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $block = $helper->getObject( - 'Magento\Backend\Block\Widget\Grid', - array( - 'app' => $appMock, - 'storeManager' => $storeManagerMock, - 'urlModel' => $urlMock, - 'urlBuilder' => $urlBuilderMock + $block = $helper->getObject('Magento\Backend\Block\Widget\Grid', array( + 'storeManager' => $storeManagerMock, + 'urlModel' => $urlMock, + 'urlBuilder' => $urlBuilderMock, ) ); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php index 3f5bbee270ea21c89b0289f355407e99760827e0..2e42ecb04f06e85506854e6b9ee419dbefc3d5b6 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/AuthTest.php @@ -66,26 +66,17 @@ class AuthTest extends \PHPUnit_Framework_TestCase */ public function testLoginFailed() { - $this->_modelFactoryMock->expects( - $this->once() - )->method( - 'create' - )->with( - 'Magento\Backend\Model\Auth\Credential\StorageInterface' - )->will( - $this->returnValue($this->_credentialStorage) - ); - $exceptionMock = new \Magento\Core\Exception(); - $this->_credentialStorage->expects( - $this->once() - )->method( - 'login' - )->with( - 'username', - 'password' - )->will( - $this->throwException($exceptionMock) - ); + $this->_modelFactoryMock + ->expects($this->once()) + ->method('create') + ->with('Magento\Backend\Model\Auth\Credential\StorageInterface') + ->will($this->returnValue($this->_credentialStorage)); + $exceptionMock = new \Magento\Model\Exception; + $this->_credentialStorage + ->expects($this->once()) + ->method('login') + ->with('username', 'password') + ->will($this->throwException($exceptionMock)); $this->_credentialStorage->expects($this->never())->method('getId'); $this->_eventManagerMock->expects($this->once())->method('dispatch')->with('backend_auth_user_login_failed'); $this->_model->login('username', 'password'); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php index 347a6c7ef5854d965abd820da768523af0b1dd58..dbee3f484bcc7049c4e0c7fdd08f2458fe596083 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/BaseurlTest.php @@ -29,10 +29,19 @@ class BaseurlTest extends \PHPUnit_Framework_TestCase { $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $cacheManager = $this->getMock('Magento\App\CacheInterface'); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $context = new \Magento\Model\Context($logger, $eventDispatcher, $cacheManager, $appState, $storeManager); + $logger = $this->getMock('Magento\Logger', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + 'Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + + $context = new \Magento\Model\Context( + $logger, + $eventDispatcher, + $cacheManager, + $appState, + $actionValidatorMock + ); $resource = $this->getMock('Magento\Core\Model\Resource\Config\Data', array(), array(), '', false); $resource->expects($this->any())->method('addCommitCallback')->will($this->returnValue($resource)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php index 09eec4321d50a84380dcef9fbd28bbb336079fd7..08b130b79add125614b20aa9282a34998f0c31c4 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/EncryptedTest.php @@ -51,7 +51,7 @@ class EncryptedTest extends \PHPUnit_Framework_TestCase $this->returnValue($eventDispatcherMock) ); $this->_resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', + 'Magento\Model\Resource\AbstractResource', array( '_construct', '_getReadAdapter', diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php index e4fccbe8a95ef5ef41b0a966c511e5bc17e281dd..0d66f30e247f1d3cd2dae7422cb053ac69404c24 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Backend/SecureTest.php @@ -29,10 +29,18 @@ class SecureTest extends \PHPUnit_Framework_TestCase { $eventDispatcher = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); $appState = $this->getMock('Magento\App\State', array(), array(), '', false); - $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $cacheManager = $this->getMock('Magento\App\CacheInterface'); $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $context = new \Magento\Model\Context($logger, $eventDispatcher, $cacheManager, $appState, $storeManager); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $context = new \Magento\Model\Context( + $logger, + $eventDispatcher, + $cacheManager, + $appState, + $actionValidatorMock + ); $resource = $this->getMock('Magento\Core\Model\Resource\Config\Data', array(), array(), '', false); $resource->expects($this->any())->method('addCommitCallback')->will($this->returnValue($resource)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php index a59914f134abe741a056f7e9c770217832bf8cf2..d2bfcc4d65bcb999ce7481c0778c499f963eabbe 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/Config/Structure/Element/GroupTest.php @@ -107,7 +107,7 @@ class GroupTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetCloneModelThrowsExceptionIfNoSourceModelIsSet() { diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php index 42fb7202ce234aff4ae573e06ed0c305c3761d8d..af723b9a82bd3013f2dfec1d81af67efe711275d 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Model/ConfigTest.php @@ -94,11 +94,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase ); $this->_transFactoryMock = $this->getMock( - 'Magento\Core\Model\Resource\TransactionFactory', - array('create'), - array(), - '', - false + 'Magento\DB\TransactionFactory', + array('create'), array(), '', false ); $this->_appConfigMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); $this->_configLoaderMock = $this->getMock( @@ -149,7 +146,9 @@ class ConfigTest extends \PHPUnit_Framework_TestCase public function testSaveToCheckAdminSystemConfigChangedSectionEvent() { - $transactionMock = $this->getMock('Magento\Core\Model\Resource\Transaction', array(), array(), '', false); + $transactionMock = $this->getMock( + 'Magento\DB\Transaction', array(), array(), '', false + ); $this->_transFactoryMock->expects($this->any())->method('create')->will($this->returnValue($transactionMock)); diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php deleted file mode 100644 index 144ded3efd8f403545cc0454fadc1011ccd2f48d..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/Translate/Inline/ConfigFactoryTest.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model\Translate\Inline; - -class ConfigFactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testGet() - { - $result = 'result'; - $objectManager = $this->getMockForAbstractClass('Magento\ObjectManager'); - $objectManager->expects( - $this->once() - )->method( - 'get' - )->with( - $this->equalTo('Magento\Backend\Model\Translate\Inline\Config') - )->will( - $this->returnValue($result) - ); - $factory = new ConfigFactory($objectManager); - $this->assertEquals($result, $factory->get()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php b/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php deleted file mode 100644 index fd480cefae7b71ee92fa2e95b20a1c98a7fdf51e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Backend/Model/TranslateTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Backend\Model; - -class TranslateTest extends \PHPUnit_Framework_TestCase -{ - /** - * @dataProvider initDataProvider - * - * @param string $area - * @param string $expectedScope - */ - public function testInit($area, $expectedScope) - { - $localeMock = $this->getMock('\Magento\Locale\ResolverInterface'); - $appMock = $this->getMock('\Magento\AppInterface', array(), array(), '', false); - $appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); - $appStateMock->expects($this->any())->method('getAreaCode')->will($this->returnValue($area)); - $scopeMock = $this->getMock('\Magento\BaseScopeInterface'); - $scopeResolverMock = $this->getMock('\Magento\BaseScopeResolverInterface'); - $scopeResolverMock->expects($this->once())->method('getScope')->will($this->returnValue($scopeMock)); - $themeMock = $this->getMock('\Magento\View\Design\ThemeInterface', array()); - $themeMock->expects($this->once())->method('getId')->will($this->returnValue(1)); - $designMock = $this->getMock('\Magento\View\DesignInterface'); - $designMock->expects($this->once())->method('getDesignTheme')->will($this->returnValue($themeMock)); - - $inlineMock = $this->getMock('\Magento\Translate\InlineInterface'); - $inlineMock->expects($this->at(0))->method('isAllowed')->with()->will($this->returnValue(false)); - $inlineMock->expects( - $this->at(1) - )->method( - 'isAllowed' - )->with( - $this->equalTo($expectedScope) - )->will( - $this->returnValue(true) - ); - $translateFactoryMock = $this->getMock('\Magento\Translate\Factory', array(), array(), '', false); - $translateFactoryMock->expects($this->any())->method('create')->will($this->returnValue($inlineMock)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var \Magento\Backend\Model\Translate $translate */ - $translate = $helper->getObject( - 'Magento\Backend\Model\Translate', - array( - 'app' => $appMock, - 'appState' => $appStateMock, - 'scopeResolver' => $scopeResolverMock, - 'viewDesign' => $designMock, - 'translateFactory' => $translateFactoryMock, - 'localeResolver' => $localeMock - ) - ); - $translate->init(); - } - - public function initDataProvider() - { - return array(array('adminhtml', 'admin'), array('frontend', null)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php index d0d4c60e1d3d796f2feb849f47504f6696225edf..02864d14eb437a3a872dd460807065dbd13f4fc4 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowTest.php @@ -42,7 +42,7 @@ class RowTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Could not rebuild index for undefined product */ public function testEmptyId() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php index 8799fe97642fb9e71166aa826bf5b0fa04b337d5..37a3a3c3aaa3cfdf168044d2188b61c0a085cc41 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/RowsTest.php @@ -42,7 +42,7 @@ class RowsTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Bad value was supplied. */ public function testEmptyIds() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php index 7e54bdacca445fbe660a64fff54d63f03686ae42..81dba29756a4408a74aef9f5a29aa8441398785c 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/ProcessorTest.php @@ -43,6 +43,11 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase */ protected $_indexerMock; + /** + * @var \Magento\Indexer\Model\IndexerFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_indexerFactoryMock; + /** * @var \Magento\Catalog\Model\Indexer\Product\Flat\State|\PHPUnit_Framework_MockObject_MockObject */ @@ -61,6 +66,15 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase ); $this->_indexerMock->expects($this->any())->method('getId')->will($this->returnValue(1)); + $this->_indexerFactoryMock = $this->getMock( + 'Magento\Indexer\Model\IndexerFactory', array('create'), array(), '', false + ); + + $this->_indexerFactoryMock + ->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_indexerMock)); + $this->_stateMock = $this->getMock( 'Magento\Catalog\Model\Indexer\Product\Flat\State', array('isFlatEnabled'), @@ -68,10 +82,10 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase '', false ); - $this->_model = $this->_objectManager->getObject( - 'Magento\Catalog\Model\Indexer\Product\Flat\Processor', - array('indexer' => $this->_indexerMock, 'state' => $this->_stateMock) - ); + $this->_model = $this->_objectManager->getObject('Magento\Catalog\Model\Indexer\Product\Flat\Processor', array( + 'indexerFactory' => $this->_indexerFactoryMock, + 'state' => $this->_stateMock + )); } /** diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php new file mode 100644 index 0000000000000000000000000000000000000000..c963cc87b308a1f5e324a27f5d2f0c8f7e5af84b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CatalogRuleTest.php @@ -0,0 +1,131 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Magento_Catalog + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; + + +class CatalogRuleTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $_objectManager; + + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule + */ + protected $_model; + + /** + * @var \Magento\Catalog\Model\Indexer\Product\Price\Processor|\PHPUnit_Framework_MockObject_MockObject + */ + protected $_priceProcessorMock; + + protected function setUp() + { + $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + + $this->_priceProcessorMock = $this->getMock( + 'Magento\Catalog\Model\Indexer\Product\Price\Processor', array(), array(), '', false + ); + + $this->_model = $this->_objectManager->getObject( + '\Magento\Catalog\Model\Indexer\Product\Price\Plugin\CatalogRule', + array( + 'processor' => $this->_priceProcessorMock + ) + ); + } + + public function testAfterApplyAll() + { + $this->_priceProcessorMock->expects($this->once()) + ->method('markIndexerAsInvalid'); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->afterApplyAll($ruleMock); + } + + /** + * @param int|\Magento\Catalog\Model\Product $product + * @param int $expectedIdCall + * @dataProvider affectedProductsDataProvider + */ + public function testAroundApplyToProduct($product, $expectedIdCall) + { + $this->_priceProcessorMock->expects($this->once()) + ->method('reindexRow') + ->with($expectedIdCall); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->aroundApplyToProduct( + $ruleMock, + function () { + + }, + $product + ); + } + + /** + * @param int|\Magento\Catalog\Model\Product $product + * @param int $expectedIdCall + * @dataProvider affectedProductsDataProvider + */ + public function testAroundApplyAllRulesToProduct($product, $expectedIdCall) + { + $this->_priceProcessorMock->expects($this->once()) + ->method('reindexRow') + ->with($expectedIdCall); + + $ruleMock = $this->getMock('Magento\CatalogRule\Model\Rule', array(), array(), '', false); + $this->_model->aroundApplyToProduct( + $ruleMock, + function () { + + }, + $product + ); + } + + /** + * @return array + */ + public function affectedProductsDataProvider() + { + $productId = 11; + $productMock = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $productMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue($productId)); + + return array( + array($productId, $productId), + array($productMock, $productId) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php index 7c802405dd55cefdb0b265d7c876bfd042ad556d..ccc40806f8175e4a7aabb69257cc198532bff19e 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroupTest.php @@ -39,7 +39,7 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase protected $_model; /** - * @var \Magento\Customer\Model\Resource\Group|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ protected $_subjectMock; @@ -47,7 +47,9 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase { $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_subjectMock = $this->getMock('Magento\Customer\Model\Resource\Group', array(), array(), '', false); + $this->_subjectMock = $this->getMock( + '\Magento\Customer\Service\V1\CustomerGroupServiceInterface', array(), array(), '', false + ); $indexerMock = $this->getMock( 'Magento\Indexer\Model\Indexer', @@ -67,11 +69,11 @@ class CustomerGroupTest extends \PHPUnit_Framework_TestCase public function testAroundDelete() { - $this->assertEquals('return_value', $this->_model->afterDelete($this->_subjectMock, 'return_value')); + $this->assertEquals('return_value', $this->_model->afterDeleteGroup($this->_subjectMock, 'return_value')); } public function testAroundSave() { - $this->assertEquals('return_value', $this->_model->afterSave($this->_subjectMock, 'return_value')); + $this->assertEquals('return_value', $this->_model->afterSaveGroup($this->_subjectMock, 'return_value')); } } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php index b9141664e7190a8f8d56fceedd94544ca1f4c264..e155bce18780c5c311411fe34916e9c1eeab1554 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php index 33851f12097af9a6697a6faad87cb61ab91c9fdb..65c38b3536ef044cd3fb5b949be73b0e60c165d7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/Type/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php index 17fb08763437d7fd19fe483dbf9785c0f7ec9928..ec3727b3ce8c4e2040c034a976d5d910cab6eb37 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/ProductTest.php @@ -94,22 +94,29 @@ class ProductTest extends \PHPUnit_Framework_TestCase $eventManagerMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $cacheInterfaceMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false); $contextMock = $this->getMock( '\Magento\Model\Context', - array('getEventDispatcher', 'getCacheManager', 'getAppState'), - array(), - '', - false + array('getEventDispatcher', 'getCacheManager', 'getAppState', 'getActionValidator'), array(), '', false ); $contextMock->expects($this->any())->method('getAppState')->will($this->returnValue($stateMock)); $contextMock->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock)); - $contextMock->expects($this->any())->method('getCacheManager')->will($this->returnValue($cacheInterfaceMock)); + $contextMock->expects($this->any()) + ->method('getCacheManager') + ->will($this->returnValue($cacheInterfaceMock)); + + $contextMock->expects($this->any()) + ->method('getActionValidator') + ->will($this->returnValue($actionValidatorMock)); $this->_model = new \Magento\Catalog\Model\Product( $contextMock, diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php index 506f95773502336deb81a8ca1eff0b444af34dd1..a13b5f948964eee1ad54329ce9584c893f69477f 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Eav/AttributeTest.php @@ -52,36 +52,30 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $cacheInterfaceMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); + $contextMock = $this->getMock( '\Magento\Model\Context', - array('getEventDispatcher', 'getCacheManager'), - array(), - '', - false + array('getEventDispatcher', 'getCacheManager', 'getActionValidator'), array(), '', false ); $contextMock->expects($this->any())->method('getEventDispatcher')->will($this->returnValue($eventManagerMock)); $contextMock->expects($this->any())->method('getCacheManager')->will($this->returnValue($cacheInterfaceMock)); + $contextMock->expects($this->any())->method('getActionValidator') + ->will($this->returnValue($actionValidatorMock)); $dbAdapterMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); $dbAdapterMock->expects($this->any())->method('getTransactionLevel')->will($this->returnValue(1)); $resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', - array( - '_construct', - '_getReadAdapter', - '_getWriteAdapter', - 'getIdFieldName', - 'save', - 'saveInSetIncluding', - 'isUsedBySuperProducts', - 'delete' - ), - array(), - '', - false + 'Magento\Model\Resource\AbstractResource', + array('_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName', + 'save', 'saveInSetIncluding', 'isUsedBySuperProducts', 'delete'), + array(), '', false ); $resourceMock->expects($this->any())->method('_getWriteAdapter')->will($this->returnValue($dbAdapterMock)); diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b8a5b12babacfdfb57a56784caa8a411cf27aa06 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/CollectionTest.php @@ -0,0 +1,135 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Resource\Product\Option; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Collection + */ + protected $collection; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; + + /** + * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManagerMock; + + /** + * @var Value\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $optionsFactoryMock; + + /** + * @var \Magento\Core\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeManagerMock; + + /** + * @var \Magento\Catalog\Model\Resource\Product\Option|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Magento\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $adapterMock; + + /** + * @var \Zend_Db_Select|\PHPUnit_Framework_MockObject_MockObject + */ + protected $selectMock; + + protected function setUp() + { + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->eventManagerMock = $this->getMock('Magento\Event\Manager', array(), array(), '', false); + $this->optionsFactoryMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory', + array('create'), + array(), + '', + false + ); + $this->storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); + $this->resourceMock = $this->getMock( + 'Magento\Catalog\Model\Resource\Product\Option', + array('getReadConnection', '__wakeup', 'getMainTable', 'getTable'), + array(), + '', + false + ); + $this->selectMock = $this->getMock('Zend_Db_Select', array('from', 'reset'), array(), '', false); + $this->adapterMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array('select'), array(), '', false); + $this->adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($this->selectMock)); + $this->resourceMock->expects($this->once()) + ->method('getReadConnection') + ->will($this->returnValue($this->adapterMock)); + $this->resourceMock->expects($this->once()) + ->method('getMainTable') + ->will($this->returnValue('test_main_table')); + $this->resourceMock->expects($this->once()) + ->method('getTable') + ->with('test_main_table') + ->will($this->returnValue('test_main_table')); + + $this->collection = new Collection( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock, + $this->eventManagerMock, + $this->optionsFactoryMock, + $this->storeManagerMock, + null, + $this->resourceMock + ); + } + + public function testReset() + { + $this->collection->reset(); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php index 6122b164af80caf6a076c8dab6bd693a908854ba..082910be1074db4256543e82a1f6e4cd06e672b7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/Stub.php @@ -26,6 +26,6 @@ */ namespace Magento\Catalog\Model\Resource\Product\Option; -class Stub extends \Magento\Core\Model\AbstractModel +class Stub extends \Magento\Model\AbstractModel { } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php index bfce1a9d1751de42c7ed817d0beda4105ea69b86..44b78557f148660b3dbcf904869b3a100777aaa7 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Option/ValueStub.php @@ -39,9 +39,9 @@ class ValueStub extends \Magento\Catalog\Model\Resource\Product\Option\Value /** * Save option value price data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object */ - public function saveValueTitles(\Magento\Core\Model\AbstractModel $object) + public function saveValueTitles(\Magento\Model\AbstractModel $object) { $this->_saveValueTitles($object); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php index 96142590fa4e71ca98a054898447b50d8788cc46..29c7adf6aecb9fe64ea5dfa67dde3de442a2c2ef 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Template/Filter/FactoryTest.php @@ -86,7 +86,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass doesn't extends \Magento\Filter\Template */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php index ea69ef997d9472d47c88d3a75a1a9eba4153ffa8..780eaa6cca05a26ce9f2757672c31b1f35c28c1c 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Adminhtml/Stock/ItemTest.php @@ -36,7 +36,7 @@ class ItemTest extends \PHPUnit_Framework_TestCase protected function setUp() { $resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\AbstractResource', + 'Magento\Model\Resource\AbstractResource', array('_construct', '_getReadAdapter', '_getWriteAdapter', 'getIdFieldName'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php index e34f04be7b8f3404c353ced288518f753086090c..937181def82f80678895f46853e532e21bddf9de 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/Initializer/OptionTest.php @@ -244,7 +244,7 @@ class OptionTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage The stock item for Product in option is not valid. */ public function testInitializeWithInvalidOptionQty() diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php index ef19c60743fceb38aef8e6b2ffa7d9d166927861..f4dce9972633697664426df3869f85b6f1f746ec 100644 --- a/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Helper/DataTest.php @@ -42,7 +42,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_translator = $this->getMock('Magento\TranslateInterface', array(), array(), '', false); + $this->_translator = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $context = $this->getMock('\Magento\App\Helper\Context', array(), array(), '', false); $storeConfig = $this->getMock('\Magento\Core\Model\Store\Config', array(), array(), '', false); @@ -180,8 +180,10 @@ class DataTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->getMock('Magento\Mail\TransportInterface')) ); - $this->_translator->expects($this->at(0))->method('setTranslateInline')->with(false); - $this->_translator->expects($this->at(1))->method('setTranslateInline')->with(true); + $this->_translator->expects($this->at(1)) + ->method('suspend'); + $this->_translator->expects($this->at(1)) + ->method('resume'); $productOne = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); $productOne->expects($this->once())->method('getName')->will($this->returnValue('Product One')); diff --git a/dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php similarity index 56% rename from dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php rename to dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php index 9897113bd210c9c09893b7cbd3ba587888422e7f..456c760ec8ea5c610a31eb08aa8d855efa8ec2f6 100644 --- a/dev/tests/integration/testsuite/Magento/Url/QueryParamsResolverTest.php +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Config/Source/Cart/SummaryTest.php @@ -18,35 +18,35 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage integration_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Url; +namespace Magento\Checkout\Model\Config\Source\Cart; -class QueryParamsResolverTest extends \PHPUnit_Framework_TestCase +use Magento\TestFramework\Helper\ObjectManager; + +class SummaryTest extends \PHPUnit_Framework_TestCase { - /** - * @var \Magento\Url\QueryParamsResolver - */ - protected $_model; + /** @var \Magento\Checkout\Model\Config\Source\Cart\Summary */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; protected function setUp() { - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Url\QueryParamsResolver' - ); + $this->objectManager = new ObjectManager($this); + $this->object = $this->objectManager->getObject('Magento\Checkout\Model\Config\Source\Cart\Summary'); } - public function testSetGetPurgeQueryParams() + public function testToOptionArray() { - $params = array('one' => 1, 'two' => 2); - $this->_model->setQueryParams($params); - $this->assertEquals($params, $this->_model->getQueryParams()); - - $this->_model->purgeQueryParams(); - $this->assertEquals(array(), $this->_model->getQueryParams()); + $this->assertEquals( + [ + ['value' => 0, 'label' => 'Display number of items in cart'], + ['value' => 1, 'label' => 'Display item quantities'], + ], + $this->object->toOptionArray() + ); } } diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..b5b66f0dc3bb10a982fb313c5f2e5c74ecfd49d1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/ObserverTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Model; + +use Magento\TestFramework\Helper\ObjectManager; + +class ObserverTest extends \PHPUnit_Framework_TestCase +{ + /** @var Observer */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; + + /** @var Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $checkoutSession; + + /** @var Magento\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $messageManager; + + protected function setUp() + { + $this->objectManager = new ObjectManager($this); + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->messageManager = $this->getMock('Magento\Message\ManagerInterface', [], [], '', false); + $this->object = $this->objectManager->getObject('Magento\Checkout\Model\Observer', [ + 'checkoutSession' => $this->checkoutSession, + 'messageManager' => $this->messageManager, + ]); + } + + public function testUnsetAll() + { + $this->checkoutSession->expects($this->once())->method('clearQuote')->will($this->returnSelf()); + $this->checkoutSession->expects($this->once())->method('clearStorage')->will($this->returnSelf()); + + $this->object->unsetAll(); + } + + public function testLoadCustomerQuoteThrowingCoreException() + { + $this->checkoutSession->expects($this->once())->method('loadCustomerQuote')->will( + $this->throwException(new \Magento\Model\Exception('Message')) + ); + $this->messageManager->expects($this->once())->method('addError')->with('Message'); + + $this->object->loadCustomerQuote(); + } + + public function testLoadCustomerQuoteThrowingException() + { + $exception = new \Exception('Message'); + $this->checkoutSession->expects($this->once())->method('loadCustomerQuote')->will( + $this->throwException($exception) + ); + $this->messageManager->expects($this->once())->method('addException') + ->with($exception, 'Load customer quote error'); + + $this->object->loadCustomerQuote(); + } + + public function testSalesQuoteSaveAfter() + { + $observer = $this->getMock('Magento\Event\Observer', [], [], '', false); + $observer->expects($this->once())->method('getEvent')->will( + $this->returnValue(new \Magento\Object( + ['quote' => new \Magento\Object(['is_checkout_cart' => 1, 'id' => 7])] + )) + ); + $this->checkoutSession->expects($this->once())->method('getQuoteId')->with(7); + + $this->object->salesQuoteSaveAfter($observer); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5b9b754fa294d40c07e459bf6278b08e58db4b7d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Model/Type/AbstractTypeTest.php @@ -0,0 +1,156 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Checkout\Model\Type; + +/** + * Test class for \Magento\Checkout\Model\Type\AbstractType + */ +class AbstractTypeTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Checkout\Model\Type\AbstractType */ + protected $model; + + /** + * @var \Magento\Checkout\Model\Session|\PHPUnit_Framework_MockObject_MockObject + */ + protected $checkoutSession; + + /** @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerSession; + + /** @var \Magento\Sales\Model\OrderFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $orderFactory; + + /** @var \Magento\Customer\Service\V1\CustomerAddressServiceInterface|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerAddressService; + + /** @var \Magento\Customer\Service\V1\Data\Customer|\PHPUnit_Framework_MockObject_MockObject */ + protected $customerObject; + + public function setUp() + { + $this->checkoutSession = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $this->customerSession = $this->getMock('Magento\Customer\Model\Session', [], [], '', false); + $this->orderFactory = $this->getMock('Magento\Sales\Model\OrderFactory', [], [], '', false); + $this->customerAddressService = $this->getMock('Magento\Customer\Service\V1\CustomerAddressServiceInterface'); + + $this->customerObject = $this->getMock('Magento\Customer\Service\V1\Data\Customer', [], [], '', false); + $this->model = $this->getMockForAbstractClass( + '\Magento\Checkout\Model\Type\AbstractType', + [ + 'checkoutSession' => $this->checkoutSession, + 'customerSession' => $this->customerSession, + 'orderFactory' => $this->orderFactory, + 'customerAddressService' => $this->customerAddressService + ], + '', + true + ); + } + + public function testGetCheckoutSession() + { + $this->assertSame($this->checkoutSession, $this->model->getCheckoutSession()); + } + + public function testGetCustomerSession() + { + $this->assertSame($this->customerSession, $this->model->getCustomerSession()); + } + + public function testGetCustomer() + { + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->assertSame($this->customerObject, $this->model->getCustomer()); + } + + public function testGetQuote() + { + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + + $this->assertSame($quoteMock, $this->model->getQuote()); + } + + public function testGetQuoteItems() + { + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', [], [], '', false); + $itemMock = $this->getMock('Magento\Sales\Model\Quote\Item', [], [], '', false); + $this->checkoutSession->expects($this->once())->method('getQuote')->will($this->returnValue($quoteMock)); + $quoteMock->expects($this->once())->method('getAllItems')->will($this->returnValue([$itemMock])); + + $this->assertEquals([$itemMock], $this->model->getQuoteItems()); + } + + /** + * @param string $serviceMethod + * @param string $modelMethod + * @dataProvider getDefaultAddressDataProvider + */ + public function testGetCustomerDefaultShippingAddress($serviceMethod, $modelMethod) + { + $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); + $customerId = 1; + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->customerObject->expects($this->once())->method('getId') + ->will($this->returnValue($customerId)); + $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) + ->will($this->returnValue($address)); + $this->customerAddressService->expects($this->never())->method('getAddresses'); + + $this->assertSame($address, $this->model->$modelMethod()); + } + + /** + * @param string $serviceMethod + * @param string $modelMethod + * @dataProvider getDefaultAddressDataProvider + */ + public function testGetCustomerDefaultShippingAddressIfDefaultNotAvailable($serviceMethod, $modelMethod) + { + $address = $this->getMock('Magento\Customer\Service\V1\Data\Address', [], [], '', false); + $customerId = 1; + $this->customerSession->expects($this->once())->method('getCustomerDataObject') + ->will($this->returnValue($this->customerObject)); + $this->customerObject->expects($this->once())->method('getId') + ->will($this->returnValue($customerId)); + $this->customerAddressService->expects($this->once())->method($serviceMethod)->with($customerId) + ->will($this->returnValue(null)); + $this->customerAddressService->expects($this->once())->method('getAddresses')->with($customerId) + ->will($this->returnValue([$address])); + + $this->assertSame($address, $this->model->$modelMethod()); + } + + public function getDefaultAddressDataProvider() + { + return [ + ['getDefaultShippingAddress', 'getCustomerDefaultShippingAddress'], + ['getDefaultBillingAddress', 'getCustomerDefaultBillingAddress'], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php index c1cfaef73a898449df073551987af7d61bdd23b2..accf4d9860dcf9db6d2156e2524e5ac4913ea2dd 100644 --- a/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Cms/Model/Wysiwyg/Images/StorageTest.php @@ -240,7 +240,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testDeleteDirectoryOverRoot() { $this->setExpectedException( - '\Magento\Core\Exception', + '\Magento\Model\Exception', sprintf('Directory %s is not under storage root path.', self::INVALID_DIRECTORY_OVER_ROOT) ); $this->_model->deleteDirectory(self::INVALID_DIRECTORY_OVER_ROOT); @@ -252,7 +252,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase public function testDeleteRootDirectory() { $this->setExpectedException( - '\Magento\Core\Exception', + '\Magento\Model\Exception', sprintf('We cannot delete root directory %s.', self::STORAGE_ROOT_DIR) ); $this->_model->deleteDirectory(self::STORAGE_ROOT_DIR); diff --git a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php index b4975ad8fc366622fba679d6aad201915844a603..6285c6fd5b237317a034efde5808a653c72516b9 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Converter/Dom/FlatTest.php @@ -41,8 +41,13 @@ class FlatTest extends \PHPUnit_Framework_TestCase { $arrayNodeConfig = new \Magento\Config\Dom\ArrayNodeConfig( new \Magento\Config\Dom\NodePathMatcher(), - array('/root/multipleNode' => 'id'), - array('/root/node_one/subnode') + array( + '/root/multipleNode' => 'id', + '/root/wrongArray' => 'id', + ), + array( + '/root/node_one/subnode', + ) ); $this->_model = new \Magento\Config\Converter\Dom\Flat($arrayNodeConfig); $this->_fixturePath = realpath(__DIR__ . '/../../') . '/_files/converter/dom/flat/'; @@ -58,4 +63,28 @@ class FlatTest extends \PHPUnit_Framework_TestCase $actual = $this->_model->convert($dom); $this->assertEquals($expected, $actual); } + + /** + * @expectedException \UnexpectedValueException + * @expectedExceptionMessage Node path '/root/someOtherVal' is not unique, but it has not been marked as array. + */ + public function testConvertWithNotUnique() + { + $dom = new \DOMDocument(); + $dom->load($this->_fixturePath . 'source_notuniq.xml'); + + $this->_model->convert($dom); + } + + /** + * @expectedException \UnexpectedValueException + * @expectedExceptionMessage Array is expected to contain value for key 'id'. + */ + public function testConvertWrongArray() + { + $dom = new \DOMDocument(); + $dom->load($this->_fixturePath . 'source_wrongarray.xml'); + + $this->_model->convert($dom); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php new file mode 100644 index 0000000000000000000000000000000000000000..955869d88a85de430b1c1fac946a8b48bf62cd5f --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/Converter/DomTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Config\Converter; + +class DomTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param string $sourceFile + * @param string $resultFile + * @dataProvider convertDataProvider + */ + public function testConvert($sourceFile, $resultFile) + { + $dom = new \DOMDocument(); + $dom->loadXML(file_get_contents(__DIR__ . "/../_files/converter/dom/{$sourceFile}")); + $resultFile = include __DIR__ . "/../_files/converter/dom/{$resultFile}"; + + $converterDom = new Dom(); + $this->assertEquals($resultFile, $converterDom->convert($dom)); + } + + public function convertDataProvider() + { + return array( + array('cdata.xml', 'cdata.php',), + array('attributes.xml', 'attributes.php',), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Config/DomTest.php b/dev/tests/unit/testsuite/Magento/Config/DomTest.php index 34f881af3c16280a60bf60d26b3f981898acd615..07ef8cdd0ea1a340121199fef08e1e48a8dc9753 100644 --- a/dev/tests/unit/testsuite/Magento/Config/DomTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/DomTest.php @@ -163,4 +163,17 @@ class DomTest extends \PHPUnit_Framework_TestCase $dom = new \Magento\Config\Dom($xml, array(), null, null, $errorFormat); $dom->validate(__DIR__ . '/_files/sample.xsd'); } + + public function testValidateUnknownError() + { + $xml = '<root><node id="id1"/><node id="id2"/></root>'; + $schemaFile = __DIR__ . '/_files/sample.xsd'; + $dom = new \Magento\Config\Dom($xml); + $domMock = $this->getMock('DOMDocument', array('schemaValidate'), array()); + $domMock->expects($this->once()) + ->method('schemaValidate') + ->with($schemaFile) + ->will($this->returnValue(false)); + $this->assertEquals(array('Unknown validation error'), $dom->validateDomDocument($domMock, $schemaFile)); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php index d86f529913c26b6e7ab6a168a15d48f565add4e5..07852ff61547b8cea978a812e5f4bdd4e99bc341 100644 --- a/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/Reader/FilesystemTest.php @@ -77,6 +77,22 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase $model->read('scope'); } + public function testReadWithoutFiles() + { + $model = new Filesystem( + $this->_fileResolverMock, + $this->_converterMock, + $this->_schemaLocatorMock, + $this->_validationStateMock, + 'fileName', + array() + ); + $this->_fileResolverMock + ->expects($this->once())->method('get')->will($this->returnValue(array())); + + $this->assertEmpty($model->read('scope')); + } + /** * @expectedException \Magento\Exception * @expectedExceptionMessage Invalid Document diff --git a/app/code/Magento/Backend/Model/Translate/Inline.php b/dev/tests/unit/testsuite/Magento/Config/ScopeTest.php similarity index 50% rename from app/code/Magento/Backend/Model/Translate/Inline.php rename to dev/tests/unit/testsuite/Magento/Config/ScopeTest.php index 777d94c75f5f6d4e7e4e6a8e5f48dbbaf4a7e089..70db7e09076b3e204a92096868f4040f35c35d6e 100644 --- a/app/code/Magento/Backend/Model/Translate/Inline.php +++ b/dev/tests/unit/testsuite/Magento/Config/ScopeTest.php @@ -17,42 +17,44 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Backend + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Backend\Model\Translate; -/** - * Inline Translations PHP part - */ -class Inline extends \Magento\Translate\Inline +namespace Magento\Config; + +class ScopeTest extends \PHPUnit_Framework_TestCase { /** - * Return URL for ajax requests - * - * @return string + * @var \Magento\Config\Scope */ - protected function _getAjaxUrl() - { - return $this->_url->getUrl(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE . '/ajax/translate'); - } + protected $model; /** - * Replace translation templates with HTML fragments - * - * @param array|string &$body - * @param bool $isJson - * @return $this + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\AreaList */ - public function processResponseBody(&$body, $isJson = false) + protected $areaListMock; + + protected function setUp() + { + $this->areaListMock = $this->getMock('Magento\App\AreaList', array('getCodes'), array(), '', false); + $this->model = new Scope($this->areaListMock); + } + + public function testScopeSetGet() + { + $scopeName = 'test_scope'; + $this->model->setCurrentScope($scopeName); + $this->assertEquals($scopeName, $this->model->getCurrentScope()); + } + + public function testGetAllScopes() { - if (!$this->isAllowed()) { - $this->_stripInlineTranslations($body); - return $this; - } - return parent::processResponseBody($body, $isJson); + $expectedBalances = array('primary', 'test_scope'); + $this->areaListMock->expects($this->once()) + ->method('getCodes') + ->will($this->returnValue(array('test_scope'))); + $this->assertEquals($expectedBalances, $this->model->getAllScopes()); } } diff --git a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php index 6bb89cb617493cd9fa0ca4beeb4c3cf6fefe81dd..f6c83e53fced41bb92e8a943130a165bccd2e47f 100644 --- a/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/ThemeTest.php @@ -76,4 +76,50 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array('test_external_package_descendant', array('default_test2')) ); } + + /** + * @param string $themePath + * @param array $expected + * @dataProvider dataGetterDataProvider + */ + public function testDataGetter($themePath, $expected) + { + $expected = reset($expected); + $config = new \Magento\Config\Theme(file_get_contents(__DIR__ . "/_files/area/$themePath/theme.xml")); + $this->assertSame($expected['version'], $config->getThemeVersion()); + $this->assertSame($expected['media'], $config->getMedia()); + } + + /** + * @return array + */ + public function dataGetterDataProvider() + { + return array( + array( + 'default_default', + array(array( + 'version' => '2.0.0.9', + 'media' => array('preview_image' => 'media/default_default.jpg'), + ))), + array( + 'default_test', + array(array( + 'version' => '2.1.0.0', + 'media' => array('preview_image' => ''), + ))), + array( + 'default_test2', + array(array( + 'version' => '2.0.0.0', + 'media' => array('preview_image' => ''), + ))), + array( + 'test_default', + array(array( + 'version' => '2.0.1.0', + 'media' => array('preview_image' => 'media/test_default.jpg'), + ))), + ); + } } diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml index e9252cc20f9dcb45cc1acfb3387cabdd4d71825e..9341a2afe7ed4f9a5767d2398f5efc9c807cd84c 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_default/theme.xml @@ -28,5 +28,8 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Default</title> - <version>2.0.0.0</version> + <version>2.0.0.9</version> + <media> + <preview_image>media/default_default.jpg</preview_image> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml index 986333806f52b752354ac5668449c014c9951789..a3f7dcec65698e8cea0e9c2b63395ee904ee3def 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/default_test/theme.xml @@ -28,6 +28,9 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Test</title> - <version>2.0.0.0</version> + <version>2.1.0.0</version> <parent>default_default</parent> + <media> + <preview_image /> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml b/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml index e9252cc20f9dcb45cc1acfb3387cabdd4d71825e..69d2f7d34621201f797039a8d027df21338d83f0 100644 --- a/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/area/test_default/theme.xml @@ -28,5 +28,8 @@ --> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/Config/etc/theme.xsd"> <title>Default</title> - <version>2.0.0.0</version> + <version>2.0.1.0</version> + <media> + <preview_image>media/test_default.jpg</preview_image> + </media> </theme> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php new file mode 100644 index 0000000000000000000000000000000000000000..0d6d61ae19897430bd8fc40b8ebaa8c5967a58b3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.php @@ -0,0 +1,70 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +return array( + 'root' => array( + array( + 'item' => array( + array( + '__attributes__' => array( + 'id' => 'id1', + 'attrZero' => 'value 0', + ), + '__content__' => 'Item 1.1', + ), + array( + '__attributes__' => array( + 'id' => 'id2', + 'attrOne' => 'value 2', + ), + 'subitem' => array( + array( + '__attributes__' => array( + 'id' => 'id2.1', + 'attrTwo' => 'value 2.1', + ), + '__content__' => 'Item 2.1', + ), + array( + '__attributes__' => array( + 'id' => 'id2.2', + ), + 'value' => array( + array('__content__' => 1), + array('__content__' => 2), + array('__content__' => 'test'), + ), + ), + ), + ), + array( + '__attributes__' => array( + 'id' => 'id3', + 'attrThree' => 'value 3', + ), + '__content__' => 'Item 3.1', + ), + ), + ), + ), +); \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml new file mode 100644 index 0000000000000000000000000000000000000000..d8cbb5a8626c44e965de5d1de15bf61f3928f960 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/attributes.xml @@ -0,0 +1,37 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <item id="id1" attrZero="value 0">Item 1.1</item> + <item id="id2" attrOne="value 2"> + <subitem id="id2.1" attrTwo="value 2.1">Item 2.1</subitem> + <subitem id="id2.2"> + <value>1</value> + <value>2</value> + <value>test</value> + </subitem> + </item> + <item id="id3" attrThree="value 3">Item 3.1</item> +</root> diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php similarity index 70% rename from dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php rename to dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php index 56fd99a57b72afa3712d2c9b1c666941e65ca3b2..ca689ddbd7bca81f7a40ce4351a7234c776dc5f1 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.php @@ -1,7 +1,5 @@ <?php /** - * \Magento\PubSub\Event\Factory - * * Magento * * NOTICE OF LICENSE @@ -23,15 +21,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\PubSub\Event; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = new \Magento\PubSub\Event\Factory(); - $event = $factory->create('topic', array()); - - $this->assertInstanceOf('Magento\PubSub\EventInterface', $event); - } -} +return array( + 'root' => array( + array( + 'cdata' => array( + array( + 'node_one' => array( + array('__content__' => '<valueOne>'), + ), + ), + ), + 'cdata_next' => array( + array('__content__' => '<valueTwo>'), + ), + ), + ), +); \ No newline at end of file diff --git a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml similarity index 82% rename from dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml rename to dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml index 0224ee61daf8de53a3e79e789221558c31d9f1b0..c1d31ac7264101477582081deaa02b3b1a170c66 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/cdata.xml @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <!-- /** * Magento @@ -23,5 +23,11 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ --> -<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../app/code/Magento/Core/etc/config.xsd"> -</config> \ No newline at end of file +<root> + <cdata> + <node_one><![CDATA[<valueOne>]]></node_one> + </cdata> + <cdata_next> + <![CDATA[<valueTwo>]]> + </cdata_next> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml new file mode 100644 index 0000000000000000000000000000000000000000..1bf30dd2fd3ed79feed76ea9616d9fada96de8e4 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_notuniq.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <node_one attributeOne = '10' attributeTwo = '20'> + <subnode attributeThree = '30'></subnode> + <subnode attributeThree = '40' attributeFour = '40' >Value1</subnode> + <books attributeFive = '50' /> + </node_one> + <multipleNode id="one" name="name1"> + <value>1</value> + </multipleNode> + <multipleNode id="two" name="name2"> + <value>2</value> + </multipleNode> + <someOtherVal>1</someOtherVal> + <someOtherVal>2</someOtherVal> + <someDataVal><![CDATA[]]></someDataVal> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml new file mode 100644 index 0000000000000000000000000000000000000000..ce692e13db6b41c2e8e963b223125a31e7a2b1ec --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Config/_files/converter/dom/flat/source_wrongarray.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<root> + <node_one attributeOne = '10' attributeTwo = '20'> + <subnode attributeThree = '30'></subnode> + <subnode attributeThree = '40' attributeFour = '40' >Value1</subnode> + <books attributeFive = '50' /> + </node_one> + <multipleNode id="one" name="name1"> + <value>1</value> + </multipleNode> + <multipleNode id="two" name="name2"> + <value>2</value> + </multipleNode> + <wrongArray id="1"><value>abcd</value></wrongArray> + <wrongArray id="2"><value>bcde</value></wrongArray> + <wrongArray id="3"><value>cdef</value></wrongArray> + <wrongArray><value>abcd</value></wrongArray> + <someDataVal><![CDATA[]]></someDataVal> +</root> diff --git a/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..aec5d73f0578ea8726d10f81db1dac094d7aea1b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Controller/Router/Route/FactoryTest.php @@ -0,0 +1,104 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @category Magento + * @package Framework + * @subpackage unit_tests + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Controller\Router\Route; + +class FactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\ObjectManager + */ + protected $objectManager; + + public function setUp() + { + $this->objectManager = $this->getMockBuilder('Magento\ObjectManager') + ->disableOriginalConstructor() + ->getMock(); + } + + /** + * @test + */ + public function testCreateRoute() + { + $routerClass = 'router'; + + $router = $this->getMockBuilder('Zend_Controller_Router_Route_Interface') + ->setMockClassName($routerClass) + ->getMock(); + + $parameterRoute = 'route'; + $parameterDefaults = 'defaults'; + $parameterRegs = 'regs'; + $parameterLocale = 'locale'; + + $this->objectManager->expects($this->once()) + ->method('create') + ->with( + $this->logicalOr( + $routerClass, + array( + 'route' => $parameterRoute, + 'defaults' => $parameterDefaults, + 'regs' => $parameterRegs, + 'locale' => $parameterLocale, + ) + ) + ) + ->will($this->returnValue($router)); + + $object = new \Magento\Controller\Router\Route\Factory($this->objectManager); + $expectedRouter = $object->createRoute( + $routerClass, + $parameterRoute, + $parameterDefaults, + $parameterRegs, + $parameterLocale + ); + + $this->assertInstanceOf($routerClass, $expectedRouter); + $this->assertInstanceOf('Zend_Controller_Router_Route_Interface', $expectedRouter); + } + + /** + * @test + * @expectedException \LogicException + */ + public function testCreateRouteNegative() + { + $this->objectManager->expects($this->once()) + ->method('create') + ->will($this->returnValue(new \StdClass)); + + $object = new \Magento\Controller\Router\Route\Factory($this->objectManager); + $object->createRoute( + 'routerClass', + 'router' + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php index 74b46f57fafe1480decf0739bdecf636034684fb..47285d9e20ed58bbf00c98ef36afbe966ab2d3db 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/ConvertArrayTest.php @@ -25,8 +25,6 @@ */ namespace Magento\Convert; -use Magento\Convert\ConvertArray; - class ConvertArrayTest extends \PHPUnit_Framework_TestCase { /** @@ -52,6 +50,21 @@ XML; $this->assertEquals($expectedResult, $result->asXML()); } + /** + * @expectedException \Exception + * @expectedExceptionMessage Associative and numeric keys must not be mixed at one level. + */ + public function testAssocToXmlExceptionByKey() + { + $data = array( + 'one' => array( + 100, + 'two' => 'three', + ), + ); + $this->_model->assocToXml($data); + } + /** * @param array $array * @param string $rootName diff --git a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php index 4a5d9f74d2cf5f0aa7391a66787f80952cec3d5c..4ffbb7a37882cf2688a15aed88dec320789b2ae2 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/ExcelTest.php @@ -41,6 +41,16 @@ class ExcelTest extends \PHPUnit_Framework_TestCase array(1, 'Jon Doe', 'jon.doe@magento.com', 'General', '310-111-1111', 90232, 'United States', 'California') ); + protected $_testHeader = array( + 'HeaderID', 'HeaderName', 'HeaderEmail', 'HeaderGroup', 'HeaderPhone', 'HeaderZIP', + 'HeaderCountry', 'HeaderRegion', + ); + + protected $_testFooter = array( + 'FooterID', 'FooterName', 'FooterEmail', 'FooterGroup', 'FooterPhone', 'FooterZIP', + 'FooterCountry', 'FooterRegion', + ); + /** * Path for Sample File * @@ -75,7 +85,9 @@ class ExcelTest extends \PHPUnit_Framework_TestCase public function testConvert() { $convert = new \Magento\Convert\Excel(new \ArrayIterator($this->_testData)); - $isEqual = file_get_contents($this->_getSampleOutputFile()) == $convert->convert(); + $convert->setDataHeader($this->_testHeader); + $convert->setDataFooter($this->_testFooter); + $isEqual = (file_get_contents($this->_getSampleOutputFile()) == $convert->convert()); $this->assertTrue($isEqual, 'Failed asserting that data is the same.'); } @@ -107,6 +119,8 @@ class ExcelTest extends \PHPUnit_Framework_TestCase if (!$callback) { $convert = new \Magento\Convert\Excel(new \ArrayIterator($this->_testData)); + $convert->setDataHeader($this->_testHeader); + $convert->setDataFooter($this->_testFooter); } else { $convert = new \Magento\Convert\Excel( new \ArrayIterator($this->_testData), diff --git a/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php b/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php new file mode 100644 index 0000000000000000000000000000000000000000..9bf012b2491e75917d851ba4c708939dd9df76a6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Convert/ObjectTest.php @@ -0,0 +1,145 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Convert; + +class ObjectTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Convert\Object + */ + protected $model; + + protected function setUp() + { + $this->model = new Object(); + } + + public function testToOptionArray() + { + $mockFirst = $this->getMock('Magento\Object', array('getId', 'getCode'), array()); + $mockFirst->expects($this->once()) + ->method('getId') + ->will($this->returnValue(1)); + $mockFirst->expects($this->once()) + ->method('getCode') + ->will($this->returnValue('code1')); + $mockSecond = $this->getMock('Magento\Object', array('getId', 'getCode'), array()); + $mockSecond->expects($this->once()) + ->method('getId') + ->will($this->returnValue(2)); + $mockSecond->expects($this->once()) + ->method('getCode') + ->will($this->returnValue('code2')); + + $callable = function ($item) { + return $item->getCode(); + }; + + $items = array( + $mockFirst, + $mockSecond, + ); + $result = array( + array('value' => 1, 'label' => 'code1'), + array('value' => 2, 'label' => 'code2'), + ); + $this->assertEquals($result, $this->model->toOptionArray($items, 'id', $callable)); + } + + public function testToOptionHash() + { + $mockFirst = $this->getMock('Magento\Object', array('getSome', 'getId'), array()); + $mockFirst->expects($this->once()) + ->method('getId') + ->will($this->returnValue(3)); + $mockFirst->expects($this->once()) + ->method('getSome') + ->will($this->returnValue('code3')); + $mockSecond = $this->getMock('Magento\Object', array('getSome', 'getId'), array()); + $mockSecond->expects($this->once()) + ->method('getId') + ->will($this->returnValue(4)); + $mockSecond->expects($this->once()) + ->method('getSome') + ->will($this->returnValue('code4')); + + $callable = function ($item) { + return $item->getId(); + }; + $items = array( + $mockFirst, + $mockSecond, + ); + $result = array( + 3 => 'code3', + 4 => 'code4', + ); + + $this->assertEquals($result, $this->model->toOptionHash($items, $callable, 'some')); + } + + public function testConvertDataToArray() + { + $object = new \stdClass(); + $object->a = array(array(1)); + $mockFirst = $this->getMock('Magento\Object', array('getData')); + $mockSecond = $this->getMock('Magento\Object', array('getData')); + + $mockFirst->expects($this->any()) + ->method('getData') + ->will($this->returnValue(array( + 'id' => 1, + 'o' => $mockSecond, + ))); + + $mockSecond->expects($this->any()) + ->method('getData') + ->will($this->returnValue(array( + 'id' => 2, + 'o' => $mockFirst, + ))); + + $data = array( + 'object' => $mockFirst, + 'stdClass' => $object, + 'test' => 'test', + ); + $result = array( + 'object' => array( + 'id' => 1, + 'o' => array( + 'id' => 2, + 'o' => '*** CYCLE DETECTED ***', + ), + ), + 'stdClass' => array( + 'a' => array( + array(1), + ), + ), + 'test' => 'test', + ); + $this->assertEquals($result, $this->model->convertDataToArray($data)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php index de7157327858e45a6228c2f912695376908645af..81a7fd8c292bae4ba883983a5c209c3c736043e1 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Convert/XmlTest.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -39,11 +37,23 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testXmlToAssoc() { - $xmlstr = <<<XML + $xmlstr = $this->getXml(); + $result = $this->_model->xmlToAssoc(new \SimpleXMLElement($xmlstr)); + $this->assertEquals( + array( + 'one' => '1', + 'two' => array('three' => '3', 'four' => '4'), + 'five' => array(0 => '5', 1 => '6'), + ), + $result + ); + } + + protected function getXml() + { + return <<<XML <?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<_><one>1</one><two><three>3</three><four>4</four></two></_> +<_><one>1</one><two><three>3</three><four>4</four></two><five><five>5</five><five>6</five></five></_> XML; - $result = $this->_model->xmlToAssoc(new \SimpleXMLElement($xmlstr)); - $this->assertEquals(array('one' => '1', 'two' => array('three' => '3', 'four' => '4')), $result); } } diff --git a/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt b/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt index a913c5e78070dada70d000100b3393ce64eea86b..5f977525d48cf03bb77b271e244e4e06d65bfab9 100644 --- a/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt +++ b/dev/tests/unit/testsuite/Magento/Convert/_files/output.txt @@ -1 +1 @@ -<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"><OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"></OfficeDocumentSettings><ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"></ExcelWorkbook><Worksheet ss:Name="Sheet 1"><Table><Row><Cell><Data ss:Type="String">ID</Data></Cell><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Email</Data></Cell><Cell><Data ss:Type="String">Group</Data></Cell><Cell><Data ss:Type="String">Telephone</Data></Cell><Cell><Data ss:Type="String">ZIP</Data></Cell><Cell><Data ss:Type="String">Country</Data></Cell><Cell><Data ss:Type="String">State/Province</Data></Cell></Row><Row><Cell><Data ss:Type="Number">1</Data></Cell><Cell><Data ss:Type="String">Jon Doe</Data></Cell><Cell><Data ss:Type="String">jon.doe@magento.com</Data></Cell><Cell><Data ss:Type="String">General</Data></Cell><Cell><Data ss:Type="String">310-111-1111</Data></Cell><Cell><Data ss:Type="Number">90232</Data></Cell><Cell><Data ss:Type="String">United States</Data></Cell><Cell><Data ss:Type="String">California</Data></Cell></Row></Table></Worksheet></Workbook> \ No newline at end of file +<?xml version="1.0"?><?mso-application progid="Excel.Sheet"?><Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"><OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"></OfficeDocumentSettings><ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel"></ExcelWorkbook><Worksheet ss:Name="Sheet 1"><Table><Row><Cell><Data ss:Type="String">HeaderID</Data></Cell><Cell><Data ss:Type="String">HeaderName</Data></Cell><Cell><Data ss:Type="String">HeaderEmail</Data></Cell><Cell><Data ss:Type="String">HeaderGroup</Data></Cell><Cell><Data ss:Type="String">HeaderPhone</Data></Cell><Cell><Data ss:Type="String">HeaderZIP</Data></Cell><Cell><Data ss:Type="String">HeaderCountry</Data></Cell><Cell><Data ss:Type="String">HeaderRegion</Data></Cell></Row><Row><Cell><Data ss:Type="String">ID</Data></Cell><Cell><Data ss:Type="String">Name</Data></Cell><Cell><Data ss:Type="String">Email</Data></Cell><Cell><Data ss:Type="String">Group</Data></Cell><Cell><Data ss:Type="String">Telephone</Data></Cell><Cell><Data ss:Type="String">ZIP</Data></Cell><Cell><Data ss:Type="String">Country</Data></Cell><Cell><Data ss:Type="String">State/Province</Data></Cell></Row><Row><Cell><Data ss:Type="Number">1</Data></Cell><Cell><Data ss:Type="String">Jon Doe</Data></Cell><Cell><Data ss:Type="String">jon.doe@magento.com</Data></Cell><Cell><Data ss:Type="String">General</Data></Cell><Cell><Data ss:Type="String">310-111-1111</Data></Cell><Cell><Data ss:Type="Number">90232</Data></Cell><Cell><Data ss:Type="String">United States</Data></Cell><Cell><Data ss:Type="String">California</Data></Cell></Row><Row><Cell><Data ss:Type="String">FooterID</Data></Cell><Cell><Data ss:Type="String">FooterName</Data></Cell><Cell><Data ss:Type="String">FooterEmail</Data></Cell><Cell><Data ss:Type="String">FooterGroup</Data></Cell><Cell><Data ss:Type="String">FooterPhone</Data></Cell><Cell><Data ss:Type="String">FooterZIP</Data></Cell><Cell><Data ss:Type="String">FooterCountry</Data></Cell><Cell><Data ss:Type="String">FooterRegion</Data></Cell></Row></Table></Worksheet></Workbook> \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php index 02649b4fe974ab5aef0d530c5e2e878291b640d5..0f66de76774c6a86edd2d345374c45f5ccc07e77 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php @@ -33,7 +33,7 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_areaListMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -47,35 +47,25 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_appMock = $this->getMock('\Magento\Core\Model\App', array(), array(), '', false); + $this->_areaListMock = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); $this->_requestMock = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); $this->_layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $this->_model = new \Magento\View\DesignLoader($this->_requestMock, $this->_appMock, $this->_layoutMock); + $this->_model = new \Magento\View\DesignLoader( + $this->_requestMock, + $this->_areaListMock, + $this->_layoutMock + ); } public function testLoad() { $area = $this->getMock('Magento\Core\Model\App\Area', array(), array(), '', false); $this->_layoutMock->expects($this->once())->method('getArea')->will($this->returnValue('area')); - $this->_appMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area)); - $area->expects( - $this->at(0) - )->method( - 'load' - )->with( - \Magento\Core\Model\App\Area::PART_DESIGN - )->will( - $this->returnValue($area) - ); - $area->expects( - $this->at(1) - )->method( - 'load' - )->with( - \Magento\Core\Model\App\Area::PART_TRANSLATE - )->will( - $this->returnValue($area) - ); + $this->_areaListMock->expects($this->once())->method('getArea')->with('area')->will($this->returnValue($area)); + $area->expects($this->at(0))->method('load') + ->with(\Magento\Core\Model\App\Area::PART_DESIGN)->will($this->returnValue($area)); + $area->expects($this->at(1))->method('load') + ->with(\Magento\Core\Model\App\Area::PART_TRANSLATE)->will($this->returnValue($area)); $this->_model->load($this->_requestMock); } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php index fd74a015bd226a8e9eeb720034c35eb5e66a4036..d23c519243cf471ba7aa5f01e603a3fc7d32fac1 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/File/Storage/Directory/DatabaseTest.php @@ -56,11 +56,6 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase */ protected $dateModelMock; - /** - * @var \Magento\Core\Model\App |\PHPUnit_Framework_MockObject_MockObject - */ - protected $applicationMock; - /** * @var \Magento\Core\Model\File\Storage\Directory\Database |\PHPUnit_Framework_MockObject_MockObject */ @@ -106,7 +101,6 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase false ); $this->dateModelMock = $this->getMock('Magento\Stdlib\DateTime\DateTime', array(), array(), '', false); - $this->applicationMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); $this->directoryMock = $this->getMock( 'Magento\Core\Model\File\Storage\Directory\Database', array('setPath', 'setName', '__wakeup', 'save', 'getParentId'), @@ -139,24 +133,10 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->directoryMock) ); - $this->applicationMock->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue($this->configMock) - ); - - $this->configMock->expects( - $this->any() - )->method( - 'getValue' - )->with( - \Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, - 'default' - )->will( - $this->returnValue($this->customConnectionName) - ); + $this->configMock->expects($this->any()) + ->method('getValue') + ->with(\Magento\Core\Model\File\Storage::XML_PATH_STORAGE_MEDIA_DATABASE, 'default') + ->will($this->returnValue($this->customConnectionName)); $this->contextMock->expects($this->once())->method('getLogger')->will($this->returnValue($this->loggerMock)); @@ -165,7 +145,7 @@ class DatabaseTest extends \PHPUnit_Framework_TestCase $this->registryMock, $this->helperStorageDatabase, $this->dateModelMock, - $this->applicationMock, + $this->configMock, $this->directoryFactoryMock, $this->resourceDirectoryDatabaseMock, null, diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php index ddedfe212520e29120a007af6309f6cd25cc1b80..ea1ba62a6d85a77e4793e459f703d9cf7b8033a9 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/LayoutTest.php @@ -61,7 +61,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateBlockException() { diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php index a76d2e04506a020462e94c8f680fbc3fca02eb20..0c84a2e127432a804d064e7b6f923adea6ca7bc8 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Db/AbstractTest.php @@ -26,14 +26,14 @@ */ /** - * Test class for \Magento\Core\Model\Resource\Db\AbstractDb. + * Test class for \Magento\Model\Resource\Db\AbstractDb. */ namespace Magento\Core\Model\Resource\Db; class AbstractTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|PHPUnit_Framework_MockObject_MockObject */ protected $_model; @@ -46,7 +46,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase { $this->_resource = $this->getMock('Magento\App\Resource', array('getConnection'), array(), '', false, false); $this->_model = $this->getMock( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array('_construct', '_getWriteAdapter'), array($this->_resource) ); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php index 80a2ff151f4d3ef5ccab59bbb2f6fd2f1b2a7b89..5e5eec5b7784a25aa02cd989545ca9a11b7660c0 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Resource/Layout/AbstractTestCase.php @@ -81,7 +81,7 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase $connection->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0)); $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, @@ -98,7 +98,7 @@ abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase /** * @abstract * @param \Zend_Db_Select $select - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ abstract protected function _getCollection(\Zend_Db_Select $select); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php index b98146d1c2828971f535331fe9211d7f309cde4a..933a3db8504b9f2afcc54af3036dc81ec18f8140 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/StoreManagerTest.php @@ -212,7 +212,7 @@ class StoreManagerTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetSafeStoreWithExceptionAndWithoutCurrentStore() { diff --git a/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php index e542caa70292935ffd988f22838ce865f9270bcd..822a49b39d020625613a7306d4aa2c990ade4436 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/App/Cron/Plugin/ApplicationInitializerTest.php @@ -33,7 +33,7 @@ class ApplicationInitializerTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $applicationMock; + protected $appStateMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -47,15 +47,18 @@ class ApplicationInitializerTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->applicationMock = $this->getMock('Magento\AppInterface'); + $this->appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); $this->sidResolverMock = $this->getMock('\Magento\Session\SidResolverInterface', array(), array(), '', false); $this->subjectMock = $this->getMock('Magento\App\Cron', array(), array(), '', false); - $this->model = new ApplicationInitializer($this->applicationMock, $this->sidResolverMock); + $this->model = new ApplicationInitializer( + $this->appStateMock, + $this->sidResolverMock + ); } public function testBeforeExecutePerformsRequiredChecks() { - $this->applicationMock->expects($this->once())->method('requireInstalledInstance'); + $this->appStateMock->expects($this->once())->method('isInstalled')->will($this->returnValue(true)); $this->sidResolverMock->expects($this->once())->method('setUseSessionInUrl')->with(false); $this->model->beforeLaunch($this->subjectMock); } diff --git a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php index 46b8eba3ea63328b455ba228fa0844afb93f9421..5c1d55219cdfbb4a572cd6a6d7b2ab219ee347fa 100644 --- a/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Cron/Model/ObserverTest.php @@ -42,9 +42,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject + * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_app; + protected $_cache; /** * @var \Magento\Cron\Model\Config|\PHPUnit_Framework_MockObject_MockObject @@ -87,7 +87,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_objectManager = $this->getMockBuilder( 'Magento\App\ObjectManager' )->disableOriginalConstructor()->getMock(); - $this->_app = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_cache = $this->getMock('Magento\App\CacheInterface'); $this->_config = $this->getMockBuilder('Magento\Cron\Model\Config')->disableOriginalConstructor()->getMock(); $this->_coreStoreConfig = $this->getMockBuilder( 'Magento\Core\Model\Store\Config' @@ -116,7 +116,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_observer = new \Magento\Cron\Model\Observer( $this->_objectManager, $this->_scheduleFactory, - $this->_app, + $this->_cache, $this->_config, $this->_coreStoreConfig, $this->_request, @@ -130,8 +130,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoPendingJobs() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue(array())); @@ -148,8 +152,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchNoJobConfig() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $this->_config->expects( $this->once() @@ -179,8 +187,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase public function testDispatchCanNotLock() { $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -216,8 +228,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $exceptionMessage = 'Too late for the schedule'; $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(0)); $schedule = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -290,7 +306,9 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); $this->_coreStoreConfig->expects( $this->any() @@ -345,14 +363,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue(strtotime('+1 day')) - ); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -433,14 +449,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); $lastRun = time() + 10000000; - $this->_app->expects($this->any())->method('loadCache')->will($this->returnValue($lastRun)); - $this->_coreStoreConfig->expects( - $this->any() - )->method( - 'getConfig' - )->will( - $this->returnValue(strtotime('+1 day')) - ); + $this->_cache->expects($this->any()) + ->method('load') + ->will($this->returnValue($lastRun)); + $this->_coreStoreConfig->expects($this->any()) + ->method('getConfig') + ->will($this->returnValue(strtotime('+1 day'))); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -478,24 +492,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->returnValue(array('test_group' => array())) ); - $this->_app->expects( - $this->at(0) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) - )->will( - $this->returnValue(time() - 10000000) - ); - $this->_app->expects( - $this->at(2) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) - )->will( - $this->returnValue(time() + 10000000) - ); + $this->_cache->expects($this->at(0)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) + ->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(2)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) + ->will($this->returnValue(time() + 10000000)); $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); @@ -510,7 +514,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_collection->addItem(new \Magento\Object()); $this->_collection->addItem($schedule); - $this->_app->expects($this->any())->method('saveCache'); + $this->_cache->expects($this->any())->method('save'); $scheduleMock = $this->getMockBuilder('Magento\Cron\Model\Schedule')->disableOriginalConstructor()->getMock(); $scheduleMock->expects($this->any())->method('getCollection')->will($this->returnValue($this->_collection)); @@ -540,24 +544,14 @@ class ObserverTest extends \PHPUnit_Framework_TestCase ); $this->_config->expects($this->at(1))->method('getJobs')->will($this->returnValue($jobs)); - $this->_app->expects( - $this->at(0) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT) - )->will( - $this->returnValue(time() - 10000000) - ); - $this->_app->expects( - $this->at(2) - )->method( - 'loadCache' - )->with( - $this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT) - )->will( - $this->returnValue(time() + 10000000) - ); + $this->_cache->expects($this->at(0)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_SCHEDULE_GENERATE_AT)) + ->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(2)) + ->method('load') + ->with($this->equalTo(\Magento\Cron\Model\Observer::CACHE_KEY_LAST_HISTORY_CLEANUP_AT)) + ->will($this->returnValue(time() + 10000000)); $this->_coreStoreConfig->expects($this->at(0))->method('getConfig')->will($this->returnValue(0)); @@ -575,7 +569,7 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_collection->addItem(new \Magento\Object()); $this->_collection->addItem($schedule); - $this->_app->expects($this->any())->method('saveCache'); + $this->_cache->expects($this->any())->method('save'); $scheduleMock = $this->getMockBuilder( 'Magento\Cron\Model\Schedule' @@ -611,8 +605,12 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $this->_config->expects($this->once())->method('getJobs')->will($this->returnValue($jobConfig)); - $this->_app->expects($this->at(0))->method('loadCache')->will($this->returnValue(time() + 10000000)); - $this->_app->expects($this->at(1))->method('loadCache')->will($this->returnValue(time() - 10000000)); + $this->_cache->expects($this->at(0)) + ->method('load') + ->will($this->returnValue(time() + 10000000)); + $this->_cache->expects($this->at(1)) + ->method('load') + ->will($this->returnValue(time() - 10000000)); $this->_coreStoreConfig->expects($this->any())->method('getConfig')->will($this->returnValue(0)); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php index 459018658c0bf328f8f7cff2ff1b8967993b1f52..baecc1ffaa1c58eaa13e181d9b0096f22b3183f8 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php @@ -285,7 +285,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ); // Setup a core exception to return - $exception = new \Magento\Core\Exception(); + $exception = new \Magento\Model\Exception(); $error = new \Magento\Message\Error('Something Bad happened'); $exception->addMessage($error); @@ -322,7 +322,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase ); // Setup a core exception to return - $exception = new \Magento\Core\Exception($warningText); + $exception = new \Magento\Model\Exception($warningText); $error = new \Magento\Message\Warning('Something Not So Bad happened'); $exception->addMessage($error); diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php index fc1f50bfa7e448edc81e8d3fb4e4947413896a36..704ee5a9d56d5f02bc008fff51424fb14ff89583 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Layout/DepersonalizePluginTest.php @@ -35,7 +35,7 @@ namespace Magento\Customer\Model\Layout; class DepersonalizePluginTest extends \PHPUnit_Framework_TestCase { /** - * @var DepersonalizePlugin + * @var \Magento\Customer\Model\Layout\DepersonalizePlugin */ protected $plugin; diff --git a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php index 58c7cb5a37474e3374a07a64c9e2ce2b2d7c15d6..cf8ec428ec2ae8c8112fb8f8a009d06631063da6 100644 --- a/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Model/Metadata/Form/AbstractDataTest.php @@ -86,7 +86,7 @@ class AbstractDataTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Attribute object is undefined */ public function testGetAttributeException() diff --git a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php index 20c0dfd851ecc08a66b94ec688bf3944bd04f59b..60b5c365d7c848274d2aa5afe02680c2286f3a29 100755 --- a/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Customer/Service/V1/CustomerAccountServiceTest.php @@ -118,6 +118,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase */ private $_urlMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Logger + */ + private $_loggerMock; + /** * @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Customer\Helper\Data */ @@ -254,7 +259,13 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->returnValue($this->_customerHelperMock) ); - $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface')->disableOriginalConstructor()->getMock(); + $this->_urlMock = $this->getMockBuilder('\Magento\UrlInterface') + ->disableOriginalConstructor() + ->getMock(); + + $this->_loggerMock = $this->getMockBuilder('\Magento\Logger') + ->disableOriginalConstructor() + ->getMock(); } public function testActivateAccount() @@ -453,7 +464,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase )->method( 'authenticate' )->will( - $this->throwException(new \Magento\Core\Exception('exception message')) + $this->throwException(new \Magento\Model\Exception('exception message')) ); $this->_customerFactoryMock->expects( @@ -689,7 +700,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid transactional email code: 0 */ public function testSendPasswordResetLinkSendException() @@ -716,7 +727,7 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase )->method( 'sendPasswordResetConfirmationEmail' )->will( - $this->throwException(new \Magento\Core\Exception(__('Invalid transactional email code: %1', 0))) + $this->throwException(new \Magento\Model\Exception(__('Invalid transactional email code: %1', 0))) ); $customerService = $this->_createService(); @@ -728,6 +739,36 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase ); } + public function testSendPasswordResetLinkSendMailException() + { + $email = 'foo@example.com'; + $this->_mockReturnValue( + $this->_customerModelMock, + array( + 'getId' => self::ID, + 'setWebsiteId' => $this->_customerModelMock, + 'loadByEmail' => $this->_customerModelMock, + ) + ); + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendPasswordResetConfirmationEmail') + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $customerService = $this->_createService(); + + $customerService->initiatePasswordReset($email, self::WEBSITE_ID, CustomerAccountServiceInterface::EMAIL_RESET); + } + public function testResetPassword() { $resetToken = 'lsdj579slkj5987slkj595lkj'; @@ -1041,6 +1082,40 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $customerService->resendConfirmation('email@test.com', 2); } + public function testResendConfirmationWithMailException() + { + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + $this->_customerModelMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(55)); + $this->_customerModelMock->expects($this->once()) + ->method('setWebsiteId') + ->will($this->returnSelf()); + $this->_customerModelMock->expects($this->any()) + ->method('isConfirmationRequired') + ->will($this->returnValue(true)); + $this->_customerModelMock->expects($this->any()) + ->method('getConfirmation') + ->will($this->returnValue('123abc')); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendNewAccountEmail') + ->withAnyParameters() + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $customerService = $this->_createService(); + $customerService->resendConfirmation('email', 1); + // If we call sendNewAccountEmail and no exception is returned, the test succeeds + } + /** * @dataProvider testGetConfirmationStatusDataProvider * @param string $expected The expected confirmation status. @@ -1753,6 +1828,76 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->assertFalse($service->isEmailAvailable('email', 1)); } + public function testCreateAccountMailException() + { + $this->_customerFactoryMock->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_customerModelMock)); + + // This is to get the customer model through validation + $this->_customerModelMock->expects($this->any()) + ->method('getFirstname') + ->will($this->returnValue('John')); + + $this->_customerModelMock->expects($this->any()) + ->method('getLastname') + ->will($this->returnValue('Doe')); + + $this->_customerModelMock->expects($this->any()) + ->method('getEmail') + ->will($this->returnValue('somebody@example.com')); + + // This is to get the customer model through Converter::getCustomerModel + $this->_customerModelMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + + $this->_customerModelMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(true)); + + $exception = new \Magento\Mail\Exception(__('The mail server is down')); + + $this->_customerModelMock->expects($this->once()) + ->method('sendNewAccountEmail') + ->will($this->throwException($exception)); + + $this->_loggerMock->expects($this->once()) + ->method('logException') + ->with($exception); + + $this->_customerModelMock->expects($this->once()) + ->method('getAttributes') + ->will($this->returnValue([])); + + $mockCustomer = $this->getMockBuilder('Magento\Customer\Service\V1\Data\Customer') + ->disableOriginalConstructor() + ->getMock(); + + $mockCustomer->expects($this->any()) + ->method('getStoreId') + ->will($this->returnValue(true)); + + $mockCustomer->expects($this->once()) + ->method('__toArray') + ->will($this->returnValue(['attributeSetId' => true])); + + /** + * @var \Magento\Customer\Service\V1\Data\CustomerDetails | \PHPUnit_Framework_MockObject_MockObject + */ + $mockCustomerDetail = $this->getMockBuilder('Magento\Customer\Service\V1\Data\CustomerDetails') + ->disableOriginalConstructor() + ->getMock(); + + $mockCustomerDetail->expects($this->once()) + ->method('getCustomer') + ->will($this->returnValue($mockCustomer)); + + $service = $this->_createService(); + $service->createAccount($mockCustomerDetail, 'abc123'); + // If we get no mail exception, the test in considered a success + } + private function _setupStoreMock() { $this->_storeManagerMock = $this->getMockBuilder( @@ -1802,8 +1947,11 @@ class CustomerAccountServiceTest extends \PHPUnit_Framework_TestCase $this->_customerAddressServiceMock, $this->_customerMetadataService, $this->_urlMock, + $this->_loggerMock, $this->_objectManagerMock ); return $customerService; } + + } diff --git a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php index 5ae0934eedff5b1c8cfba4de552aca0bfefafce5..3fab3af76414917b3febf2f42438f2973b8f50e0 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Collection/DbTest.php @@ -31,23 +31,46 @@ class DbTest extends \PHPUnit_Framework_TestCase /** * @var \Magento\Data\Collection\Db */ - protected $_collection; + protected $collection; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategyInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; protected function setUp() { - $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $this->_collection = new \Magento\Data\Collection\Db($entityFactory, $logger, $fetchStrategy); + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->collection = new \Magento\Data\Collection\Db( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock + ); } protected function tearDown() { - unset($this->_collection); + unset($this->collection); } /** - * @return \PHPUnit_Framework_MockObject_MockObject|Zend_Db_Adapter_Abstract + * @return \PHPUnit_Framework_MockObject_MockObject|\Zend_Db_Adapter_Abstract */ public function testSetAddOrder() { @@ -60,18 +83,18 @@ class DbTest extends \PHPUnit_Framework_TestCase true, array('fetchAll') ); - $this->_collection->setConnection($adapter); + $this->collection->setConnection($adapter); - $select = $this->_collection->getSelect(); + $select = $this->collection->getSelect(); $this->assertEmpty($select->getPart(\Zend_Db_Select::ORDER)); /* Direct access to select object is available and many places are using it for sort order declaration */ $select->order('select_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->setOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->addOrder('other_field', \Magento\Data\Collection::SORT_ORDER_DESC); + $this->collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->setOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->addOrder('other_field', \Magento\Data\Collection::SORT_ORDER_DESC); - $this->_collection->load(); + $this->collection->load(); $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); $this->assertEquals(array('select_field', 'ASC'), array_shift($selectOrders)); $this->assertEquals('some_field ASC', (string)array_shift($selectOrders)); @@ -87,12 +110,12 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testUnshiftOrder($adapter) { - $this->_collection->setConnection($adapter); - $this->_collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->unshiftOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->setConnection($adapter); + $this->collection->addOrder('some_field', \Magento\Data\Collection::SORT_ORDER_ASC); + $this->collection->unshiftOrder('other_field', \Magento\Data\Collection::SORT_ORDER_ASC); - $this->_collection->load(); - $selectOrders = $this->_collection->getSelect()->getPart(\Zend_Db_Select::ORDER); + $this->collection->load(); + $selectOrders = $this->collection->getSelect()->getPart(\Zend_Db_Select::ORDER); $this->assertEquals('other_field ASC', (string)array_shift($selectOrders)); $this->assertEquals('some_field ASC', (string)array_shift($selectOrders)); $this->assertEmpty(array_shift($selectOrders)); @@ -114,10 +137,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('is_imported = 1') ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('is_imported', array('eq' => '1')); + $this->collection->addFieldToFilter('is_imported', array('eq' => '1')); $this->assertEquals('SELECT `test`.* FROM `test` WHERE (is_imported = 1)', $select->assemble()); } @@ -148,10 +171,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue("name like 'M%'") ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from("test"); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from("test"); - $this->_collection->addFieldToFilter( + $this->collection->addFieldToFilter( array('weight', 'name'), array(array('in' => array(1, 3)), array('like' => 'M%')) ); @@ -172,7 +195,7 @@ class DbTest extends \PHPUnit_Framework_TestCase $this->returnValue('is_imported = 1') ); - $this->_collection->addFieldToFilter('is_imported', array('eq' => '1')); + $this->collection->addFieldToFilter('is_imported', array('eq' => '1')); $this->assertEquals( "SELECT `test`.* FROM `test` WHERE ((weight in (1, 3)) OR (name like 'M%')) AND (is_imported = 1)", $select->assemble() @@ -202,10 +225,10 @@ class DbTest extends \PHPUnit_Framework_TestCase $this->returnValue('email LIKE \'%value?%\'') ); $adapter->expects($this->once())->method('select')->will($this->returnValue(new \Magento\DB\Select($adapter))); - $this->_collection->setConnection($adapter); + $this->collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('email', array('like' => 'value?')); + $select = $this->collection->getSelect()->from('test'); + $this->collection->addFieldToFilter('email', array('like' => 'value?')); $this->assertEquals("SELECT `test`.* FROM `test` WHERE (email LIKE '%value?%')", $select->assemble()); } @@ -240,10 +263,10 @@ class DbTest extends \PHPUnit_Framework_TestCase )->will( $this->returnValue('`email` = "foo@example.com"') ); - $this->_collection->setConnection($adapter); - $select = $this->_collection->getSelect()->from('test'); + $this->collection->setConnection($adapter); + $select = $this->collection->getSelect()->from('test'); - $this->_collection->addFieldToFilter('email', array('eq' => 'foo@example.com')); + $this->collection->addFieldToFilter('email', array('eq' => 'foo@example.com')); $this->assertEquals('SELECT `test`.* FROM `test` WHERE (`email` = "foo@example.com")', $select->assemble()); } @@ -256,15 +279,15 @@ class DbTest extends \PHPUnit_Framework_TestCase public function testClone() { $adapter = $this->getMockForAbstractClass('Zend_Db_Adapter_Abstract', array(), '', false); - $this->_collection->setConnection($adapter); - $this->assertInstanceOf('Zend_Db_Select', $this->_collection->getSelect()); + $this->collection->setConnection($adapter); + $this->assertInstanceOf('Zend_Db_Select', $this->collection->getSelect()); - $clonedCollection = clone $this->_collection; + $clonedCollection = clone $this->collection; $this->assertInstanceOf('Zend_Db_Select', $clonedCollection->getSelect()); $this->assertNotSame( $clonedCollection->getSelect(), - $this->_collection->getSelect(), + $this->collection->getSelect(), 'Collection was cloned but $this->_select in both initial and cloned collections reference the same object' ); } @@ -280,8 +303,8 @@ class DbTest extends \PHPUnit_Framework_TestCase public function testPrintLogQueryPrinting($printQuery, $printFlag, $query, $expected) { $this->expectOutputString($expected); - $this->_collection->setFlag('print_query', $printFlag); - $this->_collection->printLogQuery($printQuery, false, $query); + $this->collection->setFlag('print_query', $printFlag); + $this->collection->printLogQuery($printQuery, false, $query); } public function printLogQueryPrintingDataProvider() @@ -302,21 +325,238 @@ class DbTest extends \PHPUnit_Framework_TestCase */ public function testPrintLogQueryLogging($logQuery, $logFlag, $expectedCalls) { - $fetchStrategy = $this->getMock('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - $collection = $this->getMock( - 'Magento\Data\Collection\Db', - array('_logQuery'), - array($entityFactory, $logger, $fetchStrategy) - ); - $collection->setFlag('log_query', $logFlag); - $collection->expects($this->exactly($expectedCalls))->method('_logQuery'); - $collection->printLogQuery(false, $logQuery, 'some_query'); + $this->collection->setFlag('log_query', $logFlag); + $this->loggerMock->expects($this->exactly($expectedCalls))->method('log'); + $this->collection->printLogQuery(false, $logQuery, 'some_query'); } public function printLogQueryLoggingDataProvider() { - return array(array(true, false, 1), array(false, true, 1), array(false, false, 0)); + return array( + array(true, false, 1), + array(false, true, 1), + array(false, false, 0), + ); + } + + /** + * @expectedException \Zend_Exception + * @expectedExceptionMessage dbModel read resource does not implement \Zend_Db_Adapter_Abstract + */ + public function testSetConnectionException() + { + $adapter = new \stdClass(); + $this->collection->setConnection($adapter); + } + + public function testFetchItem() + { + $data = array(1 => 'test'); + $counter = 0; + $statementMock = $this->getMock('Zend_Db_Statement_Pdo', array('fetch'), array(), '', false); + $statementMock->expects($this->exactly(2)) + ->method('fetch') + ->will($this->returnCallback(function () use (&$counter, $data) { + return ++$counter % 2 ? array() : $data; + })); + + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', + array('select', 'query'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array(), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('query') + ->with($selectMock, $this->anything()) + ->will($this->returnValue($statementMock)); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $this->collection->setConnection($adapterMock); + $this->assertFalse($this->collection->fetchItem()); + + $objectMock = $this->getMock('Magento\Object', array('setData'), array()); + $objectMock->expects($this->once()) + ->method('setData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Object') + ->will($this->returnValue($objectMock)); + + $this->assertEquals($objectMock, $this->collection->fetchItem()); + } + + public function testGetSize() + { + $countSql = 500; + $adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', + array('select', 'quoteInto', 'prepareSqlCondition', 'fetchOne'), + array(), + '', + false + ); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('orWhere', 'where', 'reset', 'columns'), array('adapter' => $adapterMock) + ); + $selectMock->expects($this->exactly(4)) + ->method('reset'); + $selectMock->expects($this->once()) + ->method('columns') + ->with('COUNT(*)'); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $adapterMock->expects($this->exactly(2)) + ->method('quoteInto') + ->will($this->returnValueMap(array( + array('testField1=?', 'testValue1', null, null, 'testField1=testValue1'), + array('testField4=?', 'testValue4', null, null, 'testField4=testValue4'), + ))); + $selectMock->expects($this->once()) + ->method('orWhere') + ->with('testField1=testValue1'); + $selectMock->expects($this->exactly(3)) + ->method('where') + ->will($this->returnValueMap(array( + array('testValue2', $this->returnSelf()), + array('testField3 = testValue3', null, \Magento\DB\Select::TYPE_CONDITION, $this->returnSelf()), + array('testField4=testValue4', $this->returnSelf()), + ))); + $adapterMock->expects($this->once()) + ->method('prepareSqlCondition') + ->with('testField3', 'testValue3') + ->will($this->returnValue('testField3 = testValue3')); + $adapterMock->expects($this->once()) + ->method('fetchOne') + ->with($selectMock, array()) + ->will($this->returnValue($countSql)); + + $this->collection->addFilter('testField1', 'testValue1', 'or'); + $this->collection->addFilter('testField2', 'testValue2', 'string'); + $this->collection->addFilter('testField3', 'testValue3', 'public'); + $this->collection->addFilter('testField4', 'testValue4'); + $this->collection->setConnection($adapterMock); + $this->assertEquals($countSql, $this->collection->getSize()); + $this->assertEquals($countSql, $this->collection->getSize()); + } + + public function testGetSelectSql() + { + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', array('select'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('__toString'), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $sql = 'query'; + $selectMock->expects($this->once()) + ->method('__toString') + ->will($this->returnValue($sql)); + + $this->collection->setConnection($adapterMock); + $this->assertEquals($sql, $this->collection->getSelectSql(true)); + $this->assertEquals($selectMock, $this->collection->getSelectSql()); + } + + public function testGetData() + { + $adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', + array('select', 'quoteInto', 'prepareSqlCondition', 'fetchOne'), + array(), + '', + false + ); + $selectMock = $this->getMock( + 'Magento\DB\Select', array('orWhere', 'where', 'reset', 'columns'), array('adapter' => $adapterMock) + ); + $selectMock->expects($this->once()) + ->method('where') + ->with('aliasField3 = testValue3', null, \Magento\DB\Select::TYPE_CONDITION) + ->will($this->returnSelf()); + + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $adapterMock->expects($this->once()) + ->method('prepareSqlCondition') + ->with('aliasField3', 'testValue3') + ->will($this->returnValue('aliasField3 = testValue3')); + + $this->collection->addFilter('testField3', 'testValue3', 'public'); + $this->collection->addFilterToMap('testFilter', 'testAlias', 'testGroup'); + $this->collection->addFilterToMap('testField3', 'aliasField3'); + + $this->collection->setConnection($adapterMock); + $this->assertNull($this->collection->getData()); + } + + /** + * @dataProvider distinctDataProvider + */ + public function testDistinct($flag, $expectedFlag) + { + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', array('select'), array(), '', false); + $selectMock = $this->getMock('Magento\DB\Select', array('distinct'), array('adapter' => $adapterMock)); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $selectMock->expects($this->once()) + ->method('distinct') + ->with($expectedFlag); + + $this->collection->setConnection($adapterMock); + $this->collection->distinct($flag); + } + + public function distinctDataProvider() + { + return array( + array(true, true), + array(false, false), + ); + } + + public function testToOptionHash() + { + $data = array(10 => 'test'); + $adapterMock = $this->getMock('Zend_Db_Adapter_Pdo_Mysql', + array('select', 'query'), array(), '', false); + $selectMock = $this->getMock( + 'Magento\DB\Select', array(), array('adapter' => $adapterMock) + ); + $adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + + $this->fetchStrategyMock->expects($this->once()) + ->method('fetchAll') + ->with($selectMock, array()) + ->will($this->returnValue(array($data))); + + $objectMock = $this->getMock('Magento\Object', array('addData', 'setIdFieldName', 'getData'), array()); + $objectMock->expects($this->once()) + ->method('addData') + ->with($data); + $objectMock->expects($this->any()) + ->method('getData') + ->will($this->returnValueMap(array( + array(null, null, 10), + array('name', null, 'test'), + ))); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Object') + ->will($this->returnValue($objectMock)); + + $this->collection->setConnection($adapterMock); + $this->collection->loadData(false, false); + $this->collection->loadData(false, false); + $this->assertEquals($data, $this->collection->toOptionHash()); } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php index eb7c49c8f195373a20d0eb3c15806a5bd00a25e6..8cb2d01af1ecd1969468f610864db7ba185408ce 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Helper/DataTest.php @@ -100,13 +100,4 @@ class DataTest extends \PHPUnit_Framework_TestCase ); $this->assertEquals($this->_disabledCacheTypes, $this->_model->getDisabledCacheTypes()); } - - public function testGetAvailableModes() - { - $this->_model = new \Magento\DesignEditor\Helper\Data($this->_context, self::TEST_FRONT_NAME); - $this->assertEquals( - array(\Magento\DesignEditor\Model\State::MODE_NAVIGATION), - $this->_model->getAvailableModes() - ); - } } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php index d21384fa4136bf3e9c2c7abf77a7625f5864ddcb..099fd826672891504bd3d50dce2d669bdb75f011 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php @@ -102,9 +102,9 @@ class StateTest extends \PHPUnit_Framework_TestCase protected $_objectManager; /** - * @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\App\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_application; + protected $_configMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -161,13 +161,8 @@ class StateTest extends \PHPUnit_Framework_TestCase ); $this->_objectManager = $this->getMock('Magento\ObjectManager'); - $this->_application = $this->getMock( - 'Magento\Core\Model\App', - array('getStore', 'getConfig'), - array(), - '', - false - ); + $this->_application = $this->getMock('Magento\Core\Model\App', array('getStore', 'getConfig'), + array(), '', false); $storeManager = $this->getMock('Magento\Core\Model\StoreManager', array('setConfig'), array(), '', false); $storeManager->expects( @@ -181,19 +176,14 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->returnSelf() ); - $configMock = $this->getMock('Magento\App\ConfigInterface', array(), array(), '', false); - $configMock->expects( - $this->any() - )->method( - 'setNode' - )->with( - $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), - $this->equalTo(self::THEME_ID) - )->will( - $this->returnSelf() - ); - - $this->_application->expects($this->any())->method('getConfig')->will($this->returnValue($configMock)); + $this->_configMock = $this->getMock('Magento\App\ConfigInterface'); + $this->_configMock->expects($this->any()) + ->method('setNode') + ->with( + $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), + $this->equalTo(self::THEME_ID) + ) + ->will($this->returnSelf()); $this->_theme = $this->getMock('Magento\Core\Model\Theme', array('getId', '__wakeup'), array(), '', false); $this->_theme->expects($this->any())->method('getId')->will($this->returnValue(self::THEME_ID)); @@ -220,7 +210,7 @@ class StateTest extends \PHPUnit_Framework_TestCase $this->_cacheStateMock, $this->_dataHelper, $this->_objectManager, - $this->_application, + $this->_configMock, $this->_themeContext, $storeManager ); diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php index 7ebe277f7b3e88efe654a5260f676c5db9d15d12..5bb4ace7095ed0b1a4cfd609e0a43e6a70147903 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php @@ -112,7 +112,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Wrong theme type set as editable */ public function testSetEditableThemeByIdWrongType() @@ -141,7 +141,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage We can't find theme "1". */ public function testSetEditableThemeByIdWrongThemeId() @@ -171,7 +171,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Theme has not been set */ public function testGetEditableThemeNotSet() @@ -214,7 +214,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Theme "" is not editable. */ public function testGetStagingThemeWrongType() diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php new file mode 100644 index 0000000000000000000000000000000000000000..99ba875304bb1993aba28f13ff02b016bf73276d --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Translate/Inline/ProviderTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\DesignEditor\Model\Translate\Inline; + +class ProviderTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\DesignEditor\Model\Translate\Inline + */ + protected $translateVde; + + /** + * @var \Magento\Translate\Inline + */ + protected $translateInline; + + /** + * @var \Magento\App\RequestInterface + */ + protected $request; + + protected function setUp() + { + $this->translateVde = $this->getMock('Magento\DesignEditor\Model\Translate\Inline', [], [], '', false); + $this->translateInline = $this->getMock('Magento\Translate\Inline', [], [], '', false); + $this->request = $this->getMock('Magento\App\RequestInterface', [], [], '', false); + } + + /** + * @param bool $isVde + * @param string $instanceName + * + * @dataProvider dataProviderGet + */ + public function testGet($isVde, $instanceName) + { + $helper = $this->getMock('Magento\DesignEditor\Helper\Data', [], [], '', false); + $helper->expects($this->once()) + ->method('isVdeRequest') + ->will($this->returnValue($isVde)); + + $provider = new \Magento\DesignEditor\Model\Translate\Inline\Provider( + $this->translateVde, + $this->translateInline, + $helper, + $this->request + ); + + $this->assertInstanceOf($instanceName, $provider->get()); + } + + /** + * @return array + */ + public function dataProviderGet() + { + return [ + [false, 'Magento\Translate\Inline'], + [true, 'Magento\DesignEditor\Model\Translate\Inline'], + ]; + } +} diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php index f3fd794bbcff6943c801a9db8284bb174ede04ca..2e0722895867391daa8ef9f0152a3a593db75852 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Url/NavigationModeTest.php @@ -150,7 +150,6 @@ class NavigationModeTest extends \PHPUnit_Framework_TestCase self::ROUTE_PATH; $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($sourceUrl)); - $this->assertEquals($this->_model, $this->_model->setType(null)); $this->assertEquals($expectedUrl, $this->_model->getRouteUrl($expectedUrl)); } } diff --git a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php index 3d1ce80c12203d09dfa1cd6c4264aec4f09faf09..4a833874ddf66fc4d73fc8db2ae6c311459e8028 100644 --- a/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php +++ b/dev/tests/unit/testsuite/Magento/Dhl/Model/CarrierTest.php @@ -209,7 +209,7 @@ class CarrierTest extends \PHPUnit_Framework_TestCase /** * @dataProvider prepareShippingLabelContentExceptionDataProvider - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Unable to retrieve shipping label */ public function testPrepareShippingLabelContentException(\SimpleXMLElement $xml) diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php index fb015b05dc24d675844fb519a67c0528cedd8900..85fec4ab4507118255a335a59de33449a0f71afe 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Currency/DefaultLocatorTest.php @@ -36,7 +36,7 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase /** * @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_configMock; /** * @var \PHPUnit_Framework_MockObject_MockObject @@ -51,32 +51,19 @@ class DefaultLocatorTest extends \PHPUnit_Framework_TestCase protected function setUp() { $backendData = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_requestMock = $this->getMockForAbstractClass( - 'Magento\App\RequestInterface', - array($backendData), - '', - false, - false, - true, - array('getParam') - ); - $this->_appMock = $this->getMock('Magento\Core\Model\App', array(), array(), '', false); + $this->_requestMock = $this->getMockForAbstractClass('Magento\App\RequestInterface', + array($backendData), '', false, false, true, array('getParam')); + $this->_configMock = $this->getMock('\Magento\App\ConfigInterface'); $this->_storeManagerMock = $this->getMock('Magento\Core\Model\StoreManager', array(), array(), '', false); $this->_model = new \Magento\Directory\Model\Currency\DefaultLocator( - $this->_appMock, - $this->_storeManagerMock + $this->_configMock, $this->_storeManagerMock ); } public function testGetDefaultCurrencyReturnDefaultStoreDefaultCurrencyIfNoStoreIsSpecified() { - $this->_appMock->expects( - $this->once() - )->method( - 'getBaseCurrencyCode' - )->will( - $this->returnValue('storeCurrency') - ); + $this->_configMock->expects($this->once())->method('getValue') + ->will($this->returnValue('storeCurrency')); $this->assertEquals('storeCurrency', $this->_model->getDefaultCurrency($this->_requestMock)); } diff --git a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php index 97fbae87205977d5e898fdffdc56d7057ae3e549..038e8abd6ef86c370ecac93eecf7f81acdcfac84 100644 --- a/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Directory/Model/Resource/Country/CollectionTest.php @@ -39,8 +39,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $select = $this->getMock('Zend_Db_Select', array(), array(), '', false); $connection->expects($this->once())->method('select')->will($this->returnValue($select)); - $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + $resource = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php index d946efdb96ad55eb8f60cf210978fd3ef30ff4b8..15d2e90b82c1721dc1224272c2f15db94343ddaa 100644 --- a/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php +++ b/dev/tests/unit/testsuite/Magento/Downloadable/Helper/DownloadTest.php @@ -100,7 +100,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @exectedExceptionMessage Please set resource file and link type. */ public function testGetFileSizeNoResource() @@ -109,7 +109,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid download link type. */ public function testGetFileSizeInvalidLinkType() @@ -131,7 +131,7 @@ class DownloadTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Invalid download link type. */ public function testGetFileSizeNoFile() diff --git a/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e0ea91910b9c3d77c7cb051f30a7372ead755dab --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Eav/Helper/DataTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Eav\Helper; + +class DataTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Eav\Helper\Data + */ + protected $_helper; + + /** + * @var \Magento\Eav\Model\Config + */ + protected $_eavConfig; + + /** + * Initialize helper + */ + protected function setUp() + { + $context = $this->getMock('\Magento\App\Helper\Context', [], [], '', false); + $attributeConfig = $this->getMock('\Magento\Eav\Model\Entity\Attribute\Config', [], [], '', false); + $coreStoreConfig = $this->getMock('\Magento\Core\Model\Store\Config', [], [], '', false); + $eavConfig = $this->getMock('\Magento\Eav\Model\Config', [], [], '', false); + $this->_helper = new Data($context, $attributeConfig, $coreStoreConfig, $eavConfig); + $this->_eavConfig = $eavConfig; + } + + public function testGetAttributeMetadata() + { + $attribute = new \Magento\Object([ + 'entity_type_id' => '1', + 'attribute_id' => '2', + 'backend' => new \Magento\Object(['table' => 'customer_entity_varchar']), + 'backend_type' => 'varchar' + ]); + $this->_eavConfig->expects($this->once()) + ->method('getAttribute') + ->will($this->returnValue($attribute)); + + $result = $this->_helper->getAttributeMetadata('customer', 'lastname'); + $expected = [ + 'entity_type_id' => '1', + 'attribute_id' => '2', + 'attribute_table' => 'customer_entity_varchar', + 'backend_type' => 'varchar' + ]; + + foreach ($result as $key => $value) { + $this->assertArrayHasKey($key, $expected, 'Attribute metadata with key "' . $key . '" not found.'); + $this->assertEquals($expected[$key], $value, + 'Attribute metadata with key "' . $key . '" has invalid value.' + ); + } + } +} diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php index 25778858bf148275d0a39a7045f700e8a8c8dfa9..24c4bf24d25ef782babf337125a523ec27a3a8e6 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Entity/TypeTest.php @@ -98,7 +98,7 @@ class TypeTest extends \PHPUnit_Framework_TestCase false ); $this->resourceMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php index ecbaf5c0d9243d35c9ede0efde45492fa381f4be..a7b7e1753aa5de2d8eddb5d4c4507bfdc1a21a23 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/Attribute/Option/CollectionTest.php @@ -66,7 +66,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase protected $connectionMock; /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject */ protected $resourceMock; @@ -103,12 +103,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase ); $this->connectionMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false); $this->resourceMock = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array(), - '', - false, - true, - true, + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, true, true, array('__wakeup', 'getReadConnection', 'getMainTable', 'getTable') ); $this->selectMock = $this->getMock('Zend_Db_Select', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php index f51a7f483674f1cb8a9610cb2623261d838fc906..a5410faa5f3d35e57267e1c396c90444586dda45 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Resource/Entity/AttributeTest.php @@ -53,10 +53,10 @@ class AttributeTest extends \PHPUnit_Framework_TestCase ); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $attributeData; - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setDefault(array('2')); $model->setOption(array('delete' => array(1 => '', 2 => ''))); @@ -122,10 +122,10 @@ class AttributeTest extends \PHPUnit_Framework_TestCase $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $attributeData; - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setOption(array('value' => array('option_1' => array('Backend Label', 'Frontend Label')))); $adapter->expects( @@ -202,9 +202,9 @@ class AttributeTest extends \PHPUnit_Framework_TestCase list($adapter, $resourceModel) = $this->_prepareResourceModel(); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - /** @var $model \Magento\Core\Model\AbstractModel */ - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); - $model = $this->getMock('Magento\Core\Model\AbstractModel', null, $arguments); + /** @var $model \Magento\Model\AbstractModel */ + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); + $model = $this->getMock('Magento\Model\AbstractModel', null, $arguments); $model->setOption('not-an-array'); $adapter->expects($this->once())->method('insert')->with('eav_attribute'); diff --git a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php index 25d298ffb37d990521e73743ccca4cdea6f1bda3..df07544e90f712facabe637a4d086eb154befd96 100644 --- a/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php +++ b/dev/tests/unit/testsuite/Magento/Eav/Model/Validator/Attribute/DataTest.php @@ -453,7 +453,7 @@ class DataTest extends \PHPUnit_Framework_TestCase protected function _getEntityMock() { $entity = $this->getMockBuilder( - 'Magento\Core\Model\AbstractModel' + 'Magento\Model\AbstractModel' )->setMethods( array('getAttribute', 'getResource', 'getEntityType', '__wakeup') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php b/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php index 5ebf59e6e33a11c3737dc26be607409dd9f2aa95..ee46156751cb4c7d2c7b6de40688af77d0d2980f 100644 --- a/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php +++ b/dev/tests/unit/testsuite/Magento/Event/ManagerStub.php @@ -27,14 +27,14 @@ */ namespace Magento\Event; -class ManagerStub extends \Magento\Event\ManagerInterface +class ManagerStub implements \Magento\Event\ManagerInterface { /** * Stub dispatch event * * @param string $eventName * @param array $params - * @return \Magento\Core\Model\App|null + * @return null */ public function dispatch($eventName, array $params = array()) { diff --git a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php index 5ddbc9c3edc2c70362c9baf118ec491409e97db9..510695442b7cb004c46c686b9846d8907849e7a3 100644 --- a/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php +++ b/dev/tests/unit/testsuite/Magento/GroupedProduct/Block/Adminhtml/Product/Composite/Fieldset/GroupedTest.php @@ -63,6 +63,23 @@ class GroupedTest extends \PHPUnit_Framework_TestCase false ); + $customerMock = $this->getMockBuilder('\Magento\Customer\Service\V1\Data\Customer') + ->disableOriginalConstructor() + ->getMock(); + $customerMock + ->expects($this->any()) + ->method('getId') + ->will($this->returnValue(1)); + + $priceHelperMock = $this->getMockBuilder('Magento\Catalog\Helper\Product\Price') + ->disableOriginalConstructor() + ->getMock(); + + $priceHelperMock + ->expects($this->any()) + ->method('getCustomer') + ->will($this->returnValue($customerMock)); + $objectHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->block = $objectHelper->getObject( 'Magento\GroupedProduct\Block\Adminhtml\Product\Composite\Fieldset\Grouped', @@ -70,6 +87,7 @@ class GroupedTest extends \PHPUnit_Framework_TestCase 'registry' => $this->registryMock, 'storeManager' => $this->storeManagerMock, 'coreHelper' => $this->coreHelperMock, + 'priceHelper' => $priceHelperMock, 'data' => array('product' => $this->productMock) ) ); diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php index 368abf34407e6293fcb7ecf4bcfac04bb936c70c..90ca94e4a1cace3065a948b5ad5abf0ad78c022b 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/AbstractEavTest.php @@ -127,9 +127,9 @@ class AbstractEavTest extends \PHPUnit_Framework_TestCase $this->returnValue($testAttributeOptions) ); - /** @var $item \Magento\Core\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ + /** @var $item \Magento\Model\AbstractModel|\PHPUnit_Framework_MockObject_MockObject */ $item = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php index 644dd5dc5051c8f054ab1308c8a7704b3b1d4be2..ea366593f755ca392e2734530c09702beea6eb6c 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/Customer/AddressTest.php @@ -292,9 +292,9 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->_model->setWriter($writer); $this->_model->setParameters(array()); - $arguments = $this->_objectManager->getConstructArguments('Magento\Core\Model\AbstractModel'); + $arguments = $this->_objectManager->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $this->_addressData; - $item = $this->getMockForAbstractClass('Magento\Core\Model\AbstractModel', $arguments); + $item = $this->getMockForAbstractClass('Magento\Model\AbstractModel', $arguments); $this->_model->exportItem($item); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php index d76fb1b559d8374c379b2fe792d4824ef4fec637..bf67facee9e6cbc296e49fb943c0da159d90979b 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Export/Entity/Eav/CustomerTest.php @@ -231,9 +231,9 @@ class CustomerTest extends \PHPUnit_Framework_TestCase $this->_model->setWriter($writer); $objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $arguments = $objectManagerHelper->getConstructArguments('Magento\Core\Model\AbstractModel'); + $arguments = $objectManagerHelper->getConstructArguments('Magento\Model\AbstractModel'); $arguments['data'] = $this->_customerData; - $item = $this->getMockForAbstractClass('Magento\Core\Model\AbstractModel', $arguments); + $item = $this->getMockForAbstractClass('Magento\Model\AbstractModel', $arguments); $this->_model->exportItem($item); } diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php index 35e4bd98895f2c986c788cecd5409fd801df433d..e3c867d54e8412d4556c07f85e709237028f5199 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/AbstractTest.php @@ -89,7 +89,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Columns number: "1" have empty headers */ public function testValidateDataEmptyColumnName() @@ -102,7 +102,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Columns number: "1" have empty headers */ public function testValidateDataColumnNameWithWhitespaces() @@ -115,7 +115,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\Entity\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Column names: "_test1" are invalid */ public function testValidateDataAttributeNames() diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php index 0f35918a39a6449e2e09a3fc44d4a647de23aaa8..764ba955bf46a9422a00549b335db8f8c860144e 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/CustomerCompositeTest.php @@ -111,12 +111,11 @@ class CustomerCompositeTest extends \PHPUnit_Framework_TestCase $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $translateInline = $this->getMock('\Magento\Translate\InlineInterface', array(), array(), '', false); $translateInline->expects($this->any())->method('isAllowed')->will($this->returnValue(false)); - $inlineFactory = $this->getMock('\Magento\Translate\InlineFactory', array(), array(), '', false); - $inlineFactory->expects($this->any())->method('get')->will($this->returnValue($translateInline)); - $context = $this->getMock('Magento\App\Helper\Context', array('getInlineFactory'), array(), '', false); - $context->expects($this->any())->method('getInlineFactory')->will($this->returnValue($inlineFactory)); + + $context = $this->getMock('Magento\App\Helper\Context', array('getTranslateInline'), array(), '', false); + $context->expects($this->any())->method('getTranslateInline')->will($this->returnValue($translateInline)); + $data = array( - 'inlineFactory' => $inlineFactory, 'context' => $context, 'locale' => $this->getMock('Magento\Locale', array(), array(), '', false), 'dateModel' => $this->getMock('Magento\Stdlib\DateTime\DateTime', array(), array(), '', false) diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php index 29500ee2d174f8682657097e550c0583158ce02c..ba159e44482e30e74644a9478db186e43776f0f0 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/Entity/EavAbstractTest.php @@ -70,7 +70,7 @@ class EavAbstractTest extends \PHPUnit_Framework_TestCase protected $_resourceHelper; /** - * @var \Magento\Core\Model\App + * @var \Magento\Core\Model\StoreManagerInterface */ protected $_storeManager; diff --git a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php index 263118634b93fa5c88b4cdd55a3f288e0b7e195a..5f60c0b1ad59b8cdb5e0ced6d8ac1c8ed6e6a6a3 100644 --- a/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/ImportExport/Model/Import/EntityAbstractTest.php @@ -550,7 +550,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataPermanentAttributes() { @@ -569,7 +569,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataEmptyColumnName() { @@ -581,7 +581,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataColumnNameWithWhitespaces() { @@ -593,7 +593,7 @@ class EntityAbstractTest extends \PHPUnit_Framework_TestCase * Test for method validateData() * * @covers \Magento\ImportExport\Model\Import\AbstractEntity::validateData - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testValidateDataAttributeNames() { diff --git a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php index 5b11219519e7858df33d672aaa3c57f206c2ab05..be7f77d8e6d68a95cf86d3f54cce66e87749e95e 100644 --- a/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php +++ b/dev/tests/unit/testsuite/Magento/Index/Model/ProcessTest.php @@ -119,7 +119,7 @@ class ProcessTest extends \PHPUnit_Framework_TestCase ); $resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array(), '', false, diff --git a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php index 8598069d3ded48808066d84d005626a375d152a0..e6332dab15fc585d73e21335665163661a3a2d7a 100644 --- a/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php +++ b/dev/tests/unit/testsuite/Magento/Install/Model/Installer/Db/Mysql4Test.php @@ -42,14 +42,14 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase $connectionMock->expects($this->once())->method('fetchPairs')->will($this->returnValue($supportedEngines)); $adapterFactory = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', + 'Magento\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', false ); $adapterMock = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\Mysql', + 'Magento\Model\Resource\Type\Db\Pdo\Mysql', array('getConnection'), array(), '', @@ -87,7 +87,7 @@ class Mysql4Test extends \PHPUnit_Framework_TestCase public function testGetRequiredExtensions($config, $dbExtensions, $expectedResult) { $adapterFactory = $this->getMock( - 'Magento\Core\Model\Resource\Type\Db\Pdo\MysqlFactory', + 'Magento\Model\Resource\Type\Db\Pdo\MysqlFactory', array('create'), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php index 27974606b70d097f09307f4ca9d34de2cdbd55de..54e7b92e0b896bd147972f0cdea0c30b8c7664c4 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -44,9 +44,6 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ protected $_objectManagerMock; - /** @var \Magento\Core\Model\App|\PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; - /** @var \Magento\Core\Model\Layout\Filter\Acl|\PHPUnit_Framework_MockObject_MockObject */ protected $_layoutFilterMock; @@ -117,15 +114,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase 'Magento\ObjectManager' )->disableOriginalConstructor()->getMock(); // Initialize mocks which are used in several test cases - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('getConfig') - )->disableOriginalConstructor()->getMock(); $this->_configMock = $this->getMockBuilder( 'Magento\App\ConfigInterface' )->disableOriginalConstructor()->getMock(); - $this->_appMock->expects($this->any())->method('getConfig')->will($this->returnValue($this->_configMock)); $this->_eventManagerMock = $this->getMockBuilder( 'Magento\Event\ManagerInterface' )->disableOriginalConstructor()->getMock(); @@ -336,7 +327,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase )->with( self::INTEGRATION_ID )->will( - $this->throwException(new \Magento\Core\Exception($exceptionMessage)) + $this->throwException(new \Magento\Model\Exception($exceptionMessage)) ); // Verify error $this->_messageManager->expects($this->once())->method('addError')->with($this->equalTo($exceptionMessage)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php b/dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php similarity index 75% rename from dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php rename to dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php index 4df9a387ac381e8e7d60de3cf5b1f8409a250f3a..509508ae03b862a5a58adcc460318df43e85a467 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/AbstractModelTest.php +++ b/dev/tests/unit/testsuite/Magento/Model/AbstractModelTest.php @@ -22,27 +22,27 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; class AbstractModelTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\AbstractModel + * @var \Magento\Model\AbstractModel */ protected $model; /** - * @var \Magento\Core\Model\Context|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Context|\PHPUnit_Framework_MockObject_MockObject */ protected $contextMock; /** - * @var \Magento\Core\Model\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Registry|\PHPUnit_Framework_MockObject_MockObject */ protected $registryMock; /** - * @var \Magento\Core\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject + * @var \Magento\Model\Resource\Db\AbstractDb|\PHPUnit_Framework_MockObject_MockObject */ protected $resourceMock; @@ -56,18 +56,26 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase */ protected $adapterMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $actionValidatorMock; + protected function setUp() { - + $this->actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false + ); $this->contextMock = new \Magento\Model\Context( $this->getMock('Magento\Logger', array(), array(), '', false), $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), - $this->getMock('Magento\App\State', array(), array(), '', false) + $this->getMock('Magento\App\State', array(), array(), '', false), + $this->actionValidatorMock ); $this->registryMock = $this->getMock('Magento\Registry', array(), array(), '', false); $this->resourceMock = $this->getMock( - 'Magento\Core\Model\Resource\Db\AbstractDb', + 'Magento\Model\Resource\Db\AbstractDb', array( '_construct', '_getReadAdapter', @@ -84,7 +92,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase ); $this->resourceCollectionMock = $this->getMock('Magento\Data\Collection\Db', array(), array(), '', false); $this->model = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', + 'Magento\Model\AbstractModel', array($this->contextMock, $this->registryMock, $this->resourceMock, $this->resourceCollectionMock) ); $this->adapterMock = $this->getMock('Magento\DB\Adapter\AdapterInterface', array(), array(), '', false); @@ -98,6 +106,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase public function testDelete() { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $this->adapterMock->expects($this->once()) ->method('beginTransaction'); $this->resourceMock->expects($this->once()) @@ -113,6 +122,7 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase */ public function testDeleteRaiseException() { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); $this->adapterMock->expects($this->once()) ->method('beginTransaction'); $this->resourceMock->expects($this->once()) @@ -124,5 +134,14 @@ class AbstractModelTest extends \PHPUnit_Framework_TestCase ->method('rollBack'); $this->model->delete(); } + + /** + * @expectedException \Magento\Model\Exception + * @expectedExceptionMessage Delete operation is forbidden for current area + */ + public function testDeleteOnModelThatCanNotBeRemoved() + { + $this->actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(false)); + $this->model->delete(); + } } - \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php b/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..31f42b0eb42f541a106cc10c0714ef73ccf74a2a --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Model/ActionValidator/RemoveActionTest.php @@ -0,0 +1,77 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Model\ActionValidator; + +class RemoveActionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @param \PHPUnit_Framework_MockObject_MockObject $modelToCheck + * @param string $protectedModel + * @param bool $secureArea + * @param bool $expectedResult + * + * @dataProvider isAllowedDataProvider + * @covers \Magento\Model\ActionValidator\RemoveAction::isAllowed + * @covers \Magento\Model\ActionValidator\RemoveAction::getBaseClassName + */ + public function testIsAllowed($modelToCheck, $protectedModel, $secureArea, $expectedResult) + { + $registryMock = $this->getMock('\Magento\Registry', array(), array(), '', false); + $registryMock->expects($this->once()) + ->method('registry')->with('isSecureArea')->will($this->returnValue($secureArea)); + + $model = new \Magento\Model\ActionValidator\RemoveAction($registryMock, array('class' => $protectedModel)); + $this->assertEquals($expectedResult, $model->isAllowed($modelToCheck)); + } + + /** + * return array + */ + public function isAllowedDataProvider() + { + $productMock = $this->getMock('\Magento\Catalog\Model\Product', array(), array(), '', false); + $bannerMock = $this->getMock('\Magento\Wishlist\Model\Wishlist', array(), array(), '', false); + + return array( + array( + 'modelToCheck' => $productMock, + 'protectedModel' => 'Model', + 'secureArea' => false, + 'expectedResult' => true + ), + array( + 'modelToCheck' => $bannerMock, + 'protectedModel' => get_class($bannerMock), + 'secureArea' => false, + 'expectedResult' => false + ), + array( + 'modelToCheck' => $bannerMock, + 'protectedModel' => get_class($bannerMock), + 'secureArea' => true, + 'expectedResult' => true + ), + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..f78c37a9cd0139eb576304319ca6b058e9a60fd9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/Config/Data/ProxyTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\Config\Data; + +class ProxyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\Config\Data\Proxy + */ + protected $model; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Mview\Config\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $dataMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock( + 'Magento\ObjectManager', array(), array(), '', false + ); + $this->dataMock = $this->getMock( + 'Magento\Mview\Config\Data', array(), array(), '', false + ); + } + + public function testMergeShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('get') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('merge') + ->with(['some_config']); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + true + ); + + $this->model->merge(['some_config']); + } + + public function testMergeNonShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('merge') + ->with(['some_config']); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + false + ); + + $this->model->merge(['some_config']); + } + + public function testGetShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('get') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_path', 'default') + ->will($this->returnValue('some_value')); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + true + ); + + $this->assertEquals('some_value', $this->model->get('some_path', 'default')); + } + + public function testGetNonShared() + { + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\Config\Data') + ->will($this->returnValue($this->dataMock)); + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_path', 'default') + ->will($this->returnValue('some_value')); + + $this->model = new Proxy( + $this->objectManagerMock, + 'Magento\Mview\Config\Data', + false + ); + + $this->assertEquals('some_value', $this->model->get('some_path', 'default')); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php similarity index 50% rename from dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php rename to dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php index 674afdf6cf894e986523d3208e87a19176fcc21c..c84d1aed64ab211c7774792d7d2641b5975d2f6f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Translate/Inline/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/ConfigTest.php @@ -17,37 +17,48 @@ * Do not edit or add to this file if you wish to upgrade Magento to newer * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests + * * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Translate\Inline; +namespace Magento\Mview; class ConfigTest extends \PHPUnit_Framework_TestCase { - public function testIsActive() + /** + * @var \Magento\Mview\Config + */ + protected $model; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\Config\Data + */ + protected $dataMock; + + protected function setUp() { - $store = 'some store'; - $result = 'result'; - $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $coreStoreConfig->expects( - $this->once() - )->method( - 'getConfigFlag' - )->with( - $this->equalTo('dev/translate_inline/active'), - $this->equalTo($store) - )->will( - $this->returnValue($result) + $this->dataMock = $this->getMock( + 'Magento\Mview\Config\Data', array(), array(), '', false ); - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $config = $objectManager->getObject( - '\Magento\Core\Model\Translate\Inline\Config', - array('coreStoreConfig' => $coreStoreConfig) + $this->model = new Config( + $this->dataMock ); - $this->assertEquals($result, $config->isActive($store)); + } + + public function testGetViews() + { + $this->dataMock->expects($this->once()) + ->method('get') + ->will($this->returnValue(['some_data'])); + $this->assertEquals(['some_data'], $this->model->getViews()); + } + + public function testGetView() + { + $this->dataMock->expects($this->once()) + ->method('get') + ->with('some_view') + ->will($this->returnValue(['some_data'])); + $this->assertEquals(['some_data'], $this->model->getView('some_view')); } } diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php index d24dec77bc7febf5e3b285e09fcd62258a4651ba..15142e5ffb80f8444b211e4ccc514b2a92faf7c8 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/View/ChangelogTest.php @@ -86,12 +86,59 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->assertEquals('ViewIdTest' . '_' . \Magento\Mview\View\Changelog::NAME_SUFFIX, $this->model->getName()); } + public function testGetViewId() + { + $this->model->setViewId('ViewIdTest'); + $this->assertEquals('ViewIdTest', $this->model->getViewId()); + } + + /** + * @expectedException \Exception + * @expectedExceptionMessage View's identifier is not set + */ + public function testGetNameWithException() + { + $this->model->getName(); + } + public function testGetColumnName() { $this->assertEquals(\Magento\Mview\View\Changelog::COLUMN_NAME, $this->model->getColumnName()); } - public function testGetVersionWithException() + public function testGetVersion() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('fetchRow') + ->will($this->returnValue(['Auto_increment' => 11])); + + $this->model->setViewId('viewIdtest'); + $this->assertEquals(10, $this->model->getVersion()); + } + + public function testGetVersionWithExceptionNoAutoincrement() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('fetchRow') + ->will($this->returnValue([])); + + $this->setExpectedException( + 'Exception', + "Table status for `{$changelogTableName}` is incorrect. Can`t fetch version id." + ); + $this->model->setViewId('viewIdtest'); + $this->model->getVersion(); + } + + public function testGetVersionWithExceptionNoTable() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, false); @@ -102,7 +149,7 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->getVersion(); } - public function testDropWithException() + public function testDrop() { $changelogTableName = 'viewIdtest_cl'; $this->mockIsTableExists($changelogTableName, false); @@ -113,6 +160,44 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->drop(); } + public function testDropWithException() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $this->connectionMock->expects($this->once()) + ->method('dropTable') + ->with($changelogTableName) + ->will($this->returnValue(true)); + + $this->model->setViewId('viewIdtest'); + $this->model->drop(); + } + + public function testCreate() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, false); + $this->mockGetTableName(); + + $tableMock = $this->getMock('Magento\DB\Ddl\Table', array(), array(), '', false, false); + $tableMock->expects($this->exactly(2)) + ->method('addColumn') + ->will($this->returnSelf()); + + $this->connectionMock->expects($this->once()) + ->method('newTable') + ->with($changelogTableName) + ->will($this->returnValue($tableMock)); + $this->connectionMock->expects($this->once()) + ->method('createTable') + ->with($tableMock); + + $this->model->setViewId('viewIdtest'); + $this->model->create(); + } + public function testCreateWithException() { $changelogTableName = 'viewIdtest_cl'; @@ -124,6 +209,37 @@ class ChangelogTest extends \PHPUnit_Framework_TestCase $this->model->create(); } + public function testGetList() + { + $changelogTableName = 'viewIdtest_cl'; + $this->mockIsTableExists($changelogTableName, true); + $this->mockGetTableName(); + + $selectMock = $this->getMock('Magento\DB\Select', array(), array(), '', false, false); + $selectMock->expects($this->once()) + ->method('distinct') + ->with(true) + ->will($this->returnSelf()); + $selectMock->expects($this->once()) + ->method('from') + ->with($changelogTableName, ['entity_id']) + ->will($this->returnSelf()); + $selectMock->expects($this->exactly(2)) + ->method('where') + ->will($this->returnSelf()); + + $this->connectionMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($selectMock)); + $this->connectionMock->expects($this->once()) + ->method('fetchCol') + ->with($selectMock) + ->will($this->returnValue(['some_data'])); + + $this->model->setViewId('viewIdtest'); + $this->assertEquals(['some_data'], $this->model->getList(1, 2)); + } + public function testGetListWithException() { $changelogTableName = 'viewIdtest_cl'; diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php index 8a915840b506176438136968ae186353118ad468..861b5d4824927e4728138f27815a2c5354ad7b67 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/View/CollectionTest.php @@ -25,7 +25,7 @@ namespace Magento\Mview\View; class CollectionTest extends \PHPUnit_Framework_TestCase { - public function testLoadData() + public function testLoadDataAndGetViewsByStateMode() { $indexerIdOne = 'first_indexer_id'; $indexerIdSecond = 'second_indexer_id'; @@ -50,22 +50,29 @@ class CollectionTest extends \PHPUnit_Framework_TestCase array('getItems') )->disableOriginalConstructor()->getMock(); - $state = $this->getMockBuilder( - 'Magento\Mview\View\State' - )->setMethods( - array('getViewId', '__wakeup') - )->disableOriginalConstructor()->getMock(); + $state = $this->getMockForAbstractClass( + 'Magento\Mview\View\StateInterface', [], '', false, false, true, + ['getViewId', 'getMode', '__wakeup'] + ); $state->expects($this->any())->method('getViewId')->will($this->returnValue('second_indexer_id')); - $indexer = $this->getMockBuilder( - 'Magento\Object' - )->setMethods( - array('load', 'setState') - )->disableOriginalConstructor()->getMock(); + $state->expects( + $this->any() + )->method( + 'getMode' + )->will( + $this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED) + ); + + $view = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, + ['load', 'setState', 'getState', '__wakeup'] + ); - $indexer->expects($this->once())->method('setState')->with($state); - $indexer->expects($this->any())->method('load')->with($this->logicalOr($indexerIdOne, $indexerIdSecond)); + $view->expects($this->once())->method('setState')->with($state); + $view->expects($this->any())->method('getState')->will($this->returnValue($state)); + $view->expects($this->any())->method('load')->with($this->logicalOr($indexerIdOne, $indexerIdSecond)); $entityFactory->expects( $this->any() @@ -74,7 +81,7 @@ class CollectionTest extends \PHPUnit_Framework_TestCase )->with( 'Magento\Mview\ViewInterface' )->will( - $this->returnValue($indexer) + $this->returnValue($view) ); $statesFactory->expects($this->once())->method('create')->will($this->returnValue($states)); @@ -91,5 +98,13 @@ class CollectionTest extends \PHPUnit_Framework_TestCase $collection = new \Magento\Mview\View\Collection($entityFactory, $config, $statesFactory); $this->assertInstanceOf('Magento\Mview\View\Collection', $collection->loadData()); + + $views = $collection->getViewsByStateMode(\Magento\Mview\View\StateInterface::MODE_DISABLED); + $this->assertCount(2, $views); + $this->assertInstanceOf('Magento\Mview\ViewInterface', $views[0]); + $this->assertInstanceOf('Magento\Mview\ViewInterface', $views[1]); + + $views = $collection->getViewsByStateMode(\Magento\Mview\View\StateInterface::MODE_ENABLED); + $this->assertCount(0, $views); } } diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..1a4971b8a3a1b8e50af2c28b55454905d2ff03c3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionFactoryTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\View; + +class SubscriptionFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\View\SubscriptionFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $model; + + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false); + $this->model = new SubscriptionFactory($this->objectManagerMock); + } + + public function testCreate() + { + $subscriptionInterfaceMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\SubscriptionInterface', array(), '', false + ); + $this->objectManagerMock->expects($this->once()) + ->method('create') + ->with('Magento\Mview\View\SubscriptionInterface', ['some_data']) + ->will($this->returnValue($subscriptionInterfaceMock)); + $this->assertEquals($subscriptionInterfaceMock, $this->model->create(['some_data'])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..3c394e5c777121790483fc98a2027738cb7ee8d3 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Mview/View/SubscriptionTest.php @@ -0,0 +1,293 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Mview\View; + +class SubscriptionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Mview\View\Subscription + */ + protected $model; + + /** + * Mysql PDO DB adapter mock + * + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\DB\Adapter\Pdo\Mysql + */ + protected $connectionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\Resource + */ + protected $resourceMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\DB\Ddl\TriggerFactory + */ + protected $triggerFactoryMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\View\CollectionInterface + */ + protected $viewCollectionMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Mview\ViewInterface + */ + protected $viewMock; + + protected function setUp() + { + $this->connectionMock = $this->getMock('Magento\DB\Adapter\Pdo\Mysql', [], [], '', false); + + $this->resourceMock = $this->getMock( + 'Magento\App\Resource', array('getConnection', 'getTableName'), [], '', false, false + ); + $this->mockGetConnection($this->connectionMock); + $this->triggerFactoryMock = $this->getMock( + 'Magento\DB\Ddl\TriggerFactory', [], [], '', false, false + ); + $this->viewCollectionMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\CollectionInterface', [], '', false, false, true, [] + ); + $this->viewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + + $this->connectionMock->expects($this->any()) + ->method('quoteIdentifier') + ->will($this->returnArgument(0)); + + $this->model = new Subscription( + $this->resourceMock, + $this->triggerFactoryMock, + $this->viewCollectionMock, + $this->viewMock, + 'tableName', + 'columnName' + ); + } + + + public function testGetView() + { + $this->assertEquals($this->viewMock, $this->model->getView()); + } + + public function testGetTableName() + { + $this->assertEquals('tableName', $this->model->getTableName()); + } + + public function testGetColumnName() + { + $this->assertEquals('columnName', $this->model->getColumnName()); + } + + public function testCreate() + { + $this->mockGetTableName(); + + $triggerMock = $this->getMock('Magento\DB\Ddl\Trigger', [], [], '', false, false); + $triggerMock->expects($this->exactly(3)) + ->method('setName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('triggerName')); + $triggerMock->expects($this->exactly(3)) + ->method('setTime') + ->with(\Magento\DB\Ddl\Trigger::TIME_AFTER) + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setEvent') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setTable') + ->with('tableName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(6)) + ->method('addStatement') + ->will($this->returnSelf()); + + $changelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $changelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('test_view_cl')); + $changelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $this->viewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($changelogMock)); + + $this->triggerFactoryMock->expects($this->exactly(3)) + ->method('create') + ->will($this->returnValue($triggerMock)); + + $otherChangelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('other_test_view_cl')); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $otherViewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + $otherViewMock->expects($this->exactly(1)) + ->method('getId') + ->will($this->returnValue('other_id')); + $otherViewMock->expects($this->exactly(1)) + ->method('getSubscriptions') + ->will($this->returnValue([['name' => 'tableName'], ['name' => 'otherTableName']])); + $otherViewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($otherChangelogMock)); + + $this->viewMock->expects($this->exactly(3)) + ->method('getId') + ->will($this->returnValue('this_id')); + $this->viewMock->expects($this->never()) + ->method('getSubscriptions'); + + $this->viewCollectionMock->expects($this->exactly(1)) + ->method('getViewsByStateMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnValue([$this->viewMock, $otherViewMock])); + + $this->connectionMock->expects($this->exactly(3)) + ->method('dropTrigger') + ->with('triggerName') + ->will($this->returnValue(true)); + $this->connectionMock->expects($this->exactly(3)) + ->method('createTrigger') + ->with($triggerMock); + + $this->model->create(); + } + + public function testRemove() + { + $this->mockGetTableName(); + + $triggerMock = $this->getMock('Magento\DB\Ddl\Trigger', [], [], '', false, false); + $triggerMock->expects($this->exactly(3)) + ->method('setName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('triggerName')); + $triggerMock->expects($this->exactly(3)) + ->method('setTime') + ->with(\Magento\DB\Ddl\Trigger::TIME_AFTER) + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setEvent') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('setTable') + ->with('tableName') + ->will($this->returnSelf()); + $triggerMock->expects($this->exactly(3)) + ->method('addStatement') + ->will($this->returnSelf()); + + $this->triggerFactoryMock->expects($this->exactly(3)) + ->method('create') + ->will($this->returnValue($triggerMock)); + + $otherChangelogMock = $this->getMockForAbstractClass( + 'Magento\Mview\View\ChangelogInterface', [], '', false, false, true, [] + ); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getName') + ->will($this->returnValue('other_test_view_cl')); + $otherChangelogMock->expects($this->exactly(3)) + ->method('getColumnName') + ->will($this->returnValue('entity_id')); + + $otherViewMock = $this->getMockForAbstractClass( + 'Magento\Mview\ViewInterface', [], '', false, false, true, [] + ); + $otherViewMock->expects($this->exactly(1)) + ->method('getId') + ->will($this->returnValue('other_id')); + $otherViewMock->expects($this->exactly(1)) + ->method('getSubscriptions') + ->will($this->returnValue([['name' => 'tableName'], ['name' => 'otherTableName']])); + $otherViewMock->expects($this->exactly(3)) + ->method('getChangelog') + ->will($this->returnValue($otherChangelogMock)); + + $this->viewMock->expects($this->exactly(3)) + ->method('getId') + ->will($this->returnValue('this_id')); + $this->viewMock->expects($this->never()) + ->method('getSubscriptions'); + + $this->viewCollectionMock->expects($this->exactly(1)) + ->method('getViewsByStateMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnValue([$this->viewMock, $otherViewMock])); + + $this->connectionMock->expects($this->exactly(3)) + ->method('dropTrigger') + ->with('triggerName') + ->will($this->returnValue(true)); + + $triggerMock->expects($this->exactly(3)) + ->method('getStatements') + ->will($this->returnValue(true)); + + $this->connectionMock->expects($this->exactly(3)) + ->method('createTrigger') + ->with($triggerMock); + + $this->model->remove(); + } + + /** + * @param $connection + */ + protected function mockGetConnection($connection) + { + $this->resourceMock->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($connection)); + } + + protected function mockGetTableName() + { + $this->resourceMock->expects($this->any()) + ->method('getTableName') + ->will($this->returnArgument(0)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php b/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php index e76339216a78c2e2593326e2216eaa348f6433de..fc85d7fb3bfd69f038708be423427ba26dc4ea2a 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php +++ b/dev/tests/unit/testsuite/Magento/Mview/ViewTest.php @@ -41,7 +41,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase protected $actionFactoryMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Mview\View\State + * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Indexer\Model\Mview\View\State */ protected $stateMock; @@ -68,18 +68,18 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); $this->actionFactoryMock = $this->getMock('Magento\Mview\ActionFactory', array('get'), array(), '', false); $this->stateMock = $this->getMock( - 'Magento\Core\Model\Mview\View\State', - array( - 'getViewId', + 'Magento\Indexer\Model\Mview\View\State', + array('getViewId', 'loadByView', 'getVersionId', 'setVersionId', + 'getUpdated', 'getStatus', 'setStatus', 'getMode', 'setMode', 'save', - '__wakeup' + '__wakeup', ), array(), '', @@ -87,7 +87,7 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); $this->changelogMock = $this->getMock( 'Magento\Mview\View\Changelog', - array('getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList'), + array('getViewId', 'setViewId', 'create', 'drop', 'getVersion', 'getList', 'clear'), array(), '', false @@ -108,6 +108,24 @@ class ViewTest extends \PHPUnit_Framework_TestCase ); } + public function testGetActionClass() + { + $this->model->setData('action_class', 'actionClass'); + $this->assertEquals('actionClass', $this->model->getActionClass()); + } + + public function testGetGroup() + { + $this->model->setData('group', 'some_group'); + $this->assertEquals('some_group', $this->model->getGroup()); + } + + public function testGetSubscriptions() + { + $this->model->setData('subscriptions', ['subscription']); + $this->assertEquals(['subscription'], $this->model->getSubscriptions()); + } + public function testLoad() { $viewId = 'view_test'; @@ -144,9 +162,15 @@ class ViewTest extends \PHPUnit_Framework_TestCase public function testSubscribe() { - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('disabled')); - $this->stateMock->expects($this->once())->method('setMode')->with('enabled')->will($this->returnSelf()); - $this->changelogMock->expects($this->once())->method('create'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->once()) + ->method('setMode') + ->with(\Magento\Mview\View\StateInterface::MODE_ENABLED) + ->will($this->returnSelf()); + $this->changelogMock->expects($this->once()) + ->method('create'); $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('create'), array(), '', false); $subscriptionMock->expects($this->exactly(1))->method('create'); $this->subscriptionFactoryMock->expects( @@ -160,12 +184,57 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->subscribe(); } + public function testSubscribeEnabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->never()) + ->method('setMode'); + $this->changelogMock->expects($this->never()) + ->method('create'); + $this->subscriptionFactoryMock->expects($this->never()) + ->method('create'); + $this->loadView(); + $this->model->subscribe(); + } + + /** + * @expectedException \Exception + */ + public function testSubscribeWithException() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + + $this->changelogMock->expects($this->once()) + ->method('create') + ->will($this->returnCallback( + function () { + throw new \Exception(); + } + )); + + $this->loadView(); + $this->model->subscribe(); + } + public function testUnsubscribe() { - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->once())->method('setVersionId')->with(null)->will($this->returnSelf()); - $this->stateMock->expects($this->once())->method('setMode')->with('disabled')->will($this->returnSelf()); - $this->changelogMock->expects($this->once())->method('drop'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->with(null) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('setMode') + ->with(\Magento\Mview\View\StateInterface::MODE_DISABLED) + ->will($this->returnSelf()); + $this->changelogMock->expects($this->once()) + ->method('drop'); $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('remove'), array(), '', false); $subscriptionMock->expects($this->exactly(1))->method('remove'); $this->subscriptionFactoryMock->expects( @@ -179,18 +248,74 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->unsubscribe(); } + public function testUnsubscribeDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->never()) + ->method('setMode'); + $this->changelogMock->expects($this->never()) + ->method('drop'); + $this->subscriptionFactoryMock->expects($this->never()) + ->method('create'); + $this->loadView(); + $this->model->unsubscribe(); + } + + /** + * @expectedException \Exception + */ + public function testUnsubscribeWithException() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + + $subscriptionMock = $this->getMock('Magento\Mview\View\Subscription', array('remove'), array(), '', false); + $subscriptionMock->expects($this->exactly(1)) + ->method('remove') + ->will($this->returnCallback( + function () { + throw new \Exception(); + } + )); + $this->subscriptionFactoryMock->expects($this->exactly(1)) + ->method('create') + ->will($this->returnValue($subscriptionMock)); + + $this->loadView(); + $this->model->unsubscribe(); + } + public function testUpdate() { $currentVersionId = 3; $lastVersionId = 1; $listId = array(2, 3); - $this->stateMock->expects($this->any())->method('getViewId')->will($this->returnValue(1)); - $this->stateMock->expects($this->once())->method('getVersionId')->will($this->returnValue($lastVersionId)); - $this->stateMock->expects($this->once())->method('setVersionId')->will($this->returnSelf()); - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->exactly(2))->method('getStatus')->will($this->returnValue('idle')); - $this->stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf()); - $this->stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf()); + $this->stateMock->expects($this->any()) + ->method('getViewId') + ->will($this->returnValue(1)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue($lastVersionId)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->exactly(2)) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_IDLE)); + $this->stateMock->expects($this->exactly(2)) + ->method('setStatus') + ->will($this->returnSelf()); + $this->stateMock->expects($this->exactly(2)) + ->method('save') + ->will($this->returnSelf()); $this->changelogMock->expects( $this->once() @@ -235,13 +360,26 @@ class ViewTest extends \PHPUnit_Framework_TestCase $currentVersionId = 3; $lastVersionId = 1; $listId = array(2, 3); - $this->stateMock->expects($this->any())->method('getViewId')->will($this->returnValue(1)); - $this->stateMock->expects($this->once())->method('getVersionId')->will($this->returnValue($lastVersionId)); - $this->stateMock->expects($this->never())->method('setVersionId'); - $this->stateMock->expects($this->once())->method('getMode')->will($this->returnValue('enabled')); - $this->stateMock->expects($this->exactly(2))->method('getStatus')->will($this->returnValue('idle')); - $this->stateMock->expects($this->exactly(2))->method('setStatus')->will($this->returnSelf()); - $this->stateMock->expects($this->exactly(2))->method('save')->will($this->returnSelf()); + $this->stateMock->expects($this->any()) + ->method('getViewId') + ->will($this->returnValue(1)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue($lastVersionId)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->exactly(2)) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_IDLE)); + $this->stateMock->expects($this->exactly(2)) + ->method('setStatus') + ->will($this->returnSelf()); + $this->stateMock->expects($this->exactly(2)) + ->method('save') + ->will($this->returnSelf()); $this->changelogMock->expects( $this->once() @@ -283,6 +421,223 @@ class ViewTest extends \PHPUnit_Framework_TestCase $this->model->update(); } + public function testSuspend() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('setVersionId') + ->with(11) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('setStatus') + ->with(\Magento\Mview\View\StateInterface::STATUS_SUSPENDED) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + + $this->changelogMock->expects($this->once()) + ->method('getVersion') + ->will($this->returnValue(11)); + + $this->loadView(); + $this->model->suspend(); + } + + public function testSuspendDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('setVersionId'); + $this->stateMock->expects($this->never()) + ->method('setStatus'); + $this->stateMock->expects($this->never()) + ->method('save'); + + $this->changelogMock->expects($this->never()) + ->method('getVersion'); + + $this->loadView(); + $this->model->suspend(); + } + + public function testResume() + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::STATUS_SUSPENDED)); + $this->stateMock->expects($this->once()) + ->method('setStatus') + ->with(\Magento\Mview\View\StateInterface::STATUS_IDLE) + ->will($this->returnSelf()); + $this->stateMock->expects($this->once()) + ->method('save') + ->will($this->returnSelf()); + + $this->loadView(); + $this->model->resume(); + } + + /** + * @param string $status + * @dataProvider dataProviderResumeNotSuspended + */ + public function testResumeNotSuspended($status) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->stateMock->expects($this->never()) + ->method('setStatus'); + $this->stateMock->expects($this->never()) + ->method('save'); + + $this->loadView(); + $this->model->resume(); + } + + public function dataProviderResumeNotSuspended() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE], + [\Magento\Mview\View\StateInterface::STATUS_WORKING], + ]; + } + + public function testClearChangelog() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_ENABLED)); + $this->stateMock->expects($this->once()) + ->method('getVersionId') + ->will($this->returnValue(11)); + $this->changelogMock->expects($this->once()) + ->method('clear') + ->with(11) + ->will($this->returnValue(true)); + $this->loadView(); + $this->model->clearChangelog(); + } + + public function testClearChangelogDisabled() + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue(\Magento\Mview\View\StateInterface::MODE_DISABLED)); + $this->stateMock->expects($this->never()) + ->method('getVersionId'); + $this->changelogMock->expects($this->never()) + ->method('clear'); + $this->loadView(); + $this->model->clearChangelog(); + } + + public function testSetState() + { + $this->model->setState($this->stateMock); + $this->assertEquals($this->stateMock, $this->model->getState()); + } + + /** + * @param string $mode + * @param bool $result + * @dataProvider dataProviderIsEnabled + */ + public function testIsEnabled($mode, $result) + { + $this->stateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue($mode)); + $this->assertEquals($result, $this->model->isEnabled()); + } + + public function dataProviderIsEnabled() + { + return [ + [\Magento\Mview\View\StateInterface::MODE_ENABLED, true], + [\Magento\Mview\View\StateInterface::MODE_DISABLED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsIdle + */ + public function testIsIdle($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isIdle()); + } + + public function dataProviderIsIdle() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, true], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, false], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsWorking + */ + public function testIsWorking($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isWorking()); + } + + public function dataProviderIsWorking() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, false], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, true], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, false], + ]; + } + + /** + * @param string $status + * @param bool $result + * @dataProvider dataProviderIsSuspended + */ + public function testIsSuspended($status, $result) + { + $this->stateMock->expects($this->once()) + ->method('getStatus') + ->will($this->returnValue($status)); + $this->assertEquals($result, $this->model->isSuspended()); + } + + public function dataProviderIsSuspended() + { + return [ + [\Magento\Mview\View\StateInterface::STATUS_IDLE, false], + [\Magento\Mview\View\StateInterface::STATUS_WORKING, false], + [\Magento\Mview\View\StateInterface::STATUS_SUSPENDED, true], + ]; + } + + public function testGetUpdated() + { + $this->stateMock->expects($this->once()) + ->method('getUpdated') + ->will($this->returnValue('some datetime')); + $this->assertEquals('some datetime', $this->model->getUpdated()); + } + protected function loadView() { $viewId = 'view_test'; diff --git a/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php b/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php index 2defee53d4478c9dd80f8db23b9f13ad9341f9f6..b552b2677918fa91f6ac39b965342139740b8fcb 100644 --- a/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php +++ b/dev/tests/unit/testsuite/Magento/Mview/_files/mview_config.php @@ -22,10 +22,11 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ return array( - 'inputXML' => '<?xml version="1.0" encoding="UTF-8"?><config>' . - '<view id="view_one" class="Ogogo\Class\One" group="some_view_group">' . - '<subscriptions><table name="some_entity" entity_column="entity_id" />' . - '<table name="some_product_relation" entity_column="product_id" /></subscriptions></view></config>', + 'inputXML' => '<?xml version="1.0" encoding="UTF-8"?><config>' + . '<view id="view_one" class="Ogogo\Class\One" group="some_view_group"><!--comment-->' + . '<subscriptions><table name="some_entity" entity_column="entity_id" />' + . '<table name="some_product_relation" entity_column="product_id" /><nottable/>' + . '<!--comment--></subscriptions></view></config>', 'expected' => array( 'view_one' => array( 'view_id' => 'view_one', diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php index 7388ed4c274080dc25677c5e560ab4efda45f454..20cb631c8148dd171dd828c01499dffc40e51aac 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/mapped_simple_di_config.php @@ -24,7 +24,7 @@ return array( 'preferences' => array( 'Magento\Module\UpdaterInterface' => 'Magento\Module\Updaterter', - 'Magento\AppInterface' => 'Magento\Core\Model\App\Proxy' + 'Magento\App\RequestInterface' => 'Magento\App\Request\Http\Proxy', ), 'Magento\App\State' => array('arguments' => array('test name' => 'test value')), 'Magento\Core\Model\Config\Modules' => array( diff --git a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml index 40795af762f8896e491e97c8af7f0b02d059613b..6e89639248b37195fba0945880bb33f7c2c87eac 100644 --- a/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml +++ b/dev/tests/unit/testsuite/Magento/ObjectManager/Config/Mapper/_files/simple_di_config.xml @@ -26,7 +26,7 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> <!-- Comment within root node --> <preference for="Magento\Module\UpdaterInterface" type="Magento\Module\Updaterter" /> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> + <preference for="Magento\App\RequestInterface" type="Magento\App\Request\Http\Proxy" /> <!--Arguments only--> <type name="Magento\App\State"> <arguments> diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php deleted file mode 100644 index f8e9b74f3b992007b8a375461a398b5c9c5dfcda..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_mockObjectManager; - - /** - * @var \Magento\Outbound\Authentication\Factory - */ - protected $_authFactory; - - /** - * @var \Magento\Outbound\Authentication\Hmac - */ - protected $_expectedObject; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('get') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_authFactory = new \Magento\Outbound\Authentication\Factory( - array('hmac' => 'Test_Authentication_Hmac'), - $this->_mockObjectManager - ); - - $this->_expectedObject = $this->getMockBuilder( - 'Magento\Outbound\Authentication\Hmac' - )->disableOriginalConstructor()->getMock(); - - $this->_formatterFactory = new \Magento\Outbound\Formatter\Factory( - array('json' => 'Test_Formatter_Json'), - $this->_mockObjectManager - ); - } - - public function testGetAuthenticationSuccess() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Authentication_Hmac' - )->will( - $this->returnValue($this->_expectedObject) - ); - - $authObject = $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); - $this->assertInstanceOf('Magento\Outbound\Authentication\Hmac', $authObject); - $this->assertEquals($this->_expectedObject, $authObject); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage There is no authentication for the type given: TEST_AUTH_TYPE_STRING - */ - public function testGetAuthenticationNoType() - { - $this->_authFactory->getAuthentication('TEST_AUTH_TYPE_STRING'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Authentication class for hmac does not implement authentication interface - */ - public function testGetAuthenticationNoModel() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Authentication_Hmac' - )->will( - $this->returnValue($this->getMock('Magento\Object')) - ); - $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php deleted file mode 100644 index 2cc4ae1b370c2baeb4d3e7d409d82058683d1186..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** - * \Magento\Outbound\Authentication\Hmac - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -class HmacTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Outbound\Authentication\Hmac - */ - private $_model; - - /** - * A random 32 byte string - */ - const SHARED_SECRET = 'x0lpu8kcmu23l8jcqd7qmyknyl5kx2f9'; - - /** message body */ - const BODY = 'This is a test body and has no semantic value.'; - - /** message head domain */ - const DOMAIN = 'www.fake.magento.com'; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Outbound\MessageInterface - */ - private $_mockMessage; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Outbound\UserInterface - */ - private $_mockUser; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\Core\Model\StoreManagerInterface - */ - private $_mockStoreManager; - - protected function setUp() - { - $this->_mockStoreManager = $this->getMockBuilder( - 'Magento\Core\Model\StoreManagerInterface' - )->disableOriginalConstructor()->getMock(); - $this->_model = new \Magento\Outbound\Authentication\Hmac($this->_mockStoreManager); - - $this->_mockMessage = $this->getMockBuilder( - 'Magento\Outbound\MessageInterface' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage->expects($this->any())->method('getBody')->will($this->returnValue(self::BODY)); - - $this->_mockUser = $this->getMockBuilder( - 'Magento\Outbound\UserInterface' - )->disableOriginalConstructor()->getMock(); - } - - public function testHeaders() - { - $store = $this->getMockBuilder('Magento\Core\Model\Store')->disableOriginalConstructor()->getMock(); - $this->_mockStoreManager->expects($this->once())->method('getSafeStore')->will($this->returnValue($store)); - $store->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://' . self::DOMAIN)); - - $this->_mockUser->expects( - $this->once() - )->method( - 'getSharedSecret' - )->will( - $this->returnValue(self::SHARED_SECRET) - ); - - $hash = (string)hash_hmac( - \Magento\Outbound\Authentication\Hmac::SHA256_ALGORITHM, - self::BODY, - self::SHARED_SECRET - ); - - $headers = $this->_model->getSignatureHeaders($this->_mockMessage->getBody(), $this->_mockUser); - $this->assertArrayHasKey(\Magento\Outbound\Authentication\Hmac::DOMAIN_HEADER, $headers); - $this->assertSame(self::DOMAIN, $headers[\Magento\Outbound\Authentication\Hmac::DOMAIN_HEADER]); - $this->assertArrayHasKey(\Magento\Outbound\Authentication\Hmac::HMAC_HEADER, $headers); - $this->assertSame($hash, $headers[\Magento\Outbound\Authentication\Hmac::HMAC_HEADER]); - } - - /** - * @expectedException \LogicException - * @expectedMessage The shared secret cannot be a empty. - */ - public function testEmptySecret() - { - $this->_mockUser->expects($this->once())->method('getSharedSecret')->will($this->returnValue('')); - - $this->_model->getSignatureHeaders($this->_mockMessage, $this->_mockUser); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php deleted file mode 100644 index 4ebf5af1e8e7c2c4434250fbf8264635565c09cf..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject \Magento\App\ObjectManager - */ - private $_mockObjectManager; - - /** - * @var \Magento\Outbound\Formatter\Factory - */ - protected $_formatterFactory; - - /** - * @var \Magento\Outbound\Formatter\Json - */ - protected $_expectedObject; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('get') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_expectedObject = $this->getMockBuilder( - 'Magento\Outbound\Formatter\Json' - )->disableOriginalConstructor()->getMock(); - - $this->_formatterFactory = new \Magento\Outbound\Formatter\Factory( - array('json' => 'Test_Formatter_Json'), - $this->_mockObjectManager - ); - } - - public function testGetFormatter() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Formatter_Json' - )->will( - $this->returnValue($this->_expectedObject) - ); - - $formatter = $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); - $this->assertInstanceOf('Magento\Outbound\Formatter\Json', $formatter); - $this->assertEquals($this->_expectedObject, $formatter); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage WrongFormatName - */ - public function testGetFormatterWrongFormatName() - { - $this->_formatterFactory->getFormatter('WrongFormatName'); - } - - /** - * @expectedException \LogicException - * @expectedExceptionMessage Formatter class for json does not implement FormatterInterface. - */ - public function testGetFormatterWrongFormatterClass() - { - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'get' - )->with( - 'Test_Formatter_Json' - )->will( - $this->returnValue($this->getMock('Magento\Object')) - ); - - $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php deleted file mode 100644 index 22cba156c064dd07db52e7a8abf5e0f1e526ae08..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php +++ /dev/null @@ -1,79 +0,0 @@ -<?php -/** - * \Magento\Outbound\Formatter\Json - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - - -require_once __DIR__ . '/JsonTest/Data.php'; -class JsonTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Outbound\Formatter\Json - */ - protected $_formatter; - - protected function setUp() - { - $this->_formatter = new \Magento\Outbound\Formatter\Json(); - } - - /** - * @dataProvider encodeDataProvider - * - * @param $input - * @param $expectedOutput - */ - public function testFormat($input, $expectedOutput) - { - $this->assertSame($expectedOutput, $this->_formatter->format($input)); - } - - public function testGetContentType() - { - $this->assertSame(\Magento\Outbound\Formatter\Json::CONTENT_TYPE, $this->_formatter->getContentType()); - } - - /** - * DataProvider for testing the JSON formatter. - * - * @return array - */ - public function encodeDataProvider() - { - return array( - array(array(), "[]"), - array(array('a' => array('b' => 'c', 'd' => 'e'), 'f' => 'g'), '{"a":{"b":"c","d":"e"},"f":"g"}'), - array(array(null), '[null]'), - array(array(true), '[true]'), - array(array(false), '[false]'), - array(array(-1), '[-1]'), - array(array(0), '[0]'), - array(array(1), '[1]'), - array(array(2.4), '[2.4]'), - array(array(2.0), '[2]'), - array(array(new \Magento\Outbound\Formatter\JsonTest\Data('public', 'protected')), '[{"dataA":"public"}]') - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php deleted file mode 100644 index a1e7ceee9865c49bb465eb148d858bf5d25175bb..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest/Data.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Class Data is a simple class to test converting a PHP class into JSON data - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter\JsonTest; - -class Data -{ - public $dataA; - - protected $_dataB; - - public function __construct($first, $second) - { - $this->dataA = $first; - $this->_dataB = $second; - } - - public function getB() - { - return $this->_dataB; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php deleted file mode 100644 index fb45f7b6ac96db4e19bdf89b66679971dcfc4262..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Message/FactoryTest.php +++ /dev/null @@ -1,237 +0,0 @@ -<?php -/** - * \Magento\Outbound\Message\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - const ENDPOINT_URL = 'https://endpoint_url'; - - const TOPIC = 'topic'; - - const CONTENT_TYPE = 'content_type'; - - const AUTH_TYPE = 'auth_type'; - - const FORMATTED_BODY = 'some_formatted_body'; - - const TIMEOUT = 777; - - public static $body = array('some_body'); - - public static $signatureHeaders = array('signature' => 'hash'); - - /** @var \Magento\Outbound\Message\Factory */ - protected $_factory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockFormatFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockFormatter; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockAuthFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEndpoint; - - /** - * @return void - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder( - 'Magento\ObjectManager' - )->setMethods( - array('create') - )->disableOriginalConstructor()->getMockForAbstractClass(); - - $this->_mockFormatFactory = $this->getMockBuilder( - 'Magento\Outbound\Formatter\Factory' - )->disableOriginalConstructor()->getMock(); - - $this->_mockAuthFactory = $this->getMockBuilder( - 'Magento\Outbound\Authentication\Factory' - )->disableOriginalConstructor()->getMock(); - - $this->_factory = new \Magento\Outbound\Message\Factory( - $this->_mockObjectManager, - $this->_mockFormatFactory, - $this->_mockAuthFactory - ); - - $this->_mockFormatter = $this->getMockBuilder( - 'Magento\Outbound\FormatterInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint = $this->getMockBuilder( - 'Magento\Outbound\EndpointInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint->expects($this->once())->method('getFormat')->will($this->returnValue('some_format')); - - $this->_mockFormatFactory->expects( - $this->once() - )->method( - 'getFormatter' - )->with( - $this->equalTo('some_format') - )->will( - $this->returnValue($this->_mockFormatter) - ); - - $this->_mockFormatter->expects( - $this->once() - )->method( - 'getContentType' - )->will( - $this->returnValue(self::CONTENT_TYPE) - ); - - $this->_mockFormatter->expects( - $this->once() - )->method( - 'format' - )->with( - $this->equalTo(self::$body) - )->will( - $this->returnValue(self::FORMATTED_BODY) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getAuthenticationType' - )->will( - $this->returnValue(self::AUTH_TYPE) - ); - - $mockAuth = $this->getMockBuilder( - 'Magento\Outbound\AuthenticationInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_mockAuthFactory->expects( - $this->once() - )->method( - 'getAuthentication' - )->with( - $this->equalTo(self::AUTH_TYPE) - )->will( - $this->returnValue($mockAuth) - ); - - $mockUser = $this->getMockBuilder('Magento\Outbound\UserInterface')->disableOriginalConstructor()->getMock(); - - $this->_mockEndpoint->expects($this->once())->method('getUser')->will($this->returnValue($mockUser)); - - $mockAuth->expects( - $this->once() - )->method( - 'getSignatureHeaders' - )->with( - $this->equalTo(self::FORMATTED_BODY), - $this->equalTo($mockUser) - )->will( - $this->returnValue(self::$signatureHeaders) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getEndpointUrl' - )->will( - $this->returnValue(self::ENDPOINT_URL) - ); - - $this->_mockEndpoint->expects( - $this->once() - )->method( - 'getTimeoutInSecs' - )->will( - $this->returnValue(self::TIMEOUT) - ); - - $this->_mockObjectManager->expects( - $this->once() - )->method( - 'create' - )->with( - $this->equalTo('Magento\Outbound\Message'), - $this->anything() - )->will( - $this->returnCallback(array($this, 'verifyManagerCreate')) - ); - } - - public function testCreate() - { - $this->assertEquals('SUCCESS', $this->_factory->create($this->_mockEndpoint, self::TOPIC, self::$body)); - } - - /** - * Used to verify the correct arguments are passed in to \Magento\ObjectManager::create - * - * @param $className - * @param array $arguments - * - * @return string - */ - public function verifyManagerCreate($className, array $arguments) - { - $this->assertSame('Magento\Outbound\Message', $className); - - $this->assertCount(4, $arguments); - - $this->assertArrayHasKey('endpointUrl', $arguments); - $this->assertSame(self::ENDPOINT_URL, $arguments['endpointUrl']); - - $this->assertArrayHasKey('headers', $arguments); - $headers = $arguments['headers']; - $this->assertArrayHasKey(\Magento\Outbound\Message\FactoryInterface::TOPIC_HEADER, $headers); - $this->assertSame(self::TOPIC, $headers[\Magento\Outbound\Message\FactoryInterface::TOPIC_HEADER]); - $this->assertArrayHasKey(\Magento\Outbound\FormatterInterface::CONTENT_TYPE_HEADER, $headers); - $this->assertSame(self::CONTENT_TYPE, $headers[\Magento\Outbound\FormatterInterface::CONTENT_TYPE_HEADER]); - foreach (self::$signatureHeaders as $key => $value) { - $this->assertArrayHasKey($key, $headers); - $this->assertSame($value, $headers[$key]); - } - - $this->assertArrayHasKey('body', $arguments); - $this->assertSame(self::FORMATTED_BODY, $arguments['body']); - - $this->assertArrayHasKey('timeout', $arguments); - $this->assertSame(self::TIMEOUT, $arguments['timeout']); - - return 'SUCCESS'; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php b/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php deleted file mode 100644 index 14b0a62acd464cd47f6a7afdc5aaec738213bcdc..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/MessageTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * \Magento\Outbound\Message - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -class MessageTest extends \PHPUnit_Framework_TestCase -{ - public function test() - { - $uut = new \Magento\Outbound\Message('http://localhost', array('key1' => 'val1', 'key2' => 'val2'), "Body"); - // check endpoint url - $this->assertSame('http://localhost', $uut->getEndpointUrl()); - // check headers - $rsltHdr = $uut->getHeaders(); - $this->assertSame('val1', $rsltHdr['key1']); - $this->assertSame('val2', $rsltHdr['key2']); - // check for body - $this->assertSame("Body", $uut->getBody()); - // check for default timeout - $this->assertSame(20, $uut->getTimeout()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php deleted file mode 100644 index 18363f3aae4b88cf88cbb969c8693b4b10dc8f6d..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Transport/Http/ResponseTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * \Magento\Outbound\Transport\Http\Response - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport\Http; - -class ResponseTest extends \PHPUnit_Framework_TestCase -{ - public function testIsSuccessfulTrue() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 OK"); - $this->assertTrue($uut->isSuccessful()); - } - - public function testIsSuccessfulFalse() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 301 Moved Permanently"); - $this->assertFalse($uut->isSuccessful()); - } - - public function testGetStatusCode() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 OK"); - $this->assertSame(299, $uut->getStatusCode()); - } - - public function testGetMessage() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 299 A-OK"); - $this->assertSame("A-OK", $uut->getMessage()); - } - - public function testGetBody() - { - $uut = new \Magento\Outbound\Transport\Http\Response("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nRaw Body"); - $this->assertSame("Raw Body", $uut->getBody()); - } - - public function testGetHeaders() - { - $hdrs = array('Key1' => 'val1', 'Key2' => 'val2'); - $uut = new \Magento\Outbound\Transport\Http\Response( - "HTTP/2.0 200 OK\nkey1: val1\nkey2: val2\n\nMessage Body" - ); - $this->assertEquals($hdrs, $uut->getHeaders()); - $this->assertEquals($hdrs['Key1'], $uut->getHeader('Key1')); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php deleted file mode 100644 index d85c6be71d7b7b206f4fc06e7d4e1e7bd41435de..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Outbound/Transport/HttpTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * \Magento\Outbound\Transport\Http - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @subpackage unit_tests - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport; - -class HttpTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockVrnHttpAdptrCrl; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockMessage; - - protected function setUp() - { - $this->_mockVrnHttpAdptrCrl = $this->getMockBuilder( - 'Magento\HTTP\Adapter\Curl' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage = $this->getMockBuilder( - 'Magento\Outbound\Message' - )->disableOriginalConstructor()->getMock(); - $this->_mockMessage->expects( - $this->any() - )->method( - 'getHeaders' - )->will( - $this->returnValue(array('header' => 'value')) - ); - } - - /** - * Test case for when http adapter returns null - * - * @expectedException \Zend_Http_Exception - */ - public function testNullResponse() - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockVrnHttpAdptrCrl->expects($this->any())->method('read')->will($this->returnValue(null)); - $uut->dispatch($this->_mockMessage); - } - - public function testPositive() - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockVrnHttpAdptrCrl->expects( - $this->any() - )->method( - 'read' - )->will( - $this->returnValue("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nMessage Body") - ); - $response = $uut->dispatch($this->_mockMessage); - $this->assertSame(200, $response->getStatusCode()); - $this->assertSame("OK", $response->getMessage()); - $this->assertSame(array("Hdrkey" => "Hdrval"), $response->getHeaders()); - $this->assertSame("Message Body", $response->getBody()); - } - - /** - * @dataProvider timeoutDataProvider - * - * @param $timeout - */ - public function testMessageTimeout($timeout, $expectedTimeout) - { - $uut = new \Magento\Outbound\Transport\Http($this->_mockVrnHttpAdptrCrl); - $this->_mockMessage->expects($this->any())->method('getTimeout')->will($this->returnValue($timeout)); - $config = array('verifypeer' => true, 'verifyhost' => 2, 'timeout' => $expectedTimeout); - $this->_mockVrnHttpAdptrCrl->expects($this->once())->method('setConfig')->with($config); - $this->_mockVrnHttpAdptrCrl->expects( - $this->any() - )->method( - 'read' - )->will( - $this->returnValue("HTTP/2.0 200 OK\nHdrkey: Hdrval\n\nMessage Body") - ); - $response = $uut->dispatch($this->_mockMessage); - $this->assertSame(200, $response->getStatusCode()); - $this->assertSame("OK", $response->getMessage()); - $this->assertSame(array("Hdrkey" => "Hdrval"), $response->getHeaders()); - $this->assertSame("Message Body", $response->getBody()); - } - - /** - * DataProvider for testing dispatch with different message timeout. - * - * @return array - */ - public function timeoutDataProvider() - { - return array( - array(0, \Magento\Outbound\Message::DEFAULT_TIMEOUT), - array(null, \Magento\Outbound\Message::DEFAULT_TIMEOUT), - array(5, 5), - array(\Magento\Outbound\Message::DEFAULT_TIMEOUT, \Magento\Outbound\Message::DEFAULT_TIMEOUT) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php index 8ad0bff6f3265df922b06c7f19ba331ee900b8be..3944bfe93d3a2f5fd8f9adf6f0a713f7b6e1af9d 100644 --- a/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Payment/Model/Method/FactoryTest.php @@ -84,7 +84,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage WrongClass class doesn't implement \Magento\Payment\Model\MethodInterface */ public function testWrongTypeException() diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php index fe468190727ad054e47490d5a777aa06cbed47ba..66c6ec7698ded41340edfc8a609b4e352813f1c5 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/Express/FormTest.php @@ -67,8 +67,6 @@ class FormTest extends \PHPUnit_Framework_TestCase ->getMock(); $localeResolver = $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false, false); - $appMock = $this->getMock('\Magento\Core\Model\App', array('getLocaleResolver'), array(), '', false); - $appMock->expects($this->any())->method('getLocaleResolver')->will($this->returnValue($localeResolver)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( 'Magento\Paypal\Block\Express\Form', @@ -77,7 +75,7 @@ class FormTest extends \PHPUnit_Framework_TestCase 'paypalConfigFactory' => $paypalConfigFactory, 'currentCustomer' => $this->currentCustomer, 'layout' => $layout, - 'app' => $appMock + 'localeResolver' => $localeResolver ) ); } diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php new file mode 100644 index 0000000000000000000000000000000000000000..aefd6a256cb828fa126b9755b02649af2be70aa1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/Payflow/Link/IframeTest.php @@ -0,0 +1,66 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Paypal\Block\Payflow\Link; + +/** + * Test for Iframe block + * + * @package Magento\Paypal\Block\Payflow\Link + */ +class IframeTest extends \PHPUnit_Framework_TestCase +{ + /** + * Check that isScopePrivate is false + */ + public function testCheckIsScopePrivate() + { + $contextMock = $this->getMock('Magento\View\Element\Template\Context', [], [], '', false); + $checkoutSessionMock = $this->getMock('Magento\Checkout\Model\Session', [], [], '', false); + $orderFactoryMock = $this->getMock('Magento\Sales\Model\OrderFactory', ['getQuote'], [], '', false); + $hssHelperMock = $this->getMock('Magento\Paypal\Helper\Hss', [], [], '', false); + $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', [], [], '', false); + $quoteMock = $this->getMock('Magento\Sales\Model\Quote', ['getPayment', '__wakeup'], [], '', false); + $paymentMock = $this->getMock('Magento\Sales\Model\Quote\Payment', [], [], '', false); + + $checkoutSessionMock->expects($this->any()) + ->method('getQuote') + ->will($this->returnValue($quoteMock)); + $quoteMock->expects($this->any()) + ->method('getPayment') + ->will($this->returnValue($paymentMock)); + $hssHelperMock->expects($this->any()) + ->method('getHssMethods') + ->will($this->returnValue([])); + + $block = new \Magento\Paypal\Block\Payflow\Advanced\Iframe( + $contextMock, + $orderFactoryMock, + $checkoutSessionMock, + $hssHelperMock, + $paymentDataMock + ); + + $this->assertFalse($block->isScopePrivate()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php index 381ccfcdf58839f58d9bdcfc9897088ca97745e5..18df9b8c4a29b53a61767881f76023d184a6b993 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Block/PayflowExpress/FormTest.php @@ -61,12 +61,14 @@ class FormTest extends \PHPUnit_Framework_TestCase $this->returnValue($mark) ); $localeResolver = $this->getMock('Magento\Locale\ResolverInterface', array(), array(), '', false, false); - $appMock = $this->getMock('\Magento\Core\Model\App', array('getLocaleResolver'), array(), '', false); - $appMock->expects($this->any())->method('getLocaleResolver')->will($this->returnValue($localeResolver)); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( 'Magento\Paypal\Block\PayflowExpress\Form', - array('paypalConfigFactory' => $paypalConfigFactory, 'layout' => $layout, 'app' => $appMock) + [ + 'paypalConfigFactory' => $paypalConfigFactory, + 'layout' => $layout, + 'localeResolver' => $localeResolver + ] ); } diff --git a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php index 2b6af881854546cfa04b46817ff8f99daa227b4b..c0f2a215abf5605160556721a708ec1989716fa8 100644 --- a/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php +++ b/dev/tests/unit/testsuite/Magento/Paypal/Model/ObserverTest.php @@ -212,8 +212,8 @@ class ObserverTest extends \PHPUnit_Framework_TestCase $agreement = $this->getMock('Magento\Paypal\Model\Billing\Agreement', array(), array(), '', false); $agreement->expects($this->once())->method('isValid')->will($this->returnValue($isValid)); $comment = $this->getMockForAbstractClass( - 'Magento\Core\Model\AbstractModel', - array(), + 'Magento\Model\AbstractModel', + [], '', false, true, diff --git a/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php b/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php index 3f2e1f3598fb65dd78bab78497e06c7f2b1e11eb..bdf98a26f3010ab105c0d0e375cc48babe23e411 100644 --- a/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php +++ b/dev/tests/unit/testsuite/Magento/Persistent/Model/SessionTest.php @@ -40,33 +40,34 @@ class SessionTest extends \PHPUnit_Framework_TestCase */ protected $_cookieMock; - /** - * @var \Magento\Core\Model\Resource\AbstractResource|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_resource; - protected function setUp() { $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_configMock = $this->getMock('Magento\Session\Config\ConfigInterface'); $this->_cookieMock = $this->getMock('Magento\Stdlib\Cookie', array(), array(), '', false); - $this->_resource = $this->getMockForAbstractClass( - 'Magento\Core\Model\Resource\Db\AbstractDb', - array(), - '', - false, - false, - true, - array('__wakeup', 'getIdFieldName', 'getConnection', 'beginTransaction', 'delete', 'commit', 'rollBack') + $resourceMock = $this->getMockForAbstractClass('Magento\Model\Resource\Db\AbstractDb', + array(), '', false, false, true, + array('__wakeup', 'getIdFieldName', 'getConnection', 'beginTransaction', 'delete', 'commit', 'rollBack')); + + $appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); + $eventDispatcherMock = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false, false); + $cacheManagerMock = $this->getMock('Magento\App\CacheInterface', array(), array(), '', false, false); + $loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); + $actionValidatorMock = $this->getMock( + '\Magento\Model\ActionValidator\RemoveAction', array(), array(), '', false ); - $this->_model = $helper->getObject( - 'Magento\Persistent\Model\Session', - array( - 'sessionConfig' => $this->_configMock, - 'cookie' => $this->_cookieMock, - 'resource' => $this->_resource - ) + $actionValidatorMock->expects($this->any())->method('isAllowed')->will($this->returnValue(true)); + + $context = new \Magento\Model\Context( + $loggerMock, $eventDispatcherMock, $cacheManagerMock, $appStateMock, $actionValidatorMock ); + + $this->_model = $helper->getObject('Magento\Persistent\Model\Session', array( + 'sessionConfig' => $this->_configMock, + 'cookie' => $this->_cookieMock, + 'resource' => $resourceMock, + 'context' => $context + )); } /** diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php index 26d864ffe663b8dffe896cde5dd85abf68545084..8a358cac536c2505f48968a1322e92300098e73b 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/CompositeTest.php @@ -59,32 +59,35 @@ class CompositeTest extends \PHPUnit_Framework_TestCase public function testRender() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $resultAfterFirst = 'rendered text first'; $resultAfterSecond = 'rendered text second'; $this->rendererOne->expects( $this->once() )->method( - 'render' - )->with( - $text, - $arguments - )->will( - $this->returnValue($resultAfterFirst) - ); + 'render' + )->with( + [$text], + $arguments + )->will( + $this->returnValue($resultAfterFirst) + ); $this->rendererTwo->expects( $this->once() )->method( - 'render' - )->with( - $resultAfterFirst, - $arguments - )->will( - $this->returnValue($resultAfterSecond) - ); + 'render' + )->with( + [ + $text, + $resultAfterFirst + ], + $arguments + )->will( + $this->returnValue($resultAfterSecond) + ); - $this->assertEquals($resultAfterSecond, $this->object->render($text, $arguments)); + $this->assertEquals($resultAfterSecond, $this->object->render([$text], $arguments)); } } diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php new file mode 100644 index 0000000000000000000000000000000000000000..453b1de3b1b7dee5e79a78bb6f46b9ecbe248a1b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/InlineTest.php @@ -0,0 +1,91 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Phrase\Renderer; + +class InlineTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TranslateInterface + */ + protected $translator; + + /** + * @var \Magento\Phrase\Renderer\Translate + */ + protected $_renderer; + + /** + * @var \Magento\Translate\Inline\ProviderInterface + */ + protected $provider; + + protected function setUp() + { + $this->translator = $this->getMock('Magento\TranslateInterface', [], [], '', false); + $this->provider = $this->getMock('Magento\Translate\Inline\ProviderInterface', [], [], '', false); + + $this->renderer = new \Magento\Phrase\Renderer\Inline( + $this->translator, + $this->provider + ); + } + + public function testRenderIfInlineTranslationIsAllowed() + { + $theme = 'theme'; + $text = 'test'; + $result = sprintf('{{{%s}}{{%s}}}', $text, $theme); + + $this->translator->expects($this->once()) + ->method('getTheme') + ->will($this->returnValue($theme)); + + $inlineTranslate = $this->getMock('Magento\Translate\InlineInterface', [], [], '', []); + $inlineTranslate->expects($this->once()) + ->method('isAllowed') + ->will($this->returnValue(true)); + + $this->provider->expects($this->once()) + ->method('get') + ->will($this->returnValue($inlineTranslate)); + + $this->assertEquals($result, $this->renderer->render([$text], [])); + } + + public function testRenderIfInlineTranslationIsNotAllowed() + { + $text = 'test'; + + $inlineTranslate = $this->getMock('Magento\Translate\InlineInterface', [], [], '', []); + $inlineTranslate->expects($this->once()) + ->method('isAllowed') + ->will($this->returnValue(false)); + + $this->provider->expects($this->once()) + ->method('get') + ->will($this->returnValue($inlineTranslate)); + + $this->assertEquals($text, $this->renderer->render([$text], [])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php index 8db4fed7be6dec31a47c090dd60dec8f7247cdd3..d011a00e191f40b314de3f702220926ea279e6ba 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/PlaceholderTest.php @@ -43,7 +43,7 @@ class PlaceholderTest extends \PHPUnit_Framework_TestCase */ public function testRenderPlaceholder($text, array $arguments, $result) { - $this->assertEquals($result, $this->_renderer->render($text, $arguments)); + $this->assertEquals($result, $this->_renderer->render([$text], $arguments)); } /** diff --git a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php index 91fd867c990654deda9e768896323d715dca1b4a..e3ab5658d6fa97dac6594a61eacc85935fa904b9 100644 --- a/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php +++ b/dev/tests/unit/testsuite/Magento/Phrase/Renderer/TranslateTest.php @@ -46,20 +46,44 @@ class TranslateTest extends \PHPUnit_Framework_TestCase ); } - public function testTranslate() + public function testRenderByCode() { + $text = 'original text'; $result = 'rendered text'; $this->_translator->expects( $this->once() )->method( - 'translate' - )->with( - array('text', 'param1', 'param2', 'param3') + 'getTheme' )->will( - $this->returnValue($result) + $this->returnValue('theme') ); + $this->_translator->expects( + $this->once() + )->method( + 'getData' + )->will( + $this->returnValue(['theme::' . $text => $result]) + ); + + $this->assertEquals($result, $this->_renderer->render([$text], [])); + } + + public function testRenderByText() + { + $text = 'original text'; + $result = 'rendered text'; + + $this->_translator->expects($this->once()) + ->method('getTheme') + ->will($this->returnValue('theme')); + $this->_translator->expects($this->once()) + ->method('getData') + ->will($this->returnValue([ + 'theme::' . $text => $result, + $text => $result, + ])); - $this->assertEquals($result, $this->_renderer->render('text', array('param1', 'param2', 'param3'))); + $this->assertEquals($result, $this->_renderer->render([$text], [])); } } diff --git a/dev/tests/unit/testsuite/Magento/PhraseTest.php b/dev/tests/unit/testsuite/Magento/PhraseTest.php index b072e616195d7a203dee3fa7ff4799cd58f656f3..4eacdbc290a70f01521376a5ef3f2a33bda8018b 100644 --- a/dev/tests/unit/testsuite/Magento/PhraseTest.php +++ b/dev/tests/unit/testsuite/Magento/PhraseTest.php @@ -45,30 +45,31 @@ class PhraseTest extends \PHPUnit_Framework_TestCase public function testRendering() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new \Magento\Phrase($text, $arguments); $this->_renderer->expects( $this->once() )->method( 'render' )->with( - $text, + [$text], $arguments )->will( $this->returnValue($result) ); + $phrase = new \Magento\Phrase($text, $arguments); $this->assertEquals($result, $phrase->render()); } public function testRenderingWithoutRenderer() { $this->_removeRendererFromPhrase(); + $result = 'some text'; - $phrase = new \Magento\Phrase($result); + $phrase = new \Magento\Phrase($result); $this->assertEquals($result, $phrase->render()); } @@ -82,21 +83,21 @@ class PhraseTest extends \PHPUnit_Framework_TestCase public function testThatToStringIsAliasToRender() { $text = 'some text'; - $arguments = array('arg1', 'arg2'); + $arguments = ['arg1', 'arg2']; $result = 'rendered text'; - $phrase = new \Magento\Phrase($text, $arguments); $this->_renderer->expects( $this->once() )->method( 'render' )->with( - $text, + [$text], $arguments )->will( $this->returnValue($result) ); + $phrase = new \Magento\Phrase($text, $arguments); $this->assertEquals($result, (string)$phrase); } diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php deleted file mode 100644 index 56fd99a57b72afa3712d2c9b1c666941e65ca3b2..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Event/FactoryTest.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = new \Magento\PubSub\Event\Factory(); - $event = $factory->create('topic', array()); - - $this->assertInstanceOf('Magento\PubSub\EventInterface', $event); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php deleted file mode 100644 index 609c0e4c07a537829269d6529919ba7ac20ac0ee..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueWriterTest.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\QueueWriter - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $event = $this->getMockBuilder('Magento\PubSub\EventInterface')->disableOriginalConstructor()->getMock(); - $queue = new \Magento\PubSub\Event\QueueWriter(); - $result = $queue->offer($event); - - $this->assertNull($result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php b/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php deleted file mode 100644 index 7ee81b4246882c9a16cb5563d51b6869aa9be38a..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/EventTest.php +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - public function testGetters() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $this->assertEquals(array(), $event->getHeaders()); - $this->assertEquals($bodyData, $event->getBodyData()); - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals(\Magento\PubSub\Event::STATUS_READY_TO_SEND, $event->getStatus()); - } - - public function testComplete() - { - $bodyData = array('some' => 'body'); - $topic = 'topic'; - $event = new \Magento\PubSub\Event($topic, $bodyData); - - $event->complete(); - - $this->assertEquals(\Magento\PubSub\Event::STATUS_PROCESSED, $event->getStatus()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php deleted file mode 100644 index dcd66a6e72419467694deeb7bc153d6cb492d317..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * \Magento\PubSub\Message\DispatcherAsync - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -class DispatcherAsyncTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\PubSub\Message\DispatcherAsync */ - private $_dispatcher; - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_eventFactoryMock; - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMock; - - /** @var string[] Data that gets passed to event factory */ - private $_actualData = array(); - - /** \PHPUnit_Framework_MockObject_MockObject */ - private $_queueWriter; - - protected function setUp() - { - $this->_eventFactoryMock = $this->getMockBuilder( - 'Magento\PubSub\Event\FactoryInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_queueWriter = $this->getMockBuilder( - 'Magento\PubSub\Event\QueueWriterInterface' - )->disableOriginalConstructor()->getMock(); - $this->_queueWriter->expects($this->once())->method('offer'); - - // When the create method is called, program routes to the logEventData callback to log what arguments it - // received. - $this->_eventFactoryMock->expects( - $this->once() - )->method( - 'create' - )->with()->will( - $this->returnCallback(array($this, 'logEventData')) - ); - $this->_eventMock = $this->getMockBuilder( - 'Magento\PubSub\EventInterface' - )->disableOriginalConstructor()->getMock(); - - $this->_dispatcher = new \Magento\PubSub\Message\DispatcherAsync( - $this->_eventFactoryMock, - $this->_queueWriter - ); - } - - public function testDispatch() - { - $expectedData = array('topic' => 'event_topic', 'data' => 'event_data'); - $this->_dispatcher->dispatch($expectedData['topic'], $expectedData['data']); - $this->assertEquals($expectedData, $this->_actualData); - } - - /** - * Log the topic and data that are passed to the event factory's create method. This is to ensure that the - * create method is called as expected. - * - * @param $topic - * @param $data - * @return \PHPUnit_Framework_MockObject_MockObject - */ - public function logEventData($topic, $data) - { - $this->_actualData = array('topic' => $topic, 'data' => $data); - return $this->_eventMock; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php b/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php new file mode 100644 index 0000000000000000000000000000000000000000..5e8660335d175f3840523af306baec833c249f0b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Review/Block/Adminhtml/MainTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Block\Adminhtml; + +use Magento\TestFramework\Helper\ObjectManager as ObjectManagerHelper; + +class MainTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Review\Block\Adminhtml\Main + */ + protected $model; + + /** + * @var \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $request; + + /** + * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $customerAccount; + + public function testConstruct() + { + $this->customerAccount = $this + ->getMockForAbstractClass('Magento\Customer\Service\V1\CustomerAccountServiceInterface'); + $this->customerAccount->expects($this->once()) + ->method('getCustomer') + ->with('customer id') + ->will($this->returnValue(new \Magento\Object())); + $this->request = $this->getMockForAbstractClass('Magento\App\RequestInterface'); + $this->request->expects($this->at(0)) + ->method('getParam') + ->with('customerId', false) + ->will($this->returnValue('customer id')); + $this->request->expects($this->at(1)) + ->method('getParam') + ->with('productId', false) + ->will($this->returnValue(false)); + + + $objectManagerHelper = new ObjectManagerHelper($this); + $this->model = $objectManagerHelper->getObject( + 'Magento\Review\Block\Adminhtml\Main', + [ + 'request' => $this->request, + 'customerAccount' => $this->customerAccount + ] + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php new file mode 100644 index 0000000000000000000000000000000000000000..cfd7e6a9abcbfcb22274d24012b5e1f0a7420261 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Review/Model/Resource/Review/Summary/CollectionTest.php @@ -0,0 +1,146 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Review\Model\Resource\Review\Summary; + +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Collection + */ + protected $collection; + + /** + * @var \Magento\Data\Collection\Db\FetchStrategy\Query|\PHPUnit_Framework_MockObject_MockObject + */ + protected $fetchStrategyMock; + + /** + * @var \Magento\Core\Model\EntityFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $entityFactoryMock; + + /** + * @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject + */ + protected $loggerMock; + + /** + * @var \Magento\App\Resource|\PHPUnit_Framework_MockObject_MockObject + */ + protected $resourceMock; + + /** + * @var \Zend_Db_Adapter_Pdo_Mysql|\PHPUnit_Framework_MockObject_MockObject + */ + protected $adapterMock; + + /** + * @var \Magento\DB\Select|\PHPUnit_Framework_MockObject_MockObject + */ + protected $selectMock; + + protected function setUp() + { + $this->fetchStrategyMock = $this->getMock( + 'Magento\Data\Collection\Db\FetchStrategy\Query', array('fetchAll'), array(), '', false + ); + $this->entityFactoryMock = $this->getMock( + 'Magento\Core\Model\EntityFactory', array('create'), array(), '', false + ); + $this->loggerMock = $this->getMock('Magento\Logger', array('log'), array(), '', false); + $this->resourceMock = $this->getMock( + 'Magento\App\Resource', array('getConnection', 'getTableName'), array(), '', false + ); + $this->adapterMock = $this->getMock( + 'Zend_Db_Adapter_Pdo_Mysql', array('select', 'query'), array(), '', false + ); + $this->selectMock = $this->getMock( + 'Magento\DB\Select', array('from'), array('adapter' => $this->adapterMock) + ); + $this->adapterMock->expects($this->once()) + ->method('select') + ->will($this->returnValue($this->selectMock)); + $this->resourceMock->expects($this->once()) + ->method('getConnection') + ->will($this->returnValue($this->adapterMock)); + $this->resourceMock->expects($this->once()) + ->method('getTableName') + ->will($this->returnArgument(0)); + + $this->collection = new Collection( + $this->entityFactoryMock, + $this->loggerMock, + $this->fetchStrategyMock, + $this->resourceMock + ); + } + + public function testFetchItem() + { + $data = array(1 => 'test'); + $statementMock = $this->getMock('Zend_Db_Statement_Pdo', array('fetch'), array(), '', false); + $statementMock->expects($this->once()) + ->method('fetch') + ->will($this->returnValue($data)); + + $this->adapterMock->expects($this->once()) + ->method('query') + ->with($this->selectMock, $this->anything()) + ->will($this->returnValue($statementMock)); + + $objectMock = $this->getMock('Magento\Object', array('setData'), array()); + $objectMock->expects($this->once()) + ->method('setData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Review\Model\Review\Summary') + ->will($this->returnValue($objectMock)); + $item = $this->collection->fetchItem(); + + $this->assertEquals($objectMock, $item); + $this->assertEquals('primary_id', $item->getIdFieldName()); + } + + public function testLoad() + { + $data = array(10 => 'test'); + $this->fetchStrategyMock->expects($this->once()) + ->method('fetchAll') + ->with($this->selectMock, array()) + ->will($this->returnValue(array($data))); + + $objectMock = $this->getMock('Magento\Object', array('addData'), array()); + $objectMock->expects($this->once()) + ->method('addData') + ->with($data); + $this->entityFactoryMock->expects($this->once()) + ->method('create') + ->with('Magento\Review\Model\Review\Summary') + ->will($this->returnValue($objectMock)); + + $this->collection->load(); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php index b852bfb658f3d89d1a14e295aabda3d9023298bc..ef51a31fa2659318ceae6d47dcd167ca4e1ffcbe 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Controller/Adminhtml/Order/CreditmemoTest.php @@ -226,7 +226,7 @@ class CreditmemoTest extends \PHPUnit_Framework_TestCase } /** - * Set expectations in case of \Magento\Core\Exception for saveAction method + * Set expectations in case of \Magento\Model\Exception for saveAction method * * @param array $data * @param string $errorMessage diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php new file mode 100644 index 0000000000000000000000000000000000000000..067d6c06599dd19d1a16747766009170bc129b24 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Config/Source/Order/StatusTest.php @@ -0,0 +1,63 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Config\Source\Order; + +use Magento\TestFramework\Helper\ObjectManager; + +class StatusTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Config\Source\Order\Status */ + protected $object; + + /** @var ObjectManager */ + protected $objectManager; + + /** @var \Magento\Sales\Model\Order\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $config; + + protected function setUp() + { + $this->config = $this->getMock('Magento\Sales\Model\Order\Config', [], [], '', false); + + $this->objectManager = new ObjectManager($this); + $this->object = $this->objectManager->getObject('Magento\Sales\Model\Config\Source\Order\Status', [ + 'orderConfig' => $this->config + ]); + } + + public function testToOptionArray() + { + $this->config->expects($this->once())->method('getStateStatuses') + ->will($this->returnValue(['status1', 'status2'])); + + $this->assertEquals( + [ + ['value' => '', 'label' => '-- Please Select --'], + ['value' => 0, 'label' => 'status1'], + ['value' => 1, 'label' => 'status2'], + ], + $this->object->toOptionArray() + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php index cb784de4afb0a927d2bde99be566c7b75fed2a2f..3b7196b1a546a675573cf4ffee250da0d7f81a1c 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/AbstractTest.php @@ -42,7 +42,7 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $paymentData = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $string = $this->getMock('Magento\Stdlib\String', array(), array(), '', false); $coreStoreConfig = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false); - $translate = $this->getMock('Magento\TranslateInterface', array(), array(), '', false); + $translate = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); $filesystem = $this->getMock('Magento\App\Filesystem', array(), array(), '', false); $pdfItemsFactory = $this->getMock('Magento\Sales\Model\Order\Pdf\ItemsFactory', array(), array(), '', false); $localeMock = $this->getMock('Magento\Stdlib\DateTime\TimezoneInterface', array(), array(), '', false, false); @@ -98,20 +98,20 @@ class AbstractTest extends \PHPUnit_Framework_TestCase $model = $this->getMockForAbstractClass( 'Magento\Sales\Model\Order\Pdf\AbstractPdf', array( - $paymentData, - $string, - $coreStoreConfig, - $translate, + $paymentData, + $string, + $coreStoreConfig, $filesystem, - $pdfConfig, - $pdfTotalFactory, - $pdfItemsFactory, - $localeMock + $pdfConfig, + $pdfTotalFactory, + $pdfItemsFactory, + $localeMock, + $translate ), - '', - true, - false, - true, + '', + true, + false, + true, array('drawLineBlocks') ); $model->expects($this->once())->method('drawLineBlocks')->will($this->returnValue($page)); diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php index 3b8add09c8654e55efda17f7eaeeec7bff65999a..65e5113b75330605c4ae97adb8f0e15eb07c46a9 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/InvoiceTest.php @@ -40,7 +40,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $paymentDataMock = $this->getMock('Magento\Payment\Helper\Data', array(), array(), '', false); $stringMock = $this->getMock('Magento\Stdlib\String', array(), array(), '', false, false); $storeConfigMock = $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false, false); - $translateMock = $this->getMock('Magento\TranslateInterface', array(), array(), '', false, false); + $translateMock = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false, false); $directoryMock = $this->getMock('Magento\Filesystem\Directory\Write', array(), array(), '', false, false); $directoryMock->expects($this->any())->method('getAbsolutePath')->will( $this->returnCallback( @@ -99,12 +99,12 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase $paymentDataMock, $stringMock, $storeConfigMock, - $translateMock, $filesystemMock, $this->_pdfConfigMock, $totalFactoryMock, $pdfItemsFactoryMock, $localeDateMock, + $translateMock, $storeManagerMock, $localeResolverMock, array() diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php index be178a3097064204e634570bae8759165b52b48a..552a2caf3c441c4db515b1c4d15ac0b5fff65667 100644 --- a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Pdf/Total/FactoryTest.php @@ -87,7 +87,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage The PDF total model TEST must be or extend * \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal. */ diff --git a/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php new file mode 100644 index 0000000000000000000000000000000000000000..52e5dc3b1d80aea9e8c18920fc46d80d8bbc08b6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Sales/Model/Order/Total/Config/BaseTest.php @@ -0,0 +1,156 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Sales\Model\Order\Total\Config; + +use Magento\TestFramework\Helper\ObjectManager; + +class BaseTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Sales\Model\Order\Total\Config\Base */ + protected $object; + + /** @var \Magento\App\Cache\Type\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $configCacheType; + + /** @var \Magento\Logger|\PHPUnit_Framework_MockObject_MockObject */ + protected $logger; + + /** @var \Magento\Sales\Model\Config|\PHPUnit_Framework_MockObject_MockObject */ + protected $salesConfig; + + /** @var \Magento\Sales\Model\Order\TotalFactory|\PHPUnit_Framework_MockObject_MockObject */ + protected $orderTotalFactory; + + protected function setUp() + { + $this->configCacheType = $this->getMock('Magento\App\Cache\Type\Config', [], [], '', false); + $this->logger = $this->getMock('Magento\Logger', [], [], '', false); + $this->salesConfig = $this->getMock('Magento\Sales\Model\Config', [], [], '', false); + $this->orderTotalFactory = $this->getMock('Magento\Sales\Model\Order\TotalFactory', [], [], '', false); + + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Sales\Model\Order\Total\Config\Base', [ + 'configCacheType' => $this->configCacheType, + 'logger' => $this->logger, + 'salesConfig' => $this->salesConfig, + 'orderTotalFactory' => $this->orderTotalFactory, + ]); + } + + public function testGetTotalModels() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->configCacheType->expects($this->once())->method('save') + ->with('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}', 'sorted_collectors'); + + $this->assertSame( + ['other_code' => $total, 'some_code' => $total], + $this->object->getTotalModels() + ); + } + + /** + * @expectedException Magento\Model\Exception + * @expectedExceptionMessage The total model should be extended from \Magento\Sales\Model\Order\Total\AbstractTotal. + */ + public function testGetTotalModelsInvalidTotalModel() + { + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($this)); + + $this->object->getTotalModels(); + } + + public function testGetTotalUnserializeCachedCollectorCodes() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->any())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1723], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->configCacheType->expects($this->once())->method('load')->with('sorted_collectors') + ->will($this->returnValue('a:2:{i:0;s:10:"other_code";i:1;s:9:"some_code";}')); + $this->configCacheType->expects($this->never())->method('save'); + + $this->assertSame( + ['other_code' => $total, 'some_code' => $total], + $this->object->getTotalModels() + ); + } + + public function testGetTotalModelsSortingSubroutine() + { + $total = $this->getMockForAbstractClass('Magento\Sales\Model\Order\Total\AbstractTotal'); + $this->salesConfig->expects($this->once())->method('getGroupTotals')->will( + $this->returnValue([ + 'some_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1903], + 'other_code' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], + 'equal_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 1112], + 'big_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal', 'sort_order' => 3000], + 'no_order' => ['instance' => 'Magento\Sales\Model\Order\Total\AbstractTotal'], + ]) + ); + + $this->orderTotalFactory->expects($this->any())->method('create') + ->with('Magento\Sales\Model\Order\Total\AbstractTotal') + ->will($this->returnValue($total)); + + $this->assertSame( + [ + 'no_order' => $total, + 'equal_order' => $total, + 'other_code' => $total, + 'some_code' => $total, + 'big_order' => $total, + ], + $this->object->getTotalModels() + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php index 24c6fb96fc569740c4876eb742357e10203a54e3..615893e4b314d5374a59df4acb3fab7abda2ac7d 100644 --- a/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php +++ b/dev/tests/unit/testsuite/Magento/Sitemap/Model/SitemapTest.php @@ -173,7 +173,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not allowed sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please define a correct path. */ public function testNotAllowedPath() @@ -186,7 +186,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not exists sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please create the specified folder "" before saving the sitemap. */ public function testPathNotExists() @@ -200,7 +200,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check not writable sitemap path validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please make sure that "/" is writable by the web-server. */ public function testPathNotWritable() @@ -216,7 +216,7 @@ class SitemapTest extends \PHPUnit_Framework_TestCase /** * Check invalid chars in sitemap filename validation * - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception * @expectedExceptionMessage Please use only letters (a-z or A-Z), numbers (0-9) or underscores (_) in the filename. No spaces or other characters are allowed. */ //@codingStandardsIgnoreEnd diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php index 0b60f8dda9c05973213f8d3165fa8c1f223e40ab..21b055cfc42a49bf48227f4908a871c237934edb 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/FactoryTest.php @@ -98,7 +98,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase $taxClassFactory = new \Magento\Tax\Model\TaxClass\Factory($objectManager); $this->setExpectedException( - 'Magento\Core\Exception', + 'Magento\Model\Exception', sprintf('Invalid type of tax class "%s"', $wrongClassType) ); $taxClassFactory->create($classMock); diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php index de302bec8527b7c5c2605a4029f7b4cf03808475..b2d4be0733b5a458bff11123fa3a8784a84985d7 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/CustomerTest.php @@ -31,7 +31,7 @@ class CustomerTest extends \PHPUnit_Framework_TestCase public function testGetAssignedObjects() { $collectionMock = $this->getMockBuilder( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection' + 'Magento\Model\Resource\Db\Collection\AbstractCollection' )->setMethods( array('addFieldToFilter') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php index b1e846dd80101f89dcd4809e439a328ecc2935d3..b6a2f3ac5b6fe191297671fa7dd53abc2b2c28d8 100644 --- a/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php +++ b/dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/Type/ProductTest.php @@ -31,7 +31,7 @@ class ProductTest extends \PHPUnit_Framework_TestCase public function testGetAssignedObjects() { $collectionMock = $this->getMockBuilder( - 'Magento\Core\Model\Resource\Db\Collection\AbstractCollection' + 'Magento\Model\Resource\Db\Collection\AbstractCollection' )->setMethods( array('addAttributeToFilter') )->disableOriginalConstructor()->getMock(); diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php index 5ed420965b70ee583705cdfc7e07bae25a6f8662..bfff47d2609d036f7985b0debe568cc8ed58df12 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/Code/Scanner/XmlScannerTest.php @@ -89,7 +89,7 @@ class XmlScannerTest extends \PHPUnit_Framework_TestCase 'Invalid proxy class for ' . substr('\Magento\SomeModule\Model\Nested\Element\Proxy', 0, -5) ); $actual = $this->_model->collectEntities($this->_testFiles); - $expected = array('Magento\Core\Model\App\Proxy'); + $expected = array('Magento\App\Request\Http\Proxy'); $this->assertEquals($expected, $actual); } } diff --git a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml index 5730fc299b5105de1c3a80792def38f93e49ea31..a2992be949198ba1d3d48be3f5fc5d00d0a1e018 100644 --- a/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml +++ b/dev/tests/unit/testsuite/Magento/Test/Tools/Di/_files/app/code/Magento/SomeModule/etc/di.xml @@ -24,7 +24,7 @@ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../../../../../../../../lib/Magento/ObjectManager/etc/config.xsd"> - <preference for="Magento\AppInterface" type="Magento\Core\Model\App\Proxy" /> + <preference for="Magento\App\RequestInterface" type="Magento\App\Request\Http\Proxy" /> <preference for="Magento\Core\Model\Config\InvalidatorInterface" type="Magento\Core\Model\Config\Invalidator\Proxy" /> <preference for="Magento\App\CacheInterface" type="Magento\App\Cache\Proxy" /> <virtualType name="custom_cache_instance" type="Magento\App\Cache"> diff --git a/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php b/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php index 5b52451ed933fbf0f2b6f09b7c36c0e48c547aaf..d8d36e878a3693948cd79e6aec33d491f6e7aa2a 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Controller/Adminhtml/System/Design/ThemeTest.php @@ -47,11 +47,23 @@ class ThemeTest extends \PHPUnit_Framework_TestCase */ protected $_request; + /** + * @var \Magento\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $eventManager; + + /** + * @var \Magento\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $view; + protected function setUp() { $this->_objectManagerMock = $this->getMock('Magento\ObjectManager', array(), array(), '', false); $this->_request = $this->getMock('Magento\App\Request\Http', array(), array(), '', false); + $this->eventManager = $this->getMock('\Magento\Event\ManagerInterface', array(), array(), '', false); + $this->view = $this->getMock('\Magento\App\ViewInterface', array(), array(), '', false); $helper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_model = $helper->getObject( @@ -59,7 +71,9 @@ class ThemeTest extends \PHPUnit_Framework_TestCase array( 'request' => $this->_request, 'objectManager' => $this->_objectManagerMock, - 'response' => $this->getMock('Magento\App\Response\Http', array(), array(), '', false) + 'response' => $this->getMock('Magento\App\Response\Http', array(), array(), '', false), + 'eventManager' => $this->eventManager, + 'view' => $this->view, ) ); } @@ -78,50 +92,50 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $this->_request->expects( $this->at(0) )->method( - 'getParam' - )->with( - 'back', - false - )->will( - $this->returnValue(true) - ); + 'getParam' + )->with( + 'back', + false + )->will( + $this->returnValue(true) + ); $this->_request->expects( $this->at(1) )->method( - 'getParam' - )->with( - 'theme' - )->will( - $this->returnValue($themeData) - ); + 'getParam' + )->with( + 'theme' + )->will( + $this->returnValue($themeData) + ); $this->_request->expects( $this->at(2) )->method( - 'getParam' - )->with( - 'custom_css_content' - )->will( - $this->returnValue($customCssContent) - ); + 'getParam' + )->with( + 'custom_css_content' + )->will( + $this->returnValue($customCssContent) + ); $this->_request->expects( $this->at(3) )->method( - 'getParam' - )->with( - 'js_removed_files' - )->will( - $this->returnValue($jsRemovedFiles) - ); + 'getParam' + )->with( + 'js_removed_files' + )->will( + $this->returnValue($jsRemovedFiles) + ); $this->_request->expects( $this->at(4) )->method( - 'getParam' - )->with( - 'js_order' - )->will( - $this->returnValue($jsOrder) - ); + 'getParam' + )->with( + 'js_order' + )->will( + $this->returnValue($jsOrder) + ); $this->_request->expects($this->once(5))->method('getPost')->will($this->returnValue(true)); $themeMock = $this->getMock( @@ -147,33 +161,63 @@ class ThemeTest extends \PHPUnit_Framework_TestCase $this->_objectManagerMock->expects( $this->at(0) )->method( - 'get' - )->with( - 'Magento\View\Design\Theme\FlyweightFactory' - )->will( - $this->returnValue($themeFactory) - ); + 'get' + )->with( + 'Magento\View\Design\Theme\FlyweightFactory' + )->will( + $this->returnValue($themeFactory) + ); $this->_objectManagerMock->expects( $this->at(1) )->method( - 'get' - )->with( - 'Magento\Theme\Model\Theme\Customization\File\CustomCss' - )->will( - $this->returnValue(null) - ); + 'get' + )->with( + 'Magento\Theme\Model\Theme\Customization\File\CustomCss' + )->will( + $this->returnValue(null) + ); $this->_objectManagerMock->expects( $this->at(2) )->method( - 'create' - )->with( - 'Magento\Theme\Model\Theme\SingleFile' - )->will( - $this->returnValue(null) - ); + 'create' + )->with( + 'Magento\Theme\Model\Theme\SingleFile' + )->will( + $this->returnValue(null) + ); $this->_model->saveAction(); } + + public function testIndexAction() + { + $menuModel = $this->getMock('\Magento\Backend\Model\Menu', array(), array(), '', false); + $menuModel->expects($this->once()) + ->method('getParentItems') + ->with($this->equalTo('Magento_Theme::system_design_theme')) + ->will($this->returnValue(array())); + + $menuBlock = $this->getMock('\Magento\Backend\Block\Menu', array(), array(), '', false); + $menuBlock->expects($this->once()) + ->method('getMenuModel') + ->will($this->returnValue($menuModel)); + + $layout = $this->getMock('\Magento\View\LayoutInterface', array(), array(), '', false); + $layout->expects($this->any()) + ->method('getBlock') + ->with($this->equalTo('menu')) + ->will($this->returnValue($menuBlock)); + + $this->view->expects($this->once()) + ->method('getLayout') + ->will($this->returnValue($layout)); + + $this->eventManager->expects($this->once()) + ->method('dispatch') + ->with($this->equalTo('theme_registration_from_filesystem')) + ->will($this->returnValue(null)); + $this->_model->indexAction(); + } } diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php index d1acfc769cb8933cda7dab0dab67d8f12fd1811e..8188053767bbfadee2348b7bf04b70921e7f75a4 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Uploader/ServiceTest.php @@ -223,7 +223,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidCssFile() { @@ -302,7 +302,7 @@ class ServiceTest extends \PHPUnit_Framework_TestCase } /** - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidJsFile() { diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php index 0efdc6f31e662dddd53c72ffe5df4dc7215f2135..76f3ac2176cfe5c5923635154de1d8484f23b4dd 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/Wysiwyg/StorageTest.php @@ -155,7 +155,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::uploadFile - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testUploadInvalidFile() { @@ -253,7 +253,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::createFolder - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateFolderWithInvalidName() { @@ -263,7 +263,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::createFolder - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testCreateFolderDirectoryAlreadyExist() { @@ -319,7 +319,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::getDirsCollection - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testGetDirsCollectionWrongDirName() { @@ -532,7 +532,7 @@ class StorageTest extends \PHPUnit_Framework_TestCase /** * @covers \Magento\Theme\Model\Wysiwyg\Storage::deleteDirectory - * @expectedException \Magento\Core\Exception + * @expectedException \Magento\Model\Exception */ public function testDeleteRootDirectory() { diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php deleted file mode 100644 index 60b6068ce485efa00804b5ec990b1b266d2b73fa..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Translate/Inline/ConfigFactoryTest.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Translate\Inline; - -class ConfigFactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testGet() - { - $result = 'result'; - $objectManager = $this->getMockForAbstractClass('Magento\ObjectManager'); - $objectManager->expects( - $this->once() - )->method( - 'get' - )->with( - $this->equalTo('Magento\Translate\Inline\ConfigInterface') - )->will( - $this->returnValue($result) - ); - $factory = new \Magento\Translate\Inline\ConfigFactory($objectManager); - $this->assertEquals($result, $factory->get()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php new file mode 100644 index 0000000000000000000000000000000000000000..05446a40ec8313293a2f1a1a4ec6b93af6293804 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/Inline/ProxyTest.php @@ -0,0 +1,153 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translate\Inline; + +class ProxyTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject + */ + protected $objectManagerMock; + + /** + * @var \Magento\Translate\Inline|\PHPUnit_Framework_MockObject_MockObject + */ + protected $translateMock; + + protected function setUp() + { + $this->objectManagerMock = $this->getMock( + 'Magento\ObjectManager', + array('get', 'create', 'configure'), + array(), + '', + false + ); + $this->translateMock = $this->getMock('Magento\Translate\Inline', array(), array(), '', false); + } + + public function testIsAllowed() + { + $this->objectManagerMock->expects( + $this->once() + )->method( + 'get' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('create'); + $this->translateMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false)); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + true + ); + + $this->assertFalse($model->isAllowed()); + } + + public function testGetParser() + { + $parser = new \stdClass(); + $this->objectManagerMock->expects( + $this->once() + )->method( + 'create' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('get'); + $this->translateMock->expects($this->once())->method('getParser')->will($this->returnValue($parser)); + + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + false + ); + + $this->assertEquals($parser, $model->getParser()); + } + + public function testProcessResponseBody() + { + $isJson = true; + $this->objectManagerMock->expects( + $this->once() + )->method( + 'get' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('create'); + + $this->translateMock->expects($this->once()) + ->method('processResponseBody') + ->with('', $isJson) + ->will($this->returnSelf()); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + true + ); + $body = ''; + + $this->assertEquals($this->translateMock, $model->processResponseBody($body, $isJson)); + } + + public function testGetAdditionalHtmlAttribute() + { + $this->objectManagerMock->expects( + $this->once() + )->method( + 'create' + )->with( + 'Magento\Translate\Inline' + )->will( + $this->returnValue($this->translateMock) + ); + $this->objectManagerMock->expects($this->never())->method('get'); + $this->translateMock->expects($this->exactly(2)) + ->method('getAdditionalHtmlAttribute') + ->with($this->logicalOr('some_value', null)) + ->will($this->returnArgument(0)); + + $model = new Proxy( + $this->objectManagerMock, + 'Magento\Translate\Inline', + false + ); + + $this->assertEquals('some_value', $model->getAdditionalHtmlAttribute('some_value')); + $this->assertNull($model->getAdditionalHtmlAttribute()); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php b/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php new file mode 100644 index 0000000000000000000000000000000000000000..639ac538ee9f63a181d95c84180f5d51e6fdc0e6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/Inline/StateTest.php @@ -0,0 +1,74 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +class StateTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var State + */ + protected $model; + + protected function setUp() + { + $this->model = new State(); + } + + public function testIsEnabled() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->disable(); + $this->assertFalse($this->model->isEnabled()); + + $this->model->enable(); + $this->assertTrue($this->model->isEnabled()); + } + + public function testSuspend() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->suspend(); + $this->assertFalse($this->model->isEnabled()); + + $this->model->suspend(true); + $this->assertFalse($this->model->isEnabled()); + } + + public function testResume() + { + $this->assertTrue($this->model->isEnabled()); + + $this->model->resume(null); + $this->assertNull($this->model->isEnabled()); + + $this->model->resume(); + $this->assertNull($this->model->isEnabled()); + + $this->model->resume(false); + $this->assertFalse($this->model->isEnabled()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php new file mode 100644 index 0000000000000000000000000000000000000000..dbc47938fa916235ff61da3f2dc373aa0fdcf7a1 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translate/InlineTest.php @@ -0,0 +1,320 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translate; + +class InlineTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\BaseScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeResolverMock; + + /** + * @var \Magento\UrlInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $urlMock; + + /** + * @var \Magento\View\LayoutInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $layoutMock; + + /** + * @var \Magento\Translate\Inline\ConfigInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $configMock; + + /** + * @var \Magento\Translate\Inline\ParserFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected $parserMock; + + /** + * @var \Magento\Translate\Inline\StateInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $stateMock; + + protected function setUp() + { + $this->scopeResolverMock = $this->getMock('Magento\BaseScopeResolverInterface', array(), array(), '', false); + $this->urlMock = $this->getMock('Magento\UrlInterface', array(), array(), '', false); + $this->layoutMock = $this->getMock('Magento\View\LayoutInterface', array(), array(), '', false); + $this->configMock = $this->getMock('Magento\Translate\Inline\ConfigInterface', array(), array(), '', false); + $this->parserMock = $this->getMock('Magento\Translate\Inline\ParserInterface', array(), array(), '', false); + $this->stateMock = $this->getMock('Magento\Translate\Inline\StateInterface', array(), array(), '', false); + } + + /** + * @param bool $isEnabled + * @param bool $isActive + * @param bool $isDevAllowed + * @param bool $result + * @dataProvider isAllowedDataProvider + */ + public function testIsAllowed($isEnabled, $isActive, $isDevAllowed, $result) + { + $this->prepareIsAllowed($isEnabled, $isActive, $isDevAllowed); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock + ); + + $this->assertEquals($result, $model->isAllowed()); + $this->assertEquals($result, $model->isAllowed()); + } + + public function isAllowedDataProvider() + { + return array( + array(true, true, true, true), + array(true, false, true, false), + array(true, true, false, false), + array(true, false, false, false), + array(false, true, true, false), + array(false, false, true, false), + array(false, true, false, false), + array(false, false, false, false), + ); + } + + public function testGetParser() + { + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock + ); + $this->assertEquals($this->parserMock, $model->getParser()); + } + + /** + * @param string|array $body + * @param string $expected + * @dataProvider processResponseBodyStripInlineDataProvider + */ + public function testProcessResponseBodyStripInline($body, $expected) + { + $scope = 'admin'; + $this->prepareIsAllowed(false, true, true, $scope); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + $model->processResponseBody($body, true); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyStripInlineDataProvider() + { + return array( + array('test', 'test'), + array('{{{aaaaaa}}{{bbbbb}}{{eeeee}}{{cccccc}}}', 'aaaaaa'), + array(array('test1', 'test2'), array('test1', 'test2'),), + array(array('{{{aaaaaa}}', 'test3'), array('{{{aaaaaa}}', 'test3'),), + array(array('{{{aaaaaa}}{{bbbbb}}', 'test4'), array('{{{aaaaaa}}{{bbbbb}}', 'test4'),), + array(array('{{{aaaaaa}}{{bbbbb}}{{eeeee}}{{cccccc}}}', 'test5'), array('aaaaaa', 'test5'),), + ); + } + + /** + * @param string $scope + * @param array|string $body + * @param array|string $expected + * @dataProvider processResponseBodyDataProvider + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function testProcessResponseBody($scope, $body, $expected) + { + $isJson = true; + if ($scope == 'admin') { + $this->prepareIsAllowed(true, true, true, $scope); + } + $jsonCall = is_array($body) ? 2 * (count($body) + 1) : 2; + $this->parserMock->expects( + $this->exactly($jsonCall) + )->method( + 'setIsJson' + )->will( + $this->returnValueMap(array( + array($isJson, $this->returnSelf()), + array(!$isJson, $this->returnSelf()), + )) + ); + $this->parserMock->expects( + $this->exactly(1) + )->method( + 'processResponseBodyString' + )->with( + is_array($body) ? reset($body) : $body + ); + $this->parserMock->expects( + $this->exactly(2) + )->method( + 'getContent' + )->will( + $this->returnValue(is_array($body) ? reset($body) : $body) + ); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + + $model->processResponseBody($body, $isJson); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyDataProvider() + { + return array( + array('admin', 'test', 'test'), + array('not_admin', 'test1', 'test1'), + ); + } + + /** + * @param $scope + * @param $body + * @param $expected + * @dataProvider processResponseBodyGetInlineScriptDataProvider + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function testProcessResponseBodyGetInlineScript($scope, $body, $expected) + { + $isJson = true; + if ($scope == 'admin') { + $this->prepareIsAllowed(true, true, true, $scope); + } + $jsonCall = is_array($body) ? 2 * (count($body) + 1) : 2; + $this->parserMock->expects( + $this->exactly($jsonCall) + )->method( + 'setIsJson' + )->will( + $this->returnValueMap(array( + array($isJson, $this->returnSelf()), + array(!$isJson, $this->returnSelf()), + )) + ); + $this->parserMock->expects( + $this->exactly(1) + )->method( + 'processResponseBodyString' + )->with( + is_array($body) ? reset($body) : $body + ); + $this->parserMock->expects( + $this->exactly(2) + )->method( + 'getContent' + )->will( + $this->returnValue(is_array($body) ? reset($body) : $body) + ); + + $model = new Inline( + $this->scopeResolverMock, + $this->urlMock, + $this->layoutMock, + $this->configMock, + $this->parserMock, + $this->stateMock, + '', + '', + $scope + ); + + $model->processResponseBody($body, $isJson); + $this->assertEquals($body, $expected); + } + + public function processResponseBodyGetInlineScriptDataProvider() + { + return array( + array('admin', 'test', 'test'), + array('not_admin', 'test1', 'test1'), + ); + } + + /** + * @param bool $isEnabled + * @param bool $isActive + * @param bool $isDevAllowed + * @param null|string $scope + */ + protected function prepareIsAllowed($isEnabled, $isActive, $isDevAllowed, $scope = null) + { + $scopeMock = $this->getMock('Magento\BaseScopeInterface', array(), array(), '', false); + $this->stateMock->expects($this->any())->method('isEnabled')->will($this->returnValue($isEnabled)); + $this->scopeResolverMock->expects( + $this->once() + )->method( + 'getScope' + )->with( + $scope + )->will( + $this->returnValue($scopeMock) + ); + + $this->configMock->expects( + $this->once() + )->method( + 'isActive' + )->with( + $scopeMock + )->will( + $this->returnValue($isActive) + ); + + $this->configMock->expects( + $this->exactly((int)$isActive) + )->method( + 'isDevAllowed' + )->will( + $this->returnValue($isDevAllowed) + ); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php new file mode 100644 index 0000000000000000000000000000000000000000..466850e73c4bc2a98278721784e81dcaf48ee4af --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Translation/Model/Inline/ConfigTest.php @@ -0,0 +1,95 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Translation\Model\Inline; + +class ConfigTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var Config + */ + protected $model; + + /** + * @var \Magento\Core\Model\Store\Config|\PHPUnit_Framework_MockObject_MockObject + */ + protected $storeConfigMock; + + /** + * @var \Magento\Core\Helper\Data|\PHPUnit_Framework_MockObject_MockObject + */ + protected $helperMock; + + protected function setUp() + { + $this->storeConfigMock = $this->getMock( + 'Magento\Core\Model\Store\Config', + array('getConfigFlag'), + array(), + '', + false + ); + $this->helperMock = $this->getMock('Magento\Core\Helper\Data', array('isDevAllowed'), array(), '', false); + $this->model = new Config( + $this->storeConfigMock, + $this->helperMock + ); + } + + public function testIsActive() + { + $store = 'some store'; + $result = 'result'; + + $this->storeConfigMock->expects( + $this->once() + )->method( + 'getConfigFlag' + )->with( + $this->equalTo('dev/translate_inline/active'), + $this->equalTo($store) + )->will( + $this->returnValue($result) + ); + + $this->assertEquals($result, $this->model->isActive($store)); + } + + public function testIsDevAllowed() + { + $store = 'some store'; + $result = 'result'; + + $this->helperMock->expects( + $this->once() + )->method( + 'isDevAllowed' + )->with( + $store + )->will( + $this->returnValue($result) + ); + + $this->assertEquals($result, $this->model->isDevAllowed($store)); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php b/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a2e8f51db4d39be9cc99c2a1ce9a36732f8fd03b --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/QueryParamsResolverTest.php @@ -0,0 +1,84 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class QueryParamsResolverTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\QueryParamsResolver */ + protected $object; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Url\QueryParamsResolver'); + } + + public function testGetQuery() + { + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals('foo=bar&true=false', $this->object->getQuery()); + } + + public function testGetQueryEscaped() + { + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals('foo=bar&true=false', $this->object->getQuery(true)); + } + + public function testSetQuery() + { + $this->object->setQuery('foo=bar&true=false'); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testSetQueryIdempotent() + { + $this->object->setQuery(null); + $this->assertEquals([], $this->object->getQueryParams()); + } + + public function testSetQueryParam() + { + $this->object->setQueryParam('foo', 'bar'); + $this->object->setQueryParam('true', 'false'); + $this->object->setQueryParam('foo', 'bar'); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testSetQueryParams() + { + $this->object->setQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } + + public function testAddQueryParamsIdempotent() + { + $this->object->setData('query_params', ['foo' => 'bar', 'true' => 'false']); + $this->object->addQueryParams(['foo' => 'bar', 'true' => 'false']); + $this->assertEquals(['foo' => 'bar', 'true' => 'false'], $this->object->getQueryParams()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php b/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php new file mode 100644 index 0000000000000000000000000000000000000000..a2ba6024047f2d935e9b16cbbcceaeab9bf70538 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/RouteParamsResolverFactoryTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class RouteParamsResolverFactoryTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\RouteParamsResolverFactory */ + protected $object; + + /** @var \Magento\ObjectManager|\PHPUnit_Framework_MockObject_MockObject */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = $this->getMock('Magento\ObjectManager'); + + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject( + 'Magento\Url\RouteParamsResolverFactory', + ['objectManager' => $this->objectManager] + ); + } + + public function testCreate() + { + $producedInstance = $this->getMock('Magento\Url\RouteParamsResolverInterface'); + $this->objectManager->expects($this->once())->method('create')->with('Magento\Url\RouteParamsResolverInterface') + ->will($this->returnValue($producedInstance)); + + $this->assertSame($producedInstance, $this->object->create([])); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php b/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php new file mode 100644 index 0000000000000000000000000000000000000000..e197b477f0a24c8f015333b4e0ed6f1cb6d5f178 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Url/ValidatorTest.php @@ -0,0 +1,58 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Url; + +use Magento\TestFramework\Helper\ObjectManager; + +class ValidatorTest extends \PHPUnit_Framework_TestCase +{ + /** @var \Magento\Url\Validator */ + protected $object; + + /** @var string[] */ + protected $expectedValidationMessages = ['invalidUrl' => "Invalid URL '%value%'."]; + + protected function setUp() + { + $objectManager = new ObjectManager($this); + $this->object = $objectManager->getObject('Magento\Url\Validator'); + } + + public function testConstruct() + { + $this->assertEquals($this->expectedValidationMessages, $this->object->getMessageTemplates()); + } + + public function testIsValidWhenValid() + { + $this->assertEquals(true, $this->object->isValid('http://example.com')); + $this->assertEquals([], $this->object->getMessages()); + } + + public function testIsValidWhenInvalid() + { + $this->assertEquals(false, $this->object->isValid('%value%')); + $this->assertEquals($this->expectedValidationMessages, $this->object->getMessages()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/UrlTest.php b/dev/tests/unit/testsuite/Magento/UrlTest.php index ac07552b48be0447b522c695fe7742ae1bd575e3..7299071825ef7f4581c63a339e36e6b157e57ff8 100644 --- a/dev/tests/unit/testsuite/Magento/UrlTest.php +++ b/dev/tests/unit/testsuite/Magento/UrlTest.php @@ -18,40 +18,87 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core - * @subpackage unit_tests * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -/** - * Test class for \Magento\UrlInterface - */ namespace Magento; +/** + * Test class for Magento\Url + */ class UrlTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\UrlInterface + * @var \Magento\Core\Model\Url\RouteParamsResolver|\PHPUnit_Framework_MockObject_MockObject + */ + protected $routeParamsResolverMock; + + /** + * @var \Magento\Url\ScopeResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeResolverMock; + + /** + * @var \Magento\Url\ScopeInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $scopeMock; + + /** + * @var \Magento\Url\QueryParamsResolverInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected $queryParamsResolverMock; + + /** + * @var \Magento\Session\SidResolverInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_model; + protected $sidResolverMock; /** - * @var \Magento\TestFramework\Helper\ObjectManager + * @var \Magento\Session\Generic|\PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManager; + protected $sessionMock; protected function setUp() { - $this->_objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $paramsResolverMock = $this->getMock('Magento\Url\RouteParamsResolverFactory', array(), array(), '', false); - $paramsResolver = $this->_objectManager->getObject('\Magento\Core\Model\Url\RouteParamsResolver'); - $paramsResolverMock->expects($this->any())->method('create')->will($this->returnValue($paramsResolver)); - $this->_model = $this->_objectManager->getObject( - '\Magento\Url', - array('routeParamsResolver' => $paramsResolverMock) - ); + $this->routeParamsResolverMock = $this->getMock('Magento\Core\Model\Url\RouteParamsResolver', + ['getType', 'hasData', 'getData', 'getRouteParams'], [], '', false); + $this->scopeResolverMock = $this->getMock('Magento\Url\ScopeResolverInterface'); + $this->scopeMock = $this->getMock('Magento\Url\ScopeInterface'); + $this->queryParamsResolverMock = $this->getMock('Magento\Url\QueryParamsResolverInterface', [], [], '', false); + $this->sidResolverMock = $this->getMock('Magento\Session\SidResolverInterface'); + $this->sessionMock = $this->getMock('Magento\Session\Generic', [], [], '', false); + } + + /** + * @return \Magento\Url\RouteParamsResolverFactory|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getRouteParamsResolver() + { + $routeParamsResolverFactoryMock = $this->getMock('Magento\Url\RouteParamsResolverFactory', [], [], '', false); + $routeParamsResolverFactoryMock->expects($this->once())->method('create') + ->will($this->returnValue($this->routeParamsResolverMock)); + return $routeParamsResolverFactoryMock; + } + + /** + * @param array $mockMethods + * @return \Magento\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject + */ + protected function getRequestMock($mockMethods = []) + { + $interfaceMethods = array('getModuleName', 'setModuleName', 'getActionName', 'setActionName', 'getParam'); + return $this->getMock('Magento\App\RequestInterface', array_merge($interfaceMethods, $mockMethods)); + } + + /** + * @param array $arguments + * @return \Magento\Url + */ + protected function getUrlModel($arguments = []) + { + $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + return $objectManager->getObject('Magento\Url', $arguments); } /** @@ -61,32 +108,15 @@ class UrlTest extends \PHPUnit_Framework_TestCase */ public function testGetCurrentUrl($port, $url) { - $methods = array( - 'getServer', - 'getScheme', - 'getHttpHost', - 'getModuleName', - 'setModuleName', - 'getActionName', - 'setActionName', - 'getParam' - ); - $requestMock = $this->getMock('\Magento\App\RequestInterface', $methods); - $requestMock->expects($this->at(0))->method('getServer')->with('SERVER_PORT')->will($this->returnValue($port)); - $requestMock->expects( - $this->at(1) - )->method( - 'getServer' - )->with( - 'REQUEST_URI' - )->will( - $this->returnValue('/fancy_uri') - ); + $requestMock = $this->getRequestMock(['getServer', 'getScheme', 'getHttpHost']); + $requestMock->expects($this->at(0))->method('getServer')->with('SERVER_PORT') + ->will($this->returnValue($port)); + $requestMock->expects($this->at(1))->method('getServer')->with('REQUEST_URI') + ->will($this->returnValue('/fancy_uri')); $requestMock->expects($this->once())->method('getScheme')->will($this->returnValue('http')); $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('example.com')); - /** @var \Magento\UrlInterface $model */ - $model = $this->_objectManager->getObject('Magento\Url', array('request' => $requestMock)); + $model = $this->getUrlModel(['request' => $requestMock]); $this->assertEquals($url, $model->getCurrentUrl()); } @@ -98,4 +128,465 @@ class UrlTest extends \PHPUnit_Framework_TestCase 'custom_port' => array(8080, 'http://example.com:8080/fancy_uri') ); } + + public function testGetUseSession() + { + $model = $this->getUrlModel(); + + $model->setUseSession(false); + $this->assertFalse((bool)$model->getUseSession()); + + $model->setUseSession(true); + $this->assertTrue($model->getUseSession()); + } + + public function testGetBaseUrlNotLinkType() + { + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $baseUrl = 'base-url'; + $urlType = 'not-link'; + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $baseUrlParams = ['_scope' => $this->scopeMock, '_type' => $urlType, '_secure' => true]; + $this->assertEquals($baseUrl, $model->getBaseUrl($baseUrlParams)); + } + + public function testGetUrlValidateFilter() + { + $model = $this->getUrlModel(); + $this->assertEquals('http://test.com', $model->getUrl('http://test.com')); + } + + /** + * @param string|array|bool $query + * @param string $queryResult + * @param string $returnUri + * @dataProvider getUrlDataProvider + */ + public function testGetUrl($query, $queryResult, $returnUri) + { + $requestMock = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['id' => 100])); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + $routeConfigMock->expects($this->once())->method('getRouteFrontName')->will($this->returnValue('catalog')); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery') + ->will($this->returnValue($queryResult)); + + $url = $model->getUrl('catalog/product/view', [ + '_fragment' => 'anchor', + '_escape' => 1, + '_query' => $query, + '_nosid' => 0, + 'id' => 100 + ]); + $this->assertEquals($returnUri, $url); + } + + public function testGetUrlIdempotentSetRoutePath() + { + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + ]); + $model->setData('route_path', 'catalog/product/view'); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('catalog/product/view', $model->getUrl('catalog/product/view')); + } + + public function testGetUrlIdempotentSetRouteName() + { + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']), + ]); + $model->setData('route_name', 'catalog'); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/product/view/', $model->getUrl('catalog/product/view')); + } + + public function testGetUrlRouteHasParams() + { + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['foo' => 'bar', 'true' => false])); + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']), + ]); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/index/index/foo/bar/', $model->getUrl('catalog')); + } + + public function testGetUrlRouteUseRewrite() + { + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['foo' => 'bar'])); + $request = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $request->expects($this->once())->method('getAlias')->will($this->returnValue('/catalog/product/view/')); + $model = $this->getUrlModel([ + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'request' => $request, + ]); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + + $this->assertEquals('/catalog/product/view/', $model->getUrl('catalog', ['_use_rewrite' => 1])); + } + + public function getUrlDataProvider() + { + return [ + 'string query' => [ + 'foo=bar', 'foo=bar', 'http://localhost/index.php/catalog/product/view/id/100/?foo=bar#anchor' + ], + 'array query' => [ + ['foo' => 'bar'], 'foo=bar', 'http://localhost/index.php/catalog/product/view/id/100/?foo=bar#anchor' + ], + 'without query' => [false, '', 'http://localhost/index.php/catalog/product/view/id/100/#anchor'], + ]; + } + + public function testGetUrlWithAsterisksPath() + { + $requestMock = $this->getRequestMock([ + 'isDirectAccessFrontendName', + 'getAlias', + 'getRequestedRouteName', + 'getRequestedControllerName', + 'getRequestedActionName', + ]); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->any())->method('getRouteParams') + ->will($this->returnValue(['key' => 'value'])); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + + $requestMock->expects($this->once())->method('getRequestedRouteName')->will($this->returnValue('catalog')); + $requestMock->expects($this->once())->method('getRequestedControllerName')->will($this->returnValue('product')); + $requestMock->expects($this->once())->method('getRequestedActionName')->will($this->returnValue('view')); + $routeConfigMock->expects($this->once())->method('getRouteFrontName')->will($this->returnValue('catalog')); + + $url = $model->getUrl('*/*/*/key/value'); + $this->assertEquals('http://localhost/index.php/catalog/product/view/key/value/', $url); + } + + public function testGetDirectUrl() + { + $requestMock = $this->getRequestMock(['isDirectAccessFrontendName', 'getAlias']); + $routeConfigMock = $this->getMock('Magento\App\Route\ConfigInterface'); + $model = $this->getUrlModel( + ['scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + 'request' => $requestMock, 'routeConfig' => $routeConfigMock] + ); + + $baseUrl = 'http://localhost/index.php/'; + $urlType = \Magento\UrlInterface::URL_TYPE_LINK; + + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->routeParamsResolverMock->expects($this->any())->method('getType')->will($this->returnValue($urlType)); + $requestMock->expects($this->once())->method('isDirectAccessFrontendName')->will($this->returnValue(true)); + + $url = $model->getDirectUrl('direct-url'); + $this->assertEquals('http://localhost/index.php/direct-url', $url); + } + + /** + * @param string $url + * @dataProvider getRebuiltUrlDataProvider + */ + public function testGetRebuiltUrl($url) + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel([ + 'session' => $this->sessionMock, + 'request' => $requestMock, + 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'queryParamsResolver' => $this->queryParamsResolverMock, + ]); + + $this->queryParamsResolverMock->expects($this->once())->method('getQuery') + ->will($this->returnValue('query=123')); + + $this->assertEquals($url, $model->getRebuiltUrl($url)); + } + + public function testGetRedirectUrl() + { + $model = $this->getUrlModel( + ['routeParamsResolver' => $this->getRouteParamsResolver(), 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, 'queryParamsResolver' => $this->queryParamsResolverMock] + ); + + $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->once())->method('getSessionIdForHost')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(true)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery')->will($this->returnValue('foo=bar')); + + $this->assertEquals('http://example.com/?foo=bar', $model->getRedirectUrl('http://example.com/')); + } + + public function testGetRedirectUrlWithSessionId() + { + $model = $this->getUrlModel( + ['routeParamsResolver' => $this->getRouteParamsResolver(), 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, 'queryParamsResolver' => $this->queryParamsResolverMock] + ); + + $this->sidResolverMock->expects($this->once())->method('getUseSessionInUrl')->will($this->returnValue(true)); + $this->sessionMock->expects($this->once())->method('getSessionIdForHost') + ->will($this->returnValue('session-id')); + $this->sidResolverMock->expects($this->once())->method('getUseSessionVar')->will($this->returnValue(false)); + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam'); + $this->queryParamsResolverMock->expects($this->once())->method('getQuery')->will($this->returnValue('foo=bar')); + + $this->assertEquals('http://example.com/?foo=bar', $model->getRedirectUrl('http://example.com/')); + } + + public function getRebuiltUrlDataProvider() + { + return [ + 'with port' => ['https://example.com:88/index.php/catalog/index/view?query=123#hash'], + 'without port' => ['https://example.com/index.php/catalog/index/view?query=123#hash'], + ]; + } + + public function testGetRouteUrlWithValidUrl() + { + $model = $this->getUrlModel(['routeParamsResolver' => $this->getRouteParamsResolver()]); + + $this->routeParamsResolverMock->expects($this->never())->method('unsetData'); + $this->assertEquals('http://example.com', $model->getRouteUrl('http://example.com')); + } + + public function testAddSessionParam() + { + $model = $this->getUrlModel([ + 'session' => $this->sessionMock, + 'sidResolver' => $this->sidResolverMock, + 'queryParamsResolver' => $this->queryParamsResolverMock, + ]); + + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam')->with($this->sessionMock) + ->will($this->returnValue('sid')); + $this->sessionMock->expects($this->once())->method('getSessionId')->will($this->returnValue('session-id')); + $this->queryParamsResolverMock->expects($this->once())->method('setQueryParam')->with('sid', 'session-id'); + + $model->addSessionParam(); + } + + /** + * @param bool $result + * @param string $baseUrl + * @param string $referrer + * @dataProvider isOwnOriginUrlDataProvider + */ + public function testIsOwnOriginUrl($result, $baseUrl, $referrer) + { + $requestMock = $this->getRequestMock(['setServer', 'getServer']); + $model = $this->getUrlModel(['scopeResolver' => $this->scopeResolverMock, 'request' => $requestMock]); + + $this->scopeMock->expects($this->any())->method('getBaseUrl')->will($this->returnValue($baseUrl)); + $this->scopeResolverMock->expects($this->any())->method('getScopes') + ->will($this->returnValue([$this->scopeMock])); + $requestMock->expects($this->once())->method('getServer')->with('HTTP_REFERER') + ->will($this->returnValue($referrer)); + + $this->assertEquals($result, $model->isOwnOriginUrl()); + } + + public function isOwnOriginUrlDataProvider() + { + return [ + 'is origin url' => [true, 'http://localhost/', 'http://localhost/'], + 'is not origin url' => [false, 'http://localhost/', 'http://example.com/'], + ]; + } + + /** + * @param string $urlType + * @param string $configPath + * @param bool $isSecure + * @param int $isSecureCallCount + * @param string $key + * @dataProvider getConfigDataDataProvider + */ + public function testGetConfigData($urlType, $configPath, $isSecure, $isSecureCallCount, $key) + { + $urlSecurityInfoMock = $this->getMock('Magento\Url\SecurityInfoInterface'); + $model = $this->getUrlModel([ + 'urlSecurityInfo' => $urlSecurityInfoMock, + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'scopeResolver' => $this->scopeResolverMock, + ]); + + $this->routeParamsResolverMock->expects($this->at(0))->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(false)); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->scopeMock->expects($this->once())->method('isUrlSecure')->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->at(1))->method('hasData')->with('secure') + ->will($this->returnValue(false)); + $this->routeParamsResolverMock->expects($this->any())->method('getType') + ->will($this->returnValue($urlType)); + $this->routeParamsResolverMock->expects($this->once())->method('getData')->will($this->returnValue($isSecure)); + $this->scopeMock->expects($this->once())->method('getConfig')->with($configPath) + ->will($this->returnValue('http://localhost/')); + $urlSecurityInfoMock->expects($this->exactly($isSecureCallCount))->method('isSecure') + ->will($this->returnValue(false)); + + $this->assertEquals('http://localhost/', $model->getConfigData($key)); + } + + public function getConfigDataDataProvider() + { + return [ + 'secure url' => ['some-type', 'web/secure/base_url_secure', true, 0, 'base_url_secure'], + 'unsecure url' => [ + \Magento\UrlInterface::URL_TYPE_LINK, 'web/unsecure/base_url_unsecure', false, 1, 'base_url_unsecure' + ], + ]; + } + + public function testGetConfigDataWithSecureIsForcedParam() + { + $model = $this->getUrlModel([ + 'routeParamsResolver' => $this->getRouteParamsResolver(), + 'scopeResolver' => $this->scopeResolverMock, + ]); + + $this->routeParamsResolverMock->expects($this->once())->method('hasData')->with('secure_is_forced') + ->will($this->returnValue(true)); + $this->routeParamsResolverMock->expects($this->once())->method('getData')->with('secure') + ->will($this->returnValue(true)); + + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->scopeMock->expects($this->once())->method('getConfig')->with('web/secure/base_url_secure_forced') + ->will($this->returnValue('http://localhost/')); + + $this->assertEquals('http://localhost/', $model->getConfigData('base_url_secure_forced')); + } + + /** + * @param string $html + * @param string $result + * @dataProvider sessionUrlVarWithMatchedHostsAndBaseUrlDataProvider + */ + public function testSessionUrlVarWithMatchedHostsAndBaseUrl($html, $result) + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel( + ['session' => $this->sessionMock, 'request' => $requestMock, 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost')); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://localhost')); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->sidResolverMock->expects($this->never())->method('getSessionIdQueryParam'); + + $this->assertEquals($result, $model->sessionUrlVar($html)); + } + + public function testSessionUrlVarWithoutMatchedHostsAndBaseUrl() + { + $requestMock = $this->getRequestMock(['getHttpHost']); + $model = $this->getUrlModel( + ['session' => $this->sessionMock, 'request' => $requestMock, 'sidResolver' => $this->sidResolverMock, + 'scopeResolver' => $this->scopeResolverMock, 'routeParamsResolver' => $this->getRouteParamsResolver()] + ); + + $requestMock->expects($this->once())->method('getHttpHost')->will($this->returnValue('localhost')); + $this->scopeMock->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://example.com')); + $this->scopeResolverMock->expects($this->any())->method('getScope')->will($this->returnValue($this->scopeMock)); + $this->sidResolverMock->expects($this->once())->method('getSessionIdQueryParam') + ->will($this->returnValue('SID')); + $this->sessionMock->expects($this->once())->method('getSessionId') + ->will($this->returnValue('session-id')); + + $this->assertEquals( + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + $model->sessionUrlVar('<a href="http://example.com/?___SID=U">www.example.com</a>') + ); + } + + public function sessionUrlVarWithMatchedHostsAndBaseUrlDataProvider() + { + return [ + [ + '<a href="http://example.com/?___SID=U?SID=session-id">www.example.com</a>', + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?___SID=U&SID=session-id">www.example.com</a>', + '<a href="http://example.com/?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?foo=bar&___SID=U?SID=session-id">www.example.com</a>', + '<a href="http://example.com/?foo=bar?SID=session-id">www.example.com</a>', + ], + [ + '<a href="http://example.com/?foo=bar&___SID=U&SID=session-id">www.example.com</a>', + '<a href="http://example.com/?foo=bar&SID=session-id">www.example.com</a>', + ], + ]; + } + + public function testSetRequest() + { + $requestMethods = ['getServer', 'getScheme', 'getHttpHost']; + $initRequestMock = $this->getRequestMock($requestMethods); + $requestMock = $this->getRequestMock($requestMethods); + $initRequestMock->expects($this->any())->method('getScheme')->will($this->returnValue('fake')); + $initRequestMock->expects($this->any())->method('getHttpHost')->will($this->returnValue('fake-host')); + $requestMock->expects($this->any())->method('getScheme')->will($this->returnValue('http')); + $requestMock->expects($this->any())->method('getHttpHost')->will($this->returnValue('example.com')); + + $model = $this->getUrlModel(['request' => $initRequestMock]); + $model->setRequest($requestMock); + $this->assertEquals('http://example.com', $model->getCurrentUrl()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php index d4c8add660445e79cd4b86477438e672b049584a..caa8a15dd3b4663d91f1469332a6902b18a22463 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/ErrorProcessorTest.php @@ -33,8 +33,8 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Core\Helper\Data */ protected $_helperMock; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_appStateMock; /** @var \Magento\Logger */ protected $_loggerMock; @@ -46,7 +46,9 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase 'Magento\Core\Helper\Data' )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMockBuilder('Magento\App\State') + ->disableOriginalConstructor() + ->getMock(); $this->_loggerMock = $this->getMockBuilder('Magento\Logger')->disableOriginalConstructor()->getMock(); @@ -55,7 +57,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase /** Initialize SUT. */ $this->_errorProcessor = new \Magento\Webapi\Controller\ErrorProcessor( $this->_helperMock, - $this->_appMock, + $this->_appStateMock, $this->_loggerMock, $filesystemMock ); @@ -67,7 +69,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { unset($this->_errorProcessor); unset($this->_helperMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -115,7 +117,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { $_SERVER['HTTP_ACCEPT'] = 'json'; /** Mock app to return enabled developer mode flag. */ - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); /** Assert that jsonEncode method will be executed once. */ $this->_helperMock->expects( $this->once() @@ -156,7 +158,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase { $_SERVER['HTTP_ACCEPT'] = 'xml'; /** Mock app to return enabled developer mode flag. */ - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); /** Init output buffering to catch output via echo function. */ ob_start(); $this->_errorProcessor->render('Message', 'Trace message.', 401); @@ -187,7 +189,7 @@ class ErrorProcessorTest extends \PHPUnit_Framework_TestCase public function testMaskExceptionInDeveloperMode() { /** Mock app isDeveloperMode to return true. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once())->method('getMode')->will($this->returnValue('developer')); /** Init Logical exception. */ $errorMessage = 'Error Message'; $logicalException = new \LogicException($errorMessage); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php index 2b107f68bcfaa6e1e3d6928de144f6d4f782ec12..66a5c02f57c06ad676818743d8a2597a7febf8b1 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/JsonTest.php @@ -37,23 +37,17 @@ class JsonTest extends \PHPUnit_Framework_TestCase protected $_helperMock; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_appStateMock; protected function setUp() { /** Prepare mocks for SUT constructor. */ - $this->_helperMock = $this->getMockBuilder( - 'Magento\Core\Helper\Data' - )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('isDeveloperMode') - )->disableOriginalConstructor()->getMock(); + $this->_helperMock = $this->getMockBuilder('Magento\Core\Helper\Data')->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Initialize SUT. */ $this->_jsonDeserializer = new \Magento\Webapi\Controller\Rest\Request\Deserializer\Json( $this->_helperMock, - $this->_appMock + $this->_appStateMock ); parent::setUp(); } @@ -62,7 +56,7 @@ class JsonTest extends \PHPUnit_Framework_TestCase { unset($this->_jsonDeserializer); unset($this->_helperMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -99,14 +93,12 @@ class JsonTest extends \PHPUnit_Framework_TestCase public function testDeserializeInvalidEncodedBodyExceptionDeveloperModeOff() { /** Prepare mocks for SUT constructor. */ - $this->_helperMock->expects( - $this->once() - )->method( - 'jsonDecode' - )->will( - $this->throwException(new \Zend_Json_Exception()) - ); - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_helperMock->expects($this->once()) + ->method('jsonDecode') + ->will($this->throwException(new \Zend_Json_Exception)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('production')); /** Initialize SUT. */ $inputInvalidJson = '{"key1":"test1"."key2":"test2"}'; try { @@ -135,7 +127,9 @@ class JsonTest extends \PHPUnit_Framework_TestCase new \Zend_Json_Exception('Decoding error:' . PHP_EOL . 'Decoding failed: Syntax error') ) ); - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('developer')); /** Initialize SUT. */ $inputInvalidJson = '{"key1":"test1"."key2":"test2"}'; try { diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php index d11c8cc738e16c445b9e9fe0d826ce0e5f8312c6..27303edf1a7b1171804c828c9d366500e484b724 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/Request/Deserializer/XmlTest.php @@ -32,21 +32,17 @@ class XmlTest extends \PHPUnit_Framework_TestCase protected $_xmlDeserializer; /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_appMock; + protected $_appStateMock; protected function setUp() { /** Prepare mocks for SUT constructor. */ $this->_xmlParserMock = $this->getMock('Magento\Xml\Parser', array('xmlToArray', 'loadXML')); - $this->_appMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->setMethods( - array('isDeveloperMode') - )->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Initialize SUT. */ $this->_xmlDeserializer = new \Magento\Webapi\Controller\Rest\Request\Deserializer\Xml( $this->_xmlParserMock, - $this->_appMock + $this->_appStateMock ); parent::setUp(); } @@ -55,7 +51,7 @@ class XmlTest extends \PHPUnit_Framework_TestCase { unset($this->_xmlDeserializer); unset($this->_xmlParserMock); - unset($this->_appMock); + unset($this->_appStateMock); parent::tearDown(); } @@ -109,7 +105,9 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testDeserializeMagentoWebapiExceptionDeveloperModeOn() { /** Prepare mocks for SUT constructor. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('developer')); $errorMessage = 'End tag for "key1" was omitted.'; $this->_xmlDeserializer->handleErrors(null, $errorMessage, null, null); $this->_xmlParserMock->expects($this->once())->method('loadXML'); @@ -133,7 +131,9 @@ class XmlTest extends \PHPUnit_Framework_TestCase public function testDeserializeMagentoWebapiExceptionDeveloperModeOff() { /** Prepare mocks for SUT constructor. */ - $this->_appMock->expects($this->once())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_appStateMock->expects($this->once()) + ->method('getMode') + ->will($this->returnValue('production')); $errorMessage = 'End tag for "key1" was omitted.'; $this->_xmlDeserializer->handleErrors(null, $errorMessage, null, null); $this->_xmlParserMock->expects($this->once())->method('loadXML'); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php index f68b278b499222bff344caf0d83ab9a7edc0c614..9794ae8436dc67fc5568ad57b52f044a9ead282e 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Rest/ResponseTest.php @@ -30,8 +30,8 @@ class ResponseTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Controller\Rest\Response */ protected $_responseRest; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** @var \Magento\App\State */ + protected $_appStateMock; /** @var \Magento\Webapi\Controller\Rest\Response\Renderer\Xml */ protected $_rendererMock; @@ -49,16 +49,15 @@ class ResponseTest extends \PHPUnit_Framework_TestCase 'Magento\Webapi\Controller\Rest\Response\Renderer\Factory' )->disableOriginalConstructor()->getMock(); $rendererFactoryMock->expects($this->any())->method('get')->will($this->returnValue($this->_rendererMock)); - $this->_errorProcessorMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\ErrorProcessor' - )->disableOriginalConstructor()->getMock(); - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_errorProcessorMock = $this->getMockBuilder('Magento\Webapi\Controller\ErrorProcessor') + ->disableOriginalConstructor()->getMock(); + $this->_appStateMock = $this->getMock('Magento\App\State', array(), array(), '', false); /** Init SUP. */ $this->_responseRest = new \Magento\Webapi\Controller\Rest\Response( $rendererFactoryMock, $this->_errorProcessorMock, - $this->_appMock + $this->_appStateMock ); $this->_responseRest->headersSentThrowsException = false; parent::setUp(); @@ -67,7 +66,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_responseRest); - unset($this->_appMock); + unset($this->_appStateMock); unset($this->_rendererMock); unset($this->_errorProcessorMock); parent::tearDown(); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php index 46d2a35bfa22abcbd6212a7e3a40fefb7aa56076..041cf7add6b5e3077b60bcb78d0c09c2464a26e5 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php @@ -54,6 +54,16 @@ class RestTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Authz\Service\AuthorizationV1Interface */ protected $_authzServiceMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $areaListMock; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $areaMock; + const SERVICE_METHOD = 'testMethod'; const SERVICE_ID = 'Magento\Webapi\Controller\TestService'; @@ -100,16 +110,16 @@ class RestTest extends \PHPUnit_Framework_TestCase 'Magento\Authz\Service\AuthorizationV1Interface' )->disableOriginalConstructor()->getMock(); - /** @var $applicationMock \Magento\AppInterface */ - $applicationMock = $this->getMockBuilder('Magento\AppInterface')->disableOriginalConstructor()->getMock(); $layoutMock = $this->getMockBuilder('Magento\View\LayoutInterface')->disableOriginalConstructor()->getMock(); - $applicationMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock)); $errorProcessorMock = $this->getMock('Magento\Webapi\Controller\ErrorProcessor', array(), array(), '', false); $errorProcessorMock->expects($this->any())->method('maskException')->will($this->returnArgument(0)); $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); $serializer = $objectManager->getObject('Magento\Webapi\Controller\ServiceArgsSerializer'); + $this->areaListMock = $this->getMock('\Magento\App\AreaList', array(), array(), '', false); + $this->areaMock = $this->getMock('Magento\App\AreaInterface'); + $this->areaListMock->expects($this->any())->method('getArea')->will($this->returnValue($this->areaMock)); /** Init SUT. */ $this->_restController = $objectManager->getObject( @@ -120,10 +130,11 @@ class RestTest extends \PHPUnit_Framework_TestCase 'router' => $this->_routerMock, 'objectManager' => $this->_objectManagerMock, 'appState' => $this->_appStateMock, - 'application' => $applicationMock, + 'layout' => $layoutMock, 'authorizationService' => $this->_authzServiceMock, 'serializer' => $serializer, - 'errorProcessor' => $errorProcessorMock + 'errorProcessor' => $errorProcessorMock, + 'areaList' => $this->areaListMock ) ); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php index afb0a746e20f2bd80818e1eaaca96fcdb201f08f..ee910bac71aa923e9f9369816ca306a8750086bf 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/SoapTest.php @@ -48,9 +48,6 @@ class SoapTest extends \PHPUnit_Framework_TestCase /** @var \Magento\App\State */ protected $_appStateMock; - /** @var \Magento\Core\Model\App */ - protected $_applicationMock; - /** @var \Magento\Oauth\Oauth */ protected $_oauthServiceMock; @@ -66,37 +63,31 @@ class SoapTest extends \PHPUnit_Framework_TestCase { parent::setUp(); - $this->_soapServerMock = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\Server' - )->disableOriginalConstructor()->setMethods( - array('getApiCharset', 'generateUri', 'handle') - )->getMock(); - $this->_wsdlGeneratorMock = $this->getMockBuilder( - 'Magento\Webapi\Model\Soap\Wsdl\Generator' - )->disableOriginalConstructor()->setMethods( - array('generate') - )->getMock(); - $this->_requestMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\Soap\Request' - )->disableOriginalConstructor()->setMethods( - array('getParam', 'getRequestedServices') - )->getMock(); - $this->_responseMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\Response' - )->disableOriginalConstructor()->setMethods( - array('clearHeaders', 'setHeader', 'sendResponse') - )->getMock(); - $this->_errorProcessorMock = $this->getMockBuilder( - 'Magento\Webapi\Controller\ErrorProcessor' - )->disableOriginalConstructor()->setMethods( - array('maskException') - )->getMock(); - $this->_appStateMock = $this->getMockBuilder('Magento\App\State')->disableOriginalConstructor()->getMock(); - $localeMock = $this->getMockBuilder( - 'Magento\Locale' - )->disableOriginalConstructor()->setMethods( - array('getLanguage') - )->getMock(); + $this->_soapServerMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Server') + ->disableOriginalConstructor() + ->setMethods(array('getApiCharset', 'generateUri', 'handle')) + ->getMock(); + $this->_wsdlGeneratorMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Wsdl\Generator') + ->disableOriginalConstructor() + ->setMethods(array('generate')) + ->getMock(); + $this->_requestMock = $this->getMockBuilder('Magento\Webapi\Controller\Soap\Request') + ->disableOriginalConstructor() + ->setMethods(array('getParam', 'getRequestedServices')) + ->getMock(); + $this->_responseMock = $this->getMockBuilder('Magento\Webapi\Controller\Response') + ->disableOriginalConstructor() + ->setMethods(array('clearHeaders', 'setHeader', 'sendResponse')) + ->getMock(); + $this->_errorProcessorMock = $this->getMockBuilder('Magento\Webapi\Controller\ErrorProcessor') + ->disableOriginalConstructor() + ->setMethods(array('maskException')) + ->getMock(); + $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); + $localeMock = $this->getMockBuilder('Magento\Locale') + ->disableOriginalConstructor() + ->setMethods(array('getLanguage')) + ->getMock(); $localeMock->expects($this->any())->method('getLanguage')->will($this->returnValue('en')); $localeResolverMock = $this->getMockBuilder( @@ -106,28 +97,19 @@ class SoapTest extends \PHPUnit_Framework_TestCase )->getMock(); $localeResolverMock->expects($this->any())->method('getLocale')->will($this->returnValue($localeMock)); - $this->_applicationMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->disableOriginalConstructor()->setMethods( - array('getLocale', 'isDeveloperMode') - )->getMock(); + $layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $this->_applicationMock = $this->getMockBuilder( - 'Magento\Core\Model\App' - )->disableOriginalConstructor()->getMock(); - $this->_applicationMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(false)); - $layoutMock = $this->getMockBuilder('Magento\View\LayoutInterface')->disableOriginalConstructor()->getMock(); - $this->_applicationMock->expects($this->once())->method('getLayout')->will($this->returnValue($layoutMock)); - - $this->_oauthServiceMock = $this->getMockBuilder( - 'Magento\Oauth\Oauth' - )->disableOriginalConstructor()->getMock(); + $this->_oauthServiceMock = $this->getMockBuilder('Magento\Oauth\Oauth') + ->disableOriginalConstructor() + ->getMock(); $this->_responseMock->expects($this->any())->method('clearHeaders')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setWSDL')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setEncoding')->will($this->returnSelf()); $this->_soapServerMock->expects($this->any())->method('setReturnResponse')->will($this->returnSelf()); - + $areaListMock = $this->getMock('Magento\App\AreaList', array(), array(), '', false); + $areaMock = $this->getMock('Magento\App\AreaInterface'); + $areaListMock->expects($this->any())->method('getArea')->will($this->returnValue($areaMock)); $this->_soapController = new \Magento\Webapi\Controller\Soap( $this->_requestMock, $this->_responseMock, @@ -135,9 +117,10 @@ class SoapTest extends \PHPUnit_Framework_TestCase $this->_soapServerMock, $this->_errorProcessorMock, $this->_appStateMock, - $this->_applicationMock, + $layoutMock, $this->_oauthServiceMock, - $localeResolverMock + $localeResolverMock, + $areaListMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php index e176e157e15e72cba4ad4380cc3e3950420254c3..2a55c3f49b8cf58a411ad9df1ff2e70c528ceab4 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/FaultTest.php @@ -30,8 +30,10 @@ class FaultTest extends \PHPUnit_Framework_TestCase { const WSDL_URL = 'http://host.com/?wsdl&services=customerV1'; - /** @var \Magento\Core\Model\App */ - protected $_appMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_requestMock; /** @var \Magento\Webapi\Model\Soap\Server */ protected $_soapServerMock; @@ -42,9 +44,14 @@ class FaultTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject*/ protected $_localeResolverMock; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + protected $_appStateMock; + protected function setUp() { - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); + $this->_requestMock = $this->getMock('\Magento\App\RequestInterface'); /** Initialize SUT. */ $message = "Soap fault reason."; $details = array('param1' => 'value1', 'param2' => 2); @@ -71,11 +78,14 @@ class FaultTest extends \PHPUnit_Framework_TestCase $this->returnValue(new \Zend_Locale('en_US')) ); + $this->_appStateMock = $this->getMock('\Magento\App\State', array(), array(), '', false); + $this->_soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_appMock, + $this->_requestMock, $this->_soapServerMock, $webapiException, - $this->_localeResolverMock + $this->_localeResolverMock, + $this->_appStateMock ); parent::setUp(); } @@ -83,13 +93,13 @@ class FaultTest extends \PHPUnit_Framework_TestCase protected function tearDown() { unset($this->_soapFault); - unset($this->_appMock); + unset($this->_requestMock); parent::tearDown(); } public function testToXmlDeveloperModeOff() { - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(false)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('production')); $wsdlUrl = urlencode(self::WSDL_URL); $expectedResult = <<<XML <?xml version="1.0" encoding="utf-8" ?> @@ -132,7 +142,7 @@ XML; public function testToXmlDeveloperModeOn() { - $this->_appMock->expects($this->any())->method('isDeveloperMode')->will($this->returnValue(true)); + $this->_appStateMock->expects($this->any())->method('getMode')->will($this->returnValue('developer')); $actualXml = $this->_soapFault->toXml(true); $this->assertContains('<m:Trace>', $actualXml, 'Exception trace is not found in XML.'); } @@ -225,10 +235,11 @@ XML; $details ); $soapFault = new \Magento\Webapi\Model\Soap\Fault( - $this->_appMock, + $this->_requestMock, $this->_soapServerMock, $webapiException, - $this->_localeResolverMock + $this->_localeResolverMock, + $this->_appStateMock ); $actualXml = $soapFault->toXml(); $wsdlUrl = urlencode(self::WSDL_URL); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php index 4a759036495533a3cc6b73a9e939d6261466f1e6..d1c4c1dcfe3b0cbd23a027b766fcf812fe99779a 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ServerTest.php @@ -30,9 +30,6 @@ class ServerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Webapi\Model\Soap\Server */ protected $_soapServer; - /** @var \Magento\Core\Model\App */ - protected $_appMock; - /** @var \Magento\Core\Model\Store */ protected $_storeMock; diff --git a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php index db97c1b17721f385d866456083253b5b2ef4df76..d86b1a604c7b7a77c125312357fb83c7c072464d 100644 --- a/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php +++ b/dev/tests/unit/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php @@ -30,10 +30,19 @@ class SidebarTest extends \PHPUnit_Framework_TestCase */ protected $block; + /** + * @var \Magento\Wishlist\Helper\Data | \PHPUnit_Framework_MockObject_MockObject + */ + protected $wishlistHelper; + protected function setUp() { $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->block = $objectManager->getObject('Magento\Wishlist\Block\Customer\Sidebar'); + $this->wishlistHelper = $this->getMock('Magento\Wishlist\Helper\Data', ['getItemCount'], [], '', false); + $this->block = $objectManager->getObject( + 'Magento\Wishlist\Block\Customer\Sidebar', + ['wishlistHelper' => $this->wishlistHelper] + ); } protected function tearDown() @@ -41,17 +50,19 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $this->block = null; } - public function testGetIdentities() + public function testGetIdentitiesItemsPresent() { - $productTags = array('catalog_product_1'); + $productTags = ['catalog_product_1']; + + $this->wishlistHelper->expects($this->once())->method('getItemCount')->will($this->returnValue(5)); - $product = $this->getMock('Magento\Catalog\Model\Product', array(), array(), '', false); + $product = $this->getMock('Magento\Catalog\Model\Product', [], [], '', false); $product->expects($this->once())->method('getIdentities')->will($this->returnValue($productTags)); $item = $this->getMock( 'Magento\Sales\Model\Resource\Order\Item', - array('getProduct', '__wakeup'), - array(), + ['getProduct', '__wakeup'], + [], '', false ); @@ -59,7 +70,16 @@ class SidebarTest extends \PHPUnit_Framework_TestCase $collection = new \ReflectionProperty('Magento\Wishlist\Block\Customer\Sidebar', '_collection'); $collection->setAccessible(true); - $collection->setValue($this->block, array($item)); + $collection->setValue($this->block, [$item]); + + $this->assertEquals($productTags, $this->block->getIdentities()); + } + + public function testGetIdentitiesNoItems() + { + $productTags = []; + + $this->wishlistHelper->expects($this->once())->method('getItemCount')->will($this->returnValue(0)); $this->assertEquals($productTags, $this->block->getIdentities()); } diff --git a/downloader/app/Magento/Downloader/Controller.php b/downloader/app/Magento/Downloader/Controller.php index aeebd46d7c896c4e9779b7c7296dd59773a04f88..915385ad150e4fd03d318357e88c1916878ba280 100644 --- a/downloader/app/Magento/Downloader/Controller.php +++ b/downloader/app/Magento/Downloader/Controller.php @@ -536,7 +536,6 @@ final class Controller \Magento\App\ObjectManager::getInstance()->get('Magento\App\State')->setIsDownloader(); } - \Magento\App\ObjectManager::getInstance()->get('Magento\Core\Model\App'); if (self::isInstalled()) { \Mage::getSingleton('Magento\Backend\Model\UrlInterface')->turnOffSecretKey(); } diff --git a/app/code/Magento/Reports/Model/Resource/HelperFactory.php b/lib/Magento/App/AreaInterface.php similarity index 77% rename from app/code/Magento/Reports/Model/Resource/HelperFactory.php rename to lib/Magento/App/AreaInterface.php index 014f63373181340f2661a8374a2287e3dcef642f..c766ec39fc7db060e83ab919f360b661181f6ea7 100644 --- a/app/code/Magento/Reports/Model/Resource/HelperFactory.php +++ b/lib/Magento/App/AreaInterface.php @@ -1,6 +1,5 @@ <?php /** - * Resource helper factory * * Magento * @@ -23,14 +22,19 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Reports\Model\Resource; +namespace Magento\App; -class HelperFactory extends \Magento\Core\Model\Resource\HelperFactory +interface AreaInterface { + const PART_CONFIG = 'config'; + const PART_TRANSLATE = 'translate'; + const PART_DESIGN = 'design'; + /** - * Module Name + * Load area part * - * @var string + * @param string $partName + * @return $this */ - protected $_moduleName = 'Magento_Reports'; + public function load($partName = null); } diff --git a/lib/Magento/App/AreaList.php b/lib/Magento/App/AreaList.php index 4230985672a7100071f711e99b496d8d73c8bc57..26a63f3b69c379e9d96795549d39d31d890d8879 100644 --- a/lib/Magento/App/AreaList.php +++ b/lib/Magento/App/AreaList.php @@ -34,6 +34,11 @@ class AreaList */ protected $_areas; + /** + * @var \Magento\App\AreaInterface[] + */ + protected $_areaInstances = array(); + /** * @var string */ @@ -45,12 +50,23 @@ class AreaList protected $_resolverFactory; /** + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * @param \Magento\ObjectManager $objectManager * @param Area\FrontNameResolverFactory $resolverFactory * @param array $areas * @param string $default */ - public function __construct(Area\FrontNameResolverFactory $resolverFactory, array $areas, $default) - { + public function __construct( + \Magento\ObjectManager $objectManager, + Area\FrontNameResolverFactory $resolverFactory, + array $areas, + $default + ) { + $this->objectManager = $objectManager; $this->_resolverFactory = $resolverFactory; $this->_areas = $areas; $this->_defaultAreaCode = $default; @@ -108,4 +124,21 @@ class AreaList { return isset($this->_areas[$areaCode]['router']) ? $this->_areas[$areaCode]['router'] : null; } + + /** + * Retrieve application area + * + * @param string $code + * @return \Magento\Core\Model\App\Area + */ + public function getArea($code) + { + if (!isset($this->_areaInstances[$code])) { + $this->_areaInstances[$code] = $this->objectManager->create( + 'Magento\App\AreaInterface', + array('areaCode' => $code) + ); + } + return $this->_areaInstances[$code]; + } } diff --git a/lib/Magento/App/Cache/Frontend/Factory.php b/lib/Magento/App/Cache/Frontend/Factory.php index 34c7c319b682cb04bf69066dc6916391bf242337..5b8e138fa9ffa3619b6e96035a51a13d3e636151 100644 --- a/lib/Magento/App/Cache/Frontend/Factory.php +++ b/lib/Magento/App/Cache/Frontend/Factory.php @@ -33,6 +33,10 @@ class Factory * Default cache entry lifetime */ const DEFAULT_LIFETIME = 7200; + /** + * Caching params, that applied for all cache frontends regardless of type + */ + const PARAM_CACHE_FORCED_OPTIONS = 'cache_options'; /** * @var \Magento\ObjectManager diff --git a/lib/Magento/App/Cache/State.php b/lib/Magento/App/Cache/State.php index e00edbdf6df35f7fb7747bd62be96e4de86299f8..795a53c001eaa11e412e327530bb2c211f94f151 100644 --- a/lib/Magento/App/Cache/State.php +++ b/lib/Magento/App/Cache/State.php @@ -30,7 +30,12 @@ class State implements StateInterface /** * Cache identifier used to store cache type statuses */ - const CACHE_ID = 'core_cache_options'; + const CACHE_ID = 'core_cache_options'; + + /** + * Disallow cache + */ + const PARAM_BAN_CACHE = 'global_ban_use_cache'; /** * Persistent storage of cache type statuses diff --git a/lib/Magento/App/Cron.php b/lib/Magento/App/Cron.php index 7b9281bbea93d2c0a3efe968fe5402358b1e0ab6..9883a71e17fbf0c3bd8241e2e54d1cbc42dd31b2 100644 --- a/lib/Magento/App/Cron.php +++ b/lib/Magento/App/Cron.php @@ -28,7 +28,7 @@ namespace Magento\App; use Magento\App\ObjectManager\ConfigLoader; use Magento\Event\ManagerInterface; -class Cron implements \Magento\LauncherInterface +class Cron implements \Magento\AppInterface { /** * @var \Magento\Event\ManagerInterface diff --git a/lib/Magento/App/Helper/AbstractHelper.php b/lib/Magento/App/Helper/AbstractHelper.php index 90fb579bad2fb9d7aec8a6bfdce2f732edd6d831..1404b471136e573f8093577096e0120a97d981f2 100644 --- a/lib/Magento/App/Helper/AbstractHelper.php +++ b/lib/Magento/App/Helper/AbstractHelper.php @@ -45,11 +45,9 @@ abstract class AbstractHelper protected $_request; /** - * Translator model - * - * @var \Magento\TranslateInterface + * @var \Magento\Translate\InlineInterface */ - protected $_inlineFactory; + protected $translateInline; /** * @var \Magento\Module\Manager @@ -88,7 +86,7 @@ abstract class AbstractHelper */ public function __construct(Context $context) { - $this->_inlineFactory = $context->getInlineFactory(); + $this->translateInline = $context->getTranslateInline(); $this->_moduleManager = $context->getModuleManager(); $this->_logger = $context->getLogger(); $this->_request = $context->getRequest(); diff --git a/lib/Magento/App/Helper/Context.php b/lib/Magento/App/Helper/Context.php index 3e73af0dd14c8860c3fdb4510db7da042e4201c3..4e3a97e2dbad9f98be31841bddf94300fc517b00 100644 --- a/lib/Magento/App/Helper/Context.php +++ b/lib/Magento/App/Helper/Context.php @@ -28,9 +28,9 @@ namespace Magento\App\Helper; class Context implements \Magento\ObjectManager\ContextInterface { /** - * @var \Magento\TranslateInterface + * @var \Magento\Translate\InlineInterface */ - protected $_inlineFactory; + protected $translateInline; /** * @var \Magento\Module\Manager @@ -74,7 +74,7 @@ class Context implements \Magento\ObjectManager\ContextInterface /** * @param \Magento\Logger $logger - * @param \Magento\Translate\InlineFactory $inlineFactory + * @param \Magento\Translate\InlineInterface $translateInline * @param \Magento\Module\Manager $moduleManager * @param \Magento\App\RequestInterface $httpRequest * @param \Magento\Cache\ConfigInterface $cacheConfig @@ -87,7 +87,7 @@ class Context implements \Magento\ObjectManager\ContextInterface */ public function __construct( \Magento\Logger $logger, - \Magento\Translate\InlineFactory $inlineFactory, + \Magento\Translate\InlineInterface $translateInline, \Magento\Module\Manager $moduleManager, \Magento\App\RequestInterface $httpRequest, \Magento\Cache\ConfigInterface $cacheConfig, @@ -96,7 +96,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\HTTP\Header $httpHeader, \Magento\HTTP\PhpEnvironment\RemoteAddress $remoteAddress ) { - $this->_inlineFactory = $inlineFactory; + $this->translateInline = $translateInline; $this->_moduleManager = $moduleManager; $this->_httpRequest = $httpRequest; $this->_cacheConfig = $cacheConfig; @@ -108,11 +108,11 @@ class Context implements \Magento\ObjectManager\ContextInterface } /** - * @return \Magento\Translate\InlineFactory + * @return \Magento\Translate\InlineInterface */ - public function getInlineFactory() + public function getTranslateInline() { - return $this->_inlineFactory; + return $this->translateInline; } /** diff --git a/lib/Magento/App/Http.php b/lib/Magento/App/Http.php index 9ae9e08fccc5d434dda961287f3d1e8f53bf44a1..40e9c971504c7be2a2af7e8cf58e65d53c226f6f 100644 --- a/lib/Magento/App/Http.php +++ b/lib/Magento/App/Http.php @@ -33,7 +33,7 @@ use Magento\Event; /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Http implements \Magento\LauncherInterface +class Http implements \Magento\AppInterface { /** * @var \Magento\ObjectManager diff --git a/lib/Magento/AppInterface.php b/lib/Magento/AppInterface.php index ea9c71c57fa9a8b6aafaf24f24b69bcdb7911ecd..8bf3f0de2937000242ba3effeee83c8ca4bf6eb5 100644 --- a/lib/Magento/AppInterface.php +++ b/lib/Magento/AppInterface.php @@ -33,163 +33,14 @@ interface AppInterface const DISTRO_LOCALE_CODE = 'en_US'; /** - * Throw an exception, if the application has not been installed yet - * - * @return void - * @throws \Magento\Exception - */ - public function requireInstalledInstance(); - - /** - * Retrieve cookie object - * - * @return \Magento\Stdlib\Cookie - */ - public function getCookie(); - - /** - * Re-declare custom error handler - * - * @param string $handler - * @return \Magento\AppInterface - */ - public function setErrorHandler($handler); - - /** - * Loading part of area data - * - * @param string $area - * @param string $part - * @return \Magento\AppInterface - */ - public function loadAreaPart($area, $part); - - /** - * Retrieve application area - * - * @param string $code - * @return \Magento\Core\Model\App\Area + * Magento version */ - public function getArea($code); + const VERSION = '2.0.0.0-dev71'; /** - * Get distributive locale code - * - * @return string - */ - public function getDistroLocaleCode(); - - /** - * Retrieve layout object - * - * @return \Magento\View\LayoutInterface - */ - public function getLayout(); - - /** - * Retrieve application base currency code - * - * @return string - */ - public function getBaseCurrencyCode(); - - /** - * Retrieve configuration object - * - * @return \Magento\App\ConfigInterface - */ - public function getConfig(); - - /** - * Get core cache model - * - * @return \Magento\App\CacheInterface - */ - public function getCacheInstance(); - - /** - * Retrieve cache object - * - * @return \Zend_Cache_Core - */ - public function getCache(); - - /** - * Loading cache data - * - * @param string $cacheId - * @return mixed - */ - public function loadCache($cacheId); - - /** - * Saving cache data - * - * @param mixed $data - * @param string $cacheId - * @param array $tags - * @param bool $lifeTime - * @return \Magento\AppInterface - */ - public function saveCache($data, $cacheId, $tags = array(), $lifeTime = false); - - /** - * Remove cache - * - * @param string $cacheId - * @return \Magento\AppInterface - */ - public function removeCache($cacheId); - - /** - * Cleaning cache - * - * @param array $tags - * @return \Magento\AppInterface - */ - public function cleanCache($tags = array()); - - /** - * Deletes all session files - * - * @return \Magento\AppInterface - */ - public function cleanAllSessions(); - - /** - * Retrieve request object - * - * @return \Magento\App\RequestInterface - */ - public function getRequest(); - - /** - * Request setter - * - * @param \Magento\App\RequestInterface $request - * @return \Magento\AppInterface - */ - public function setRequest(\Magento\App\RequestInterface $request); - - /** - * Retrieve response object + * Launch application * * @return \Magento\App\ResponseInterface */ - public function getResponse(); - - /** - * Response setter - * - * @param \Magento\App\ResponseInterface $response - * @return \Magento\AppInterface - */ - public function setResponse(\Magento\App\ResponseInterface $response); - - /** - * Check if developer mode is enabled. - * - * @return bool - */ - public function isDeveloperMode(); + public function launch(); } diff --git a/lib/Magento/Convert/Container/AbstractContainer.php b/lib/Magento/Convert/Container/AbstractContainer.php deleted file mode 100644 index 6e32462a68187a730cdec29513a00d3c05f05b6b..0000000000000000000000000000000000000000 --- a/lib/Magento/Convert/Container/AbstractContainer.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Convert\Container; - -use Magento\Convert\ConvertException; - -/** - * Convert container abstract - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -abstract class AbstractContainer -{ - /** - * @var array - */ - protected $_vars; - - /** - * @var array - */ - protected $_data; - - /** - * @var int - */ - protected $_position; - - /** - * @param string $key - * @param string|null $default - * @return string - */ - public function getVar($key, $default = null) - { - if (!isset($this->_vars[$key])) { - return $default; - } - return $this->_vars[$key]; - } - - /** - * @return array - */ - public function getVars() - { - return $this->_vars; - } - - /** - * @param array|string $key - * @param string|null $value - * @return $this - */ - public function setVar($key, $value = null) - { - if (is_array($key) && is_null($value)) { - $this->_vars = $key; - } else { - $this->_vars[$key] = $value; - } - return $this; - } - - /** - * @return array - */ - public function getData() - { - return $this->_data; - } - - /** - * @param array $data - * @return $this - */ - public function setData($data) - { - $this->_data = $data; - return $this; - } - - /** - * @param string|null $data - * @return true - */ - public function validateDataString($data = null) - { - if (is_null($data)) { - $data = $this->getData(); - } - if (!is_string($data)) { - $this->addException("Invalid data type, expecting string.", ConvertException::FATAL); - } - return true; - } - - /** - * @param array|null $data - * @return true - */ - public function validateDataGrid($data = null) - { - if (is_null($data)) { - $data = $this->getData(); - } - if (!is_array($data) || !is_array(current($data))) { - if (count($data) == 0) { - return true; - } - $this->addException("Invalid data type, expecting 2D grid array.", ConvertException::FATAL); - } - return true; - } - - /** - * @param array $grid - * @return array - */ - public function getGridFields($grid) - { - $fields = array(); - foreach ($grid as $row) { - foreach (array_keys($row) as $fieldName) { - if (!in_array($fieldName, $fields)) { - $fields[] = $fieldName; - } - } - } - return $fields; - } - - /** - * @param string $error - * @param string|null $level - * @return ConvertException - */ - public function addException($error, $level = null) - { - $exception = new ConvertException($error); - $exception->setLevel(!is_null($level) ? $level : ConvertException::NOTICE); - $exception->setContainer($this); - $exception->setPosition($this->getPosition()); - - return $exception; - } - - /** - * @return int - */ - public function getPosition() - { - return $this->_position; - } - - /** - * @param int $position - * @return $this - */ - public function setPosition($position) - { - $this->_position = $position; - return $this; - } -} diff --git a/lib/Magento/Convert/ConvertException.php b/lib/Magento/Convert/ConvertException.php deleted file mode 100644 index 4c6a93b3a8caf7e817daf61696bf3ef6ed435a41..0000000000000000000000000000000000000000 --- a/lib/Magento/Convert/ConvertException.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Convert; - -use Magento\Convert\Container\AbstractContainer; -use Magento\Exception; - -/** - * Convert exception - */ -class ConvertException extends Exception -{ - const NOTICE = 'NOTICE'; - - const WARNING = 'WARNING'; - - const ERROR = 'ERROR'; - - const FATAL = 'FATAL'; - - /** - * @var AbstractContainer - */ - protected $_container; - - /** - * @var string - */ - protected $_level; - - /** - * @var int - */ - protected $_position; - - /** - * @param AbstractContainer $container - * @return $this - */ - public function setContainer($container) - { - $this->_container = $container; - return $this; - } - - /** - * @return AbstractContainer - */ - public function getContainer() - { - return $this->_container; - } - - /** - * @return string - */ - public function getLevel() - { - return $this->_level; - } - - /** - * @param string $level - * @return $this - */ - public function setLevel($level) - { - $this->_level = $level; - return $this; - } - - /** - * @return int - */ - public function getPosition() - { - return $this->_position; - } - - /** - * @param int $position - * @return $this - */ - public function setPosition($position) - { - $this->_position = $position; - return $this; - } -} diff --git a/lib/Magento/Convert/Mapper/Column.php b/lib/Magento/Convert/Mapper/Column.php deleted file mode 100644 index f95122a1362c8e78964278bb4ecc2f296fb117bd..0000000000000000000000000000000000000000 --- a/lib/Magento/Convert/Mapper/Column.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Convert column mapper - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Convert\Mapper; - -use Magento\Convert\Container\AbstractContainer; - -class Column extends AbstractContainer implements MapperInterface -{ - /** - * @return $this - */ - public function map() - { - $data = $this->getData(); - $this->validateDataGrid($data); - if ($this->getVars() && is_array($this->getVars())) { - $attributesToSelect = $this->getVars(); - } else { - $attributesToSelect = array(); - } - $onlySpecified = (bool)$this->getVar('_only_specified') === true; - $mappedData = array(); - foreach ($data as $i => $row) { - $newRow = array(); - foreach ($row as $field => $value) { - if (!$onlySpecified || $onlySpecified && isset($attributesToSelect[$field])) { - $newRow[$this->getVar($field, $field)] = $value; - } - } - $mappedData[$i] = $newRow; - } - $this->setData($mappedData); - return $this; - } -} diff --git a/lib/Magento/Convert/Mapper/MapperInterface.php b/lib/Magento/Convert/Mapper/MapperInterface.php deleted file mode 100644 index 3db75aece8bea5fa21ea8bb2b6887f4f53e94515..0000000000000000000000000000000000000000 --- a/lib/Magento/Convert/Mapper/MapperInterface.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Convert - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - - -/** - * Convert mapper interface - * - * @category Magento - * @package Magento_Convert - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Convert\Mapper; - -interface MapperInterface -{ - /** - * @return $this - */ - public function map(); -} diff --git a/lib/Magento/DB/Adapter/Pdo/Mysql.php b/lib/Magento/DB/Adapter/Pdo/Mysql.php index b6f9a3b5337ca3dadd601fe60b330f26fa391149..198f00ec0d9dbabfac00e35746b59bb68e1dd478 100644 --- a/lib/Magento/DB/Adapter/Pdo/Mysql.php +++ b/lib/Magento/DB/Adapter/Pdo/Mysql.php @@ -29,7 +29,7 @@ use Magento\App\Filesystem; use Magento\Cache\FrontendInterface; use Magento\DB\Adapter\AdapterInterface; use Magento\DB\Ddl\Table; -use Magento\DB\Helper; +use Magento\DB\ExpressionConverter; use Magento\DB\Profiler; use Magento\DB\Select; use Magento\DB\Statement\Parameter; @@ -3282,7 +3282,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface { $prefix = 't_'; if (strlen($tableName) > self::LENGTH_TABLE_NAME) { - $shortName = Helper::shortName($tableName); + $shortName = ExpressionConverter::shortName($tableName); if (strlen($shortName) > self::LENGTH_TABLE_NAME) { $hash = md5($tableName); if (strlen($prefix.$hash) > self::LENGTH_TABLE_NAME) { @@ -3331,7 +3331,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $hash = $tableName . '_' . $fields; if (strlen($hash) + strlen($prefix) > self::LENGTH_INDEX_NAME) { - $short = Helper::shortName($prefix . $hash); + $short = ExpressionConverter::shortName($prefix . $hash); if (strlen($short) > self::LENGTH_INDEX_NAME) { $hash = md5($hash); if (strlen($hash) + strlen($shortPrefix) > self::LENGTH_INDEX_NAME) { @@ -3362,7 +3362,7 @@ class Mysql extends \Zend_Db_Adapter_Pdo_Mysql implements AdapterInterface $prefix = 'fk_'; $hash = sprintf('%s_%s_%s_%s', $priTableName, $priColumnName, $refTableName, $refColumnName); if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) { - $short = Helper::shortName($prefix.$hash); + $short = ExpressionConverter::shortName($prefix . $hash); if (strlen($short) > self::LENGTH_FOREIGN_NAME) { $hash = md5($hash); if (strlen($prefix.$hash) > self::LENGTH_FOREIGN_NAME) { diff --git a/lib/Magento/DB/ExpressionConverter.php b/lib/Magento/DB/ExpressionConverter.php new file mode 100644 index 0000000000000000000000000000000000000000..9eae86917129c409e47ba1f6c73a68cb7313ff75 --- /dev/null +++ b/lib/Magento/DB/ExpressionConverter.php @@ -0,0 +1,104 @@ +<?php +/** + * DB expression converter + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\DB; + +class ExpressionConverter +{ + /** + * Dictionary for generate short name + * + * @var array + */ + protected static $_translateMap = array( + 'address' => 'addr', + 'admin' => 'adm', + 'attribute' => 'attr', + 'enterprise' => 'ent', + 'catalog' => 'cat', + 'category' => 'ctgr', + 'customer' => 'cstr', + 'notification' => 'ntfc', + 'product' => 'prd', + 'session' => 'sess', + 'user' => 'usr', + 'entity' => 'entt', + 'datetime' => 'dtime', + 'decimal' => 'dec', + 'varchar' => 'vchr', + 'index' => 'idx', + 'compare' => 'cmp', + 'bundle' => 'bndl', + 'option' => 'opt', + 'gallery' => 'glr', + 'media' => 'mda', + 'value' => 'val', + 'link' => 'lnk', + 'title' => 'ttl', + 'super' => 'spr', + 'label' => 'lbl', + 'website' => 'ws', + 'aggregat' => 'aggr', + 'minimal' => 'min', + 'inventory' => 'inv', + 'status' => 'sts', + 'agreement' => 'agrt', + 'layout' => 'lyt', + 'resource' => 'res', + 'directory' => 'dir', + 'downloadable' => 'dl', + 'element' => 'elm', + 'fieldset' => 'fset', + 'checkout' => 'chkt', + 'newsletter' => 'nlttr', + 'shipping' => 'shpp', + 'calculation' => 'calc', + 'search' => 'srch', + 'query' => 'qr' + ); + + /** + * Convert name using dictionary + * + * @param string $name + * @return string + */ + public static function shortName($name) + { + return strtr($name, self::$_translateMap); + } + + /** + * Add or replace translate to dictionary + * + * @param string $from + * @param string $to + * @return void + */ + public static function addTranslate($from, $to) + { + self::$_translateMap[$from] = $to; + } +} diff --git a/lib/Magento/DB/Helper.php b/lib/Magento/DB/Helper.php index 420e00fe4751ab466f5e727a2fcccb075fcd7d00..acef42054b34f6494271a7db088e933f5934122b 100644 --- a/lib/Magento/DB/Helper.php +++ b/lib/Magento/DB/Helper.php @@ -1,5 +1,7 @@ <?php /** + * DB helper class for MySql Magento DB Adapter + * * Magento * * NOTICE OF LICENSE @@ -18,96 +20,291 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_DB * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - -/** - * Magento Db Helper - * - * @category Magento - * @package Magento_DB - * @author Magento Core Team <core@magentocommerce.com> - */ namespace Magento\DB; -class Helper +class Helper extends \Magento\DB\Helper\AbstractHelper { /** - * Dictionary for generate short name + * Returns array of quoted orders with direction * - * @var array + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array */ - protected static $_translateMap = array( - 'address' => 'addr', - 'admin' => 'adm', - 'attribute' => 'attr', - 'enterprise' => 'ent', - 'catalog' => 'cat', - 'category' => 'ctgr', - 'customer' => 'cstr', - 'notification' => 'ntfc', - 'product' => 'prd', - 'session' => 'sess', - 'user' => 'usr', - 'entity' => 'entt', - 'datetime' => 'dtime', - 'decimal' => 'dec', - 'varchar' => 'vchr', - 'index' => 'idx', - 'compare' => 'cmp', - 'bundle' => 'bndl', - 'option' => 'opt', - 'gallery' => 'glr', - 'media' => 'mda', - 'value' => 'val', - 'link' => 'lnk', - 'title' => 'ttl', - 'super' => 'spr', - 'label' => 'lbl', - 'website' => 'ws', - 'aggregat' => 'aggr', - 'minimal' => 'min', - 'inventory' => 'inv', - 'status' => 'sts', - 'agreement' => 'agrt', - 'layout' => 'lyt', - 'resource' => 'res', - 'directory' => 'dir', - 'downloadable' => 'dl', - 'element' => 'elm', - 'fieldset' => 'fset', - 'checkout' => 'chkt', - 'newsletter' => 'nlttr', - 'shipping' => 'shpp', - 'calculation' => 'calc', - 'search' => 'srch', - 'query' => 'qr' - ); + protected function _prepareOrder(\Magento\DB\Select $select, $autoReset = false) + { + $selectOrders = $select->getPart(\Zend_Db_Select::ORDER); + if (!$selectOrders) { + return array(); + } + + $orders = array(); + foreach ($selectOrders as $term) { + if (is_array($term)) { + if (!is_numeric($term[0])) { + $orders[] = sprintf('%s %s', $this->_getReadAdapter()->quoteIdentifier($term[0], true), $term[1]); + } + } else { + if (!is_numeric($term)) { + $orders[] = $this->_getReadAdapter()->quoteIdentifier($term, true); + } + } + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::ORDER); + } + + return $orders; + } /** - * Convert name using dictionary + * Truncate alias name from field. * - * @param string $name + * Result string depends from second optional argument $reverse + * which can be true if you need the first part of the field. + * Field can be with 'dot' delimiter. + * + * @param string $field + * @param bool $reverse OPTIONAL * @return string */ - public static function shortName($name) + protected function _truncateAliasName($field, $reverse = false) { - return strtr($name, self::$_translateMap); + $string = $field; + if (!is_numeric($field) && (strpos($field, '.') !== false)) { + $size = strpos($field, '.'); + if ($reverse) { + $string = substr($field, 0, $size); + } else { + $string = substr($field, $size + 1); + } + } + + return $string; } /** - * Add or replace translate to dictionary + * Returns quoted group by fields + * + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array + */ + protected function _prepareGroup(\Magento\DB\Select $select, $autoReset = false) + { + $selectGroups = $select->getPart(\Zend_Db_Select::GROUP); + if (!$selectGroups) { + return array(); + } + + $groups = array(); + foreach ($selectGroups as $term) { + $groups[] = $this->_getReadAdapter()->quoteIdentifier($term, true); + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::GROUP); + } + + return $groups; + } + + /** + * Prepare and returns having array + * + * @param \Magento\DB\Select $select + * @param bool $autoReset + * @return array + * @throws \Zend_Db_Exception + */ + protected function _prepareHaving(\Magento\DB\Select $select, $autoReset = false) + { + $selectHavings = $select->getPart(\Zend_Db_Select::HAVING); + if (!$selectHavings) { + return array(); + } + + $havings = array(); + $columns = $select->getPart(\Zend_Db_Select::COLUMNS); + foreach ($columns as $columnEntry) { + $correlationName = (string)$columnEntry[1]; + $column = $columnEntry[2]; + foreach ($selectHavings as $having) { + /** + * Looking for column expression in the having clause + */ + if (strpos($having, $correlationName) !== false) { + if (is_string($column)) { + /** + * Replace column expression to column alias in having clause + */ + $havings[] = str_replace($correlationName, $column, $having); + } else { + throw new \Zend_Db_Exception( + sprintf("Can't prepare expression without column alias: '%s'", $correlationName) + ); + } + } + } + } + + if ($autoReset) { + $select->reset(\Zend_Db_Select::HAVING); + } + + return $havings; + } + + /** + * + * @param string $query + * @param int $limitCount + * @param int $limitOffset + * @param array $columnList + * @return string + */ + protected function _assembleLimit($query, $limitCount, $limitOffset, $columnList = array()) + { + if ($limitCount !== null) { + $limitCount = intval($limitCount); + if ($limitCount <= 0) { + //throw new \Exception("LIMIT argument count={$limitCount} is not valid"); + } + + $limitOffset = intval($limitOffset); + if ($limitOffset < 0) { + //throw new \Exception("LIMIT argument offset={$limitOffset} is not valid"); + } + + if ($limitOffset + $limitCount != $limitOffset + 1) { + $columns = array(); + foreach ($columnList as $columnEntry) { + $columns[] = $columnEntry[2] ? $columnEntry[2] : $columnEntry[1]; + } + $query = sprintf('%s LIMIT %s, %s', $query, $limitCount, $limitOffset); + } + } + + return $query; + } + + /** + * Prepare select column list + * + * @param \Magento\DB\Select $select + * @param string|null $groupByCondition OPTIONAL + * @return mixed|array + * @throws \Zend_Db_Exception + */ + public function prepareColumnsList(\Magento\DB\Select $select, $groupByCondition = null) + { + if (!count($select->getPart(\Zend_Db_Select::FROM))) { + return $select->getPart(\Zend_Db_Select::COLUMNS); + } + + $columns = $select->getPart(\Zend_Db_Select::COLUMNS); + $tables = $select->getPart(\Zend_Db_Select::FROM); + $preparedColumns = array(); + + foreach ($columns as $columnEntry) { + list($correlationName, $column, $alias) = $columnEntry; + if ($column instanceof \Zend_Db_Expr) { + if ($alias !== null) { + if (preg_match('/(^|[^a-zA-Z_])^(SELECT)?(SUM|MIN|MAX|AVG|COUNT)\s*\(/i', $column)) { + $column = new \Zend_Db_Expr($column); + } + $preparedColumns[strtoupper($alias)] = array(null, $column, $alias); + } else { + throw new \Zend_Db_Exception("Can't prepare expression without alias"); + } + } else { + if ($column == \Zend_Db_Select::SQL_WILDCARD) { + if ($tables[$correlationName]['tableName'] instanceof \Zend_Db_Expr) { + throw new \Zend_Db_Exception( + "Can't prepare expression when tableName is instance of \Zend_Db_Expr" + ); + } + $tableColumns = $this->_getReadAdapter()->describeTable($tables[$correlationName]['tableName']); + foreach (array_keys($tableColumns) as $col) { + $preparedColumns[strtoupper($col)] = array($correlationName, $col, null); + } + } else { + $columnKey = is_null($alias) ? $column : $alias; + $preparedColumns[strtoupper($columnKey)] = array($correlationName, $column, $alias); + } + } + } + + return $preparedColumns; + } + + /** + * Add prepared column group_concat expression + * + * @param \Magento\DB\Select $select + * @param string $fieldAlias Field alias which will be added with column group_concat expression + * @param string $fields + * @param string $groupConcatDelimiter + * @param string $fieldsDelimiter + * @param string $additionalWhere + * @return \Magento\DB\Select + */ + public function addGroupConcatColumn( + $select, + $fieldAlias, + $fields, + $groupConcatDelimiter = ',', + $fieldsDelimiter = '', + $additionalWhere = '' + ) { + if (is_array($fields)) { + $fieldExpr = $this->_getReadAdapter()->getConcatSql($fields, $fieldsDelimiter); + } else { + $fieldExpr = $fields; + } + if ($additionalWhere) { + $fieldExpr = $this->_getReadAdapter()->getCheckSql($additionalWhere, $fieldExpr, "''"); + } + $separator = ''; + if ($groupConcatDelimiter) { + $separator = sprintf(" SEPARATOR '%s'", $groupConcatDelimiter); + } + $select->columns(array($fieldAlias => new \Zend_Db_Expr(sprintf('GROUP_CONCAT(%s%s)', $fieldExpr, $separator)))); + return $select; + } + + /** + * Returns expression of days passed from $startDate to $endDate + * + * @param string|\Zend_Db_Expr $startDate + * @param string|\Zend_Db_Expr $endDate + * @return \Zend_Db_Expr + */ + public function getDateDiff($startDate, $endDate) + { + $dateDiff = '(TO_DAYS(' . $endDate . ') - TO_DAYS(' . $startDate . '))'; + return new \Zend_Db_Expr($dateDiff); + } + + /** + * Escapes and quotes LIKE value. + * Stating escape symbol in expression is not required, because we use standard MySQL escape symbol. + * For options and escaping see escapeLikeValue(). + * + * @param string $value + * @param array $options + * @return \Zend_Db_Expr * - * @param string $from - * @param string $to - * @return void + * @see escapeLikeValue() */ - public static function addTranslate($from, $to) + public function addLikeEscape($value, $options = array()) { - self::$_translateMap[$from] = $to; + $value = $this->escapeLikeValue($value, $options); + return new \Zend_Db_Expr($this->_getReadAdapter()->quote($value)); } } diff --git a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php b/lib/Magento/DB/Helper/AbstractHelper.php similarity index 96% rename from app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php rename to lib/Magento/DB/Helper/AbstractHelper.php index b77b8f2babaf236e31c1f3916745719c4d05cbf8..5c1da9937fcbc1982cbdb77469e993fc2bb6b81f 100644 --- a/app/code/Magento/Core/Model/Resource/Helper/AbstractHelper.php +++ b/lib/Magento/DB/Helper/AbstractHelper.php @@ -1,5 +1,7 @@ <?php /** + * Abstract DB helper class + * * Magento * * NOTICE OF LICENSE @@ -18,16 +20,11 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Helper; +namespace Magento\DB\Helper; -/** - * Abstract resource helper class - */ abstract class AbstractHelper { /** @@ -201,7 +198,7 @@ abstract class AbstractHelper * * @param array $column * @return array - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ public function convertOldColumnDefinition($column) { @@ -209,7 +206,7 @@ abstract class AbstractHelper $matches = array(); $definition = trim($column['type']); if (!preg_match('/([^(]*)(\\((.*)\\))?/', $definition, $matches)) { - throw new \Magento\Core\Exception(__("Wrong old style column type definition: {$definition}.")); + throw new \Magento\Model\Exception(__("Wrong old style column type definition: {$definition}.")); } $length = null; @@ -300,7 +297,7 @@ abstract class AbstractHelper $type = \Magento\DB\Ddl\Table::TYPE_DATE; break; default: - throw new \Magento\Core\Exception(__("Unknown old style column type definition: {$definition}.")); + throw new \Magento\Model\Exception(__("Unknown old style column type definition: {$definition}.")); } $result = array( diff --git a/app/code/Magento/Core/Model/Resource/Transaction.php b/lib/Magento/DB/Transaction.php similarity index 92% rename from app/code/Magento/Core/Model/Resource/Transaction.php rename to lib/Magento/DB/Transaction.php index ef500d5d9bf6d7b2ee33090477f4896f335250a3..00d72630fcac224e176456fc76d1646c5eaced28 100644 --- a/app/code/Magento/Core/Model/Resource/Transaction.php +++ b/lib/Magento/DB/Transaction.php @@ -1,5 +1,7 @@ <?php /** + * DB transaction model + * * Magento * * NOTICE OF LICENSE @@ -18,20 +20,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\DB; /** - * Resource transaction model - * * @todo need collect connection by name - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ class Transaction { @@ -111,11 +106,11 @@ class Transaction /** * Adding object for using in transaction * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $alias * @return $this */ - public function addObject(\Magento\Core\Model\AbstractModel $object, $alias = '') + public function addObject(\Magento\Model\AbstractModel $object, $alias = '') { $this->_objects[] = $object; if (!empty($alias)) { diff --git a/lib/Magento/Data/Collection/Db.php b/lib/Magento/Data/Collection/Db.php index aa69184f461f1937f5a0449d1905b7ff344e642b..91e38b5e406e7b0ebafda69826a43ad4495b732d 100644 --- a/lib/Magento/Data/Collection/Db.php +++ b/lib/Magento/Data/Collection/Db.php @@ -635,33 +635,6 @@ class Db extends \Magento\Data\Collection return parent::_toOptionHash($valueField, $labelField); } - /** - * Convert items array to hash for select options - * using fetchItem method - * - * The difference between _toOptionHash() and this one is that this - * method fetch items one by one and does not load all collection items at once - * return items hash - * array($value => $label) - * - * @see fetchItem() - * - * @param string $valueField - * @param string $labelField - * @return array - */ - protected function _toOptionHashOptimized($valueField = null, $labelField = 'name') - { - if ($valueField === null) { - $valueField = $this->getIdFieldName(); - } - $result = array(); - while ($item = $this->fetchItem()) { - $result[$item->getData($valueField)] = $item->getData($labelField); - } - return $result; - } - /** * Get all data array for collection * @@ -790,7 +763,7 @@ class Db extends \Magento\Data\Collection { if (is_null($this->_map)) { $this->_map = array($group => array()); - } elseif (is_null($this->_map[$group])) { + } elseif (empty($this->_map[$group])) { $this->_map[$group] = array(); } $this->_map[$group][$filter] = $alias; diff --git a/lib/Magento/Filesystem/Driver/Http.php b/lib/Magento/Filesystem/Driver/Http.php index 3d1032ab9afdbef79140c336f1844da1af67341f..1e58a58f171f5655392bcd84ab0aeed0802a62fc 100644 --- a/lib/Magento/Filesystem/Driver/Http.php +++ b/lib/Magento/Filesystem/Driver/Http.php @@ -180,7 +180,7 @@ class Http extends File $hostname . "\r\n" . 'User-Agent: Magento ver/' . - \Magento\Core\Model\App::VERSION . + \Magento\AppInterface::VERSION . "\r\n" . 'Connection: close' . "\r\n" . diff --git a/app/code/Magento/Core/Model/Flag.php b/lib/Magento/Flag.php similarity index 74% rename from app/code/Magento/Core/Model/Flag.php rename to lib/Magento/Flag.php index 52672980b0305a8d2024d1b06416009e37c43579..aedaab5ef806871a3bb40004f93be650f0683434 100644 --- a/app/code/Magento/Core/Model/Flag.php +++ b/lib/Magento/Flag.php @@ -18,30 +18,24 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento; /** - * Core Flag model + * Flag model * - * @method \Magento\Core\Model\Resource\Flag _getResource() - * @method \Magento\Core\Model\Resource\Flag getResource() + * @method \Magento\Flag\Resource _getResource() + * @method \Magento\Flag\Resource getResource() * @method string getFlagCode() - * @method \Magento\Core\Model\Flag setFlagCode(string $value) + * @method \Magento\Flag setFlagCode(string $value) * @method int getState() - * @method \Magento\Core\Model\Flag setState(int $value) + * @method \Magento\Flag setState(int $value) * @method string getLastUpdate() - * @method \Magento\Core\Model\Flag setLastUpdate(string $value) - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * @method \Magento\Flag setLastUpdate(string $value) */ -class Flag extends AbstractModel +class Flag extends \Magento\Model\AbstractModel { /** * Flag code @@ -61,19 +55,19 @@ class Flag extends AbstractModel if ($this->hasData('flag_code')) { $this->_flagCode = $this->getData('flag_code'); } - $this->_init('Magento\Core\Model\Resource\Flag'); + $this->_init('Magento\Flag\Resource'); } /** * Processing object before save data * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ protected function _beforeSave() { if (is_null($this->_flagCode)) { - throw new \Magento\Core\Exception(__('Please define flag code.')); + throw new \Magento\Model\Exception(__('Please define flag code.')); } $this->setFlagCode($this->_flagCode); @@ -110,13 +104,13 @@ class Flag extends AbstractModel /** * load self (load by flag code) * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return $this */ public function loadSelf() { if (is_null($this->_flagCode)) { - throw new \Magento\Core\Exception(__('Please define flag code.')); + throw new \Magento\Model\Exception(__('Please define flag code.')); } return $this->load($this->_flagCode, 'flag_code'); diff --git a/app/code/Magento/Core/Model/Resource/Flag.php b/lib/Magento/Flag/Resource.php similarity index 79% rename from app/code/Magento/Core/Model/Resource/Flag.php rename to lib/Magento/Flag/Resource.php index de91ae9b59ace6f10c786d4c92cf227ab36549e4..ded104d288edcbe122ca2990851399fce9b725a2 100644 --- a/app/code/Magento/Core/Model/Resource/Flag.php +++ b/lib/Magento/Flag/Resource.php @@ -18,21 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Flag; /** - * Flag model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Flag Resource model */ -class Flag extends \Magento\Core\Model\Resource\Db\AbstractDb +class Resource extends \Magento\Model\Resource\Db\AbstractDb { /** * Define main table diff --git a/lib/Magento/Translate/InlineFactory.php b/lib/Magento/FlagFactory.php similarity index 66% rename from lib/Magento/Translate/InlineFactory.php rename to lib/Magento/FlagFactory.php index 37a9e911c0d1cdc5547142cd090077477dde3ba7..4f56f7db294914fb81a451eb8860a5a52680d90f 100644 --- a/lib/Magento/Translate/InlineFactory.php +++ b/lib/Magento/FlagFactory.php @@ -1,7 +1,5 @@ <?php /** - * Inline translation factory - * * Magento * * NOTICE OF LICENSE @@ -23,36 +21,47 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Translate; +namespace Magento; -class InlineFactory +/** + * Factory class for \Magento\Flag + */ +class FlagFactory { /** - * Object Manager + * Object Manager instance * * @var \Magento\ObjectManager */ - protected $_objectManager; + protected $_objectManager = null; + + /** + * Instance name to create + * + * @var string + */ + protected $_instanceName = null; /** - * Object constructor + * Factory constructor + * * @param \Magento\ObjectManager $objectManager + * @param string $instanceName */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\ObjectManager $objectManager, $instanceName = 'Magento\Flag') { $this->_objectManager = $objectManager; + $this->_instanceName = $instanceName; } /** - * Return instance of inline translate parser object + * Create class instance with specified parameters * * @param array $data - * @throws \InvalidArgumentException - * @return \Magento\Translate\InlineInterface + * @return \Magento\Flag */ - public function get(array $data = null) + public function create(array $data = array()) { - $model = $this->_objectManager->get('Magento\Translate\InlineInterface', $data); - return $model; + return $this->_objectManager->create($this->_instanceName, $data); } } diff --git a/lib/Magento/Json/Encoder.php b/lib/Magento/Json/Encoder.php index 60bbd075b7bd5aeaccf7fbd8f4388b56210ee13f..1e5b9bf1d2589a95bb0afe4428ae57f78b8506fb 100644 --- a/lib/Magento/Json/Encoder.php +++ b/lib/Magento/Json/Encoder.php @@ -49,10 +49,7 @@ class Encoder implements EncoderInterface public function encode($data) { $json = \Zend_Json::encode($data); - if ($this->translateInline->isAllowed()) { - $this->translateInline->processResponseBody($json, true); - } - + $this->translateInline->processResponseBody($json, true); return $json; } } diff --git a/lib/Magento/Locale/Lists.php b/lib/Magento/Locale/Lists.php index 9006ab993523cac206ff4a53773f5a3b3a999e1b..f41e56b38b7652f315dd3034e2a725cec4887db2 100644 --- a/lib/Magento/Locale/Lists.php +++ b/lib/Magento/Locale/Lists.php @@ -40,11 +40,6 @@ class Lists implements \Magento\Locale\ListsInterface */ protected $_config; - /** - * @var \Magento\AppInterface - */ - protected $_app; - /** * @var \Magento\Locale\ResolverInterface */ @@ -59,7 +54,6 @@ class Lists implements \Magento\Locale\ListsInterface * @param \Magento\App\State $appState * @param \Magento\BaseScopeResolverInterface $scopeResolver * @param \Magento\Locale\ConfigInterface $config - * @param \Magento\AppInterface $app * @param \Magento\Locale\ResolverInterface $localeResolver * @param string $currencyInstalled * @param string $locale @@ -68,7 +62,6 @@ class Lists implements \Magento\Locale\ListsInterface \Magento\App\State $appState, \Magento\BaseScopeResolverInterface $scopeResolver, \Magento\Locale\ConfigInterface $config, - \Magento\AppInterface $app, \Magento\Locale\ResolverInterface $localeResolver, $currencyInstalled, $locale = null @@ -76,7 +69,6 @@ class Lists implements \Magento\Locale\ListsInterface $this->_appState = $appState; $this->_scopeResolver = $scopeResolver; $this->_config = $config; - $this->_app = $app; $this->_localeResolver = $localeResolver; if ($locale !== null) { $this->_localeResolver->setLocale($locale); diff --git a/lib/Magento/Locale/Resolver.php b/lib/Magento/Locale/Resolver.php index fb3ac3e320354d1e59ef7897a44063200d669f17..793d4fc1dd75b5c1dd18678d21490ddee4e6dbf4 100644 --- a/lib/Magento/Locale/Resolver.php +++ b/lib/Magento/Locale/Resolver.php @@ -52,9 +52,9 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_scopeConfig; /** - * @var \Magento\AppInterface + * @var \Magento\App\CacheInterface */ - protected $_app; + protected $_cache; /** * Emulated locales stack @@ -69,20 +69,20 @@ class Resolver implements \Magento\Locale\ResolverInterface protected $_localeFactory; /** - * @param \Magento\Locale\ScopeConfigInterface $scopeConfig - * @param \Magento\AppInterface $app + * @param ScopeConfigInterface $scopeConfig + * @param \Magento\App\CacheInterface $cache * @param \Magento\LocaleFactory $localeFactory * @param string $defaultLocalePath - * @param mixed $locale + * @param null $locale */ public function __construct( \Magento\Locale\ScopeConfigInterface $scopeConfig, - \Magento\AppInterface $app, + \Magento\App\CacheInterface $cache, \Magento\LocaleFactory $localeFactory, $defaultLocalePath, $locale = null ) { - $this->_app = $app; + $this->_cache = $cache; $this->_scopeConfig = $scopeConfig; $this->_localeFactory = $localeFactory; $this->_defaultLocalePath = $defaultLocalePath; @@ -140,7 +140,7 @@ class Resolver implements \Magento\Locale\ResolverInterface public function getLocale() { if (!$this->_locale) { - \Zend_Locale_Data::setCache($this->_app->getCache()->getLowLevelFrontend()); + \Zend_Locale_Data::setCache($this->_cache->getFrontend()->getLowLevelFrontend()); $this->_locale = $this->_localeFactory->create(array('locale' => $this->getLocaleCode())); } elseif ($this->_locale->__toString() != $this->_localeCode) { $this->setLocale($this->_localeCode); diff --git a/app/code/Magento/Core/Model/AbstractModel.php b/lib/Magento/Model/AbstractModel.php similarity index 91% rename from app/code/Magento/Core/Model/AbstractModel.php rename to lib/Magento/Model/AbstractModel.php index 5ba4e0820995ab35ec9a0cce1f8ca17a9ffdf88b..0b38933e505896e6d9df3c0cf64c74115e1660af 100644 --- a/app/code/Magento/Core/Model/AbstractModel.php +++ b/lib/Magento/Model/AbstractModel.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\Model; /** * Abstract model class @@ -52,14 +50,14 @@ abstract class AbstractModel extends \Magento\Object /** * Resource model instance * - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_resource; /** * Resource collection * - * @var \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @var \Magento\Model\Resource\Db\Collection\AbstractCollection */ protected $_resourceCollection; @@ -126,7 +124,7 @@ abstract class AbstractModel extends \Magento\Object /** * @var \Magento\Registry */ - protected $_coreRegistry; + protected $_registry; /** * @var \Magento\Logger @@ -139,26 +137,32 @@ abstract class AbstractModel extends \Magento\Object protected $_appState; /** - * @param \Magento\Model\Context $context + * @var \Magento\Model\ActionValidator\RemoveAction + */ + protected $_actionValidator; + + /** + * @param Context $context * @param \Magento\Registry $registry - * @param \Magento\Core\Model\Resource\AbstractResource $resource + * @param Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data */ public function __construct( \Magento\Model\Context $context, \Magento\Registry $registry, - \Magento\Core\Model\Resource\AbstractResource $resource = null, + \Magento\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() ) { - $this->_coreRegistry = $registry; + $this->_registry = $registry; $this->_appState = $context->getAppState(); $this->_eventManager = $context->getEventDispatcher(); $this->_cacheManager = $context->getCacheManager(); $this->_resource = $resource; $this->_resourceCollection = $resourceCollection; $this->_logger = $context->getLogger(); + $this->_actionValidator = $context->getActionValidator(); if (method_exists($this->_resource, 'getIdFieldName') || $this->_resource instanceof \Magento\Object) { $this->_idFieldName = $this->_getResource()->getIdFieldName(); @@ -195,7 +199,7 @@ abstract class AbstractModel extends \Magento\Object public function __sleep() { $properties = array_keys(get_object_vars($this)); - $properties = array_diff($properties, array('_eventManager', '_cacheManager', '_coreRegistry', '_appState')); + $properties = array_diff($properties, array('_eventManager', '_cacheManager', '_registry', '_appState')); return $properties; } @@ -209,7 +213,7 @@ abstract class AbstractModel extends \Magento\Object $objectManager = \Magento\App\ObjectManager::getInstance(); $this->_eventManager = $objectManager->get('Magento\Event\ManagerInterface'); $this->_cacheManager = $objectManager->get('Magento\App\CacheInterface'); - $this->_coreRegistry = $objectManager->get('Magento\Registry'); + $this->_registry = $objectManager->get('Magento\Registry'); $context = $objectManager->get('Magento\Model\Context'); if ($context instanceof \Magento\Model\Context) { $this->_appState = $context->getAppState(); @@ -237,13 +241,13 @@ abstract class AbstractModel extends \Magento\Object /** * Get resource instance * - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @throws \Magento\Model\Exception + * @return \Magento\Model\Resource\Db\AbstractDb */ protected function _getResource() { if (empty($this->_resourceName) && empty($this->_resource)) { - throw new \Magento\Core\Exception(__('Resource is not set.')); + throw new \Magento\Model\Exception(__('Resource is not set.')); } return $this->_resource ?: \Magento\App\ObjectManager::getInstance()->get($this->_resourceName); @@ -263,13 +267,13 @@ abstract class AbstractModel extends \Magento\Object * Get collection instance * * @deplacated - * @throws \Magento\Core\Exception - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @throws \Magento\Model\Exception + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getResourceCollection() { if (empty($this->_resourceCollection) && empty($this->_collectionName)) { - throw new \Magento\Core\Exception(__('Model collection resource name is not defined.')); + throw new \Magento\Model\Exception(__('Model collection resource name is not defined.')); } return $this->_resourceCollection ? clone $this ->_resourceCollection : \Magento\App\ObjectManager::getInstance() @@ -281,7 +285,7 @@ abstract class AbstractModel extends \Magento\Object /** * Retrieve collection instance * - * @return \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + * @return \Magento\Model\Resource\Db\Collection\AbstractCollection */ public function getCollection() { @@ -453,14 +457,14 @@ abstract class AbstractModel extends \Magento\Object * Validate model before saving it * * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _validateBeforeSave() { $validator = $this->_getValidatorBeforeSave(); if ($validator && !$validator->isValid($this)) { $errors = $validator->getMessages(); - $exception = new \Magento\Core\Exception(implode(PHP_EOL, $errors)); + $exception = new \Magento\Model\Exception(implode(PHP_EOL, $errors)); foreach ($errors as $errorMessage) { $exception->addMessage(new \Magento\Message\Error($errorMessage)); } @@ -599,31 +603,20 @@ abstract class AbstractModel extends \Magento\Object * Processing object before delete data * * @return $this + * @throws Exception */ protected function _beforeDelete() { + if (!$this->_actionValidator->isAllowed($this)) { + throw new Exception(__('Delete operation is forbidden for current area')); + } + $this->_eventManager->dispatch('model_delete_before', array('object' => $this)); $this->_eventManager->dispatch($this->_eventPrefix . '_delete_before', $this->_getEventData()); $this->cleanModelCache(); return $this; } - /** - * Safeguard func that will check, if we are in admin area - * - * @return void - * @throws \Magento\Core\Exception - */ - protected function _protectFromNonAdmin() - { - if ($this->_coreRegistry->registry('isSecureArea')) { - return; - } - if ($this->_appState->getAreaCode() !== \Magento\Backend\App\Area\FrontNameResolver::AREA_CODE) { - throw new \Magento\Core\Exception(__('Cannot complete this operation from non-admin area.')); - } - } - /** * Processing object after delete data * @@ -652,7 +645,7 @@ abstract class AbstractModel extends \Magento\Object /** * Retrieve model resource * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { diff --git a/lib/Magento/Model/ActionValidator/RemoveAction.php b/lib/Magento/Model/ActionValidator/RemoveAction.php new file mode 100644 index 0000000000000000000000000000000000000000..b862218c7be50dd39a6e3519fc0fef315b1c707f --- /dev/null +++ b/lib/Magento/Model/ActionValidator/RemoveAction.php @@ -0,0 +1,84 @@ +<?php +/** + * Action validator, remove action + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Model\ActionValidator; + +use Magento\Model\AbstractModel; + +class RemoveAction +{ + /** + * @var \Magento\Registry + */ + protected $registry; + + /** + * @var array + */ + protected $protectedModels; + + /** + * @param \Magento\Registry $registry + * @param array $protectedModels + */ + public function __construct(\Magento\Registry $registry, array $protectedModels = array()) + { + $this->registry = $registry; + $this->protectedModels = $protectedModels; + } + + /** + * Safeguard function that checks if item can be removed + * + * @param AbstractModel $model + * @return bool + */ + public function isAllowed(AbstractModel $model) + { + $isAllowed = true; + + if ($this->registry->registry('isSecureArea')) { + $isAllowed = true; + } elseif (in_array($this->getBaseClassName($model), $this->protectedModels)) { + $isAllowed = false; + } + + return $isAllowed; + } + + /** + * Get clean model name without Interceptor and Proxy part and slashes + * @param object $object + * @return mixed + */ + protected function getBaseClassName($object) + { + $className = ltrim(get_class($object), "\\"); + $className = str_replace(array('\Interceptor', '\Proxy'), array(''), $className); + + return $className; + } +} diff --git a/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php b/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php new file mode 100644 index 0000000000000000000000000000000000000000..5ebb78f9c41ef68661063f4ba920bdd971e99497 --- /dev/null +++ b/lib/Magento/Model/ActionValidator/RemoveAction/Allowed.php @@ -0,0 +1,42 @@ +<?php +/** + * Action validator for remove action + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Model\ActionValidator\RemoveAction; + +class Allowed extends \Magento\Model\ActionValidator\RemoveAction +{ + /** + * Safeguard function that checks if item can be removed + * + * @param \Magento\Model\AbstractModel $model + * @return bool + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function isAllowed(\Magento\Model\AbstractModel $model) + { + return true; + } +} diff --git a/lib/Magento/Model/Context.php b/lib/Magento/Model/Context.php index 6fda9df54302da1632eb474c8366e349649ad330..1d3b1c594b0e4e3ac4b74327298b948e43fafb4b 100644 --- a/lib/Magento/Model/Context.php +++ b/lib/Magento/Model/Context.php @@ -47,22 +47,30 @@ class Context implements \Magento\ObjectManager\ContextInterface */ protected $_appState; + /** + * @var \Magento\Model\ActionValidator\RemoveAction + */ + protected $_actionValidator; + /** * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventDispatcher * @param \Magento\App\CacheInterface $cacheManager * @param \Magento\App\State $appState + * @param ActionValidator\RemoveAction $actionValidator */ public function __construct( \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventDispatcher, \Magento\App\CacheInterface $cacheManager, - \Magento\App\State $appState + \Magento\App\State $appState, + \Magento\Model\ActionValidator\RemoveAction $actionValidator ) { $this->_eventDispatcher = $eventDispatcher; $this->_cacheManager = $cacheManager; $this->_appState = $appState; $this->_logger = $logger; + $this->_actionValidator = $actionValidator; } /** @@ -96,4 +104,12 @@ class Context implements \Magento\ObjectManager\ContextInterface { return $this->_appState; } + + /** + * @return \Magento\Model\ActionValidator\RemoveAction + */ + public function getActionValidator() + { + return $this->_actionValidator; + } } diff --git a/app/code/Magento/Core/Exception.php b/lib/Magento/Model/Exception.php similarity index 92% rename from app/code/Magento/Core/Exception.php rename to lib/Magento/Model/Exception.php index 83138306912104e9a3739d7fc2257f07097cce65..3361c6d7e4cee29c580fbd6aff379dfac969745c 100644 --- a/app/code/Magento/Core/Exception.php +++ b/lib/Magento/Model/Exception.php @@ -18,20 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core; +namespace Magento\Model; /** - * Magento Core \Exception + * Magento Model Exception * * This class will be extended by other modules - * - * @category Magento - * @package Magento_Core */ class Exception extends \Exception { @@ -74,7 +69,7 @@ class Exception extends \Exception * * @param string $message * @param bool $append - * @return \Magento\Core\Exception + * @return \Magento\Model\Exception */ public function setMessage($message, $append = false) { diff --git a/app/code/Magento/Core/Model/Resource/AbstractResource.php b/lib/Magento/Model/Resource/AbstractResource.php similarity index 94% rename from app/code/Magento/Core/Model/Resource/AbstractResource.php rename to lib/Magento/Model/Resource/AbstractResource.php index 7fcfccd555fb7f7c9f78051c5013d5b220e8b960..22feb833c54ea1e403323f1c614e5a266dd25521 100644 --- a/app/code/Magento/Core/Model/Resource/AbstractResource.php +++ b/lib/Magento/Model/Resource/AbstractResource.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; /** * Abstract resource model - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ abstract class AbstractResource { @@ -168,7 +162,7 @@ abstract class AbstractResource /** * Unserialize \Magento\Object field in an object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $field * @param mixed $defaultValue * @return void @@ -245,11 +239,11 @@ abstract class AbstractResource /** * Prepare the list of entity fields that should be selected from DB. Apply filtration based on active fieldset. * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param string $tableName * @return array|string */ - protected function _getColumnsForEntityLoad(\Magento\Core\Model\AbstractModel $object, $tableName) + protected function _getColumnsForEntityLoad(\Magento\Model\AbstractModel $object, $tableName) { $fieldsetColumns = $object->getFieldset(); if (!empty($fieldsetColumns)) { diff --git a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php b/lib/Magento/Model/Resource/Db/AbstractDb.php similarity index 87% rename from app/code/Magento/Core/Model/Resource/Db/AbstractDb.php rename to lib/Magento/Model/Resource/Db/AbstractDb.php index c116be27c4fa6080b063b8ce652d1172206ea641..743220e65a8141848d036f192236d37c7710e99e 100644 --- a/app/code/Magento/Core/Model/Resource/Db/AbstractDb.php +++ b/lib/Magento/Model/Resource/Db/AbstractDb.php @@ -18,21 +18,15 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; /** * Abstract resource model class - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> */ -abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource +abstract class AbstractDb extends \Magento\Model\Resource\AbstractResource { /** * Cached resources singleton @@ -233,13 +227,13 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Get primary key field name * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getIdFieldName() { if (empty($this->_idFieldName)) { - throw new \Magento\Core\Exception(__('Empty identifier field name')); + throw new \Magento\Model\Exception(__('Empty identifier field name')); } return $this->_idFieldName; } @@ -248,13 +242,13 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * Returns main table name - extracted from "module/table" style and * validated by db adapter * - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception * @return string */ public function getMainTable() { if (empty($this->_mainTable)) { - throw new \Magento\Core\Exception(__('Empty main table name')); + throw new \Magento\Model\Exception(__('Empty main table name')); } return $this->getTable($this->_mainTable); } @@ -343,12 +337,12 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Load an object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @param mixed $value * @param string $field field to load by (defaults to model id) * @return $this */ - public function load(\Magento\Core\Model\AbstractModel $object, $value, $field = null) + public function load(\Magento\Model\AbstractModel $object, $value, $field = null) { if (is_null($field)) { $field = $this->getIdFieldName(); @@ -375,7 +369,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * * @param string $field * @param mixed $value - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return \Zend_Db_Select */ protected function _getLoadSelect($field, $value, $object) @@ -388,10 +382,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Save object object data * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function save(\Magento\Core\Model\AbstractModel $object) + public function save(\Magento\Model\AbstractModel $object) { if ($object->isDeleted()) { return $this->delete($object); @@ -449,10 +443,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Delete the object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this */ - public function delete(\Magento\Core\Model\AbstractModel $object) + public function delete(\Magento\Model\AbstractModel $object) { $this->_beforeDelete($object); $this->_getWriteAdapter()->delete( @@ -494,10 +488,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Unserialize serializeable object fields * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - public function unserializeFields(\Magento\Core\Model\AbstractModel $object) + public function unserializeFields(\Magento\Model\AbstractModel $object) { foreach ($this->_serializableFields as $field => $parameters) { list($serializeDefault, $unserializeDefault) = $parameters; @@ -532,10 +526,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Prepare data for save * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return array */ - protected function _prepareDataForSave(\Magento\Core\Model\AbstractModel $object) + protected function _prepareDataForSave(\Magento\Model\AbstractModel $object) { return $this->_prepareDataForTable($object, $this->getMainTable()); } @@ -544,7 +538,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource * Check that model data fields that can be saved * has really changed comparing with origData * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return bool */ public function hasDataChanged($object) @@ -578,11 +572,11 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Check for unique values existence * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return $this - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ - protected function _checkUnique(\Magento\Core\Model\AbstractModel $object) + protected function _checkUnique(\Magento\Model\AbstractModel $object) { $existent = array(); $fields = $this->getUniqueFields(); @@ -622,7 +616,7 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource } else { $error = __('%1 already exist.', implode(', ', $existent)); } - throw new \Magento\Core\Exception($error); + throw new \Magento\Model\Exception($error); } return $this; } @@ -630,10 +624,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * After load * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - public function afterLoad(\Magento\Core\Model\AbstractModel $object) + public function afterLoad(\Magento\Model\AbstractModel $object) { $this->_afterLoad($object); } @@ -641,10 +635,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object load * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $object) + protected function _afterLoad(\Magento\Model\AbstractModel $object) { return $this; } @@ -652,10 +646,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions before object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeSave(\Magento\Core\Model\AbstractModel $object) + protected function _beforeSave(\Magento\Model\AbstractModel $object) { return $this; } @@ -663,10 +657,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object save * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $object) + protected function _afterSave(\Magento\Model\AbstractModel $object) { return $this; } @@ -674,10 +668,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions before object delete * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _beforeDelete(\Magento\Core\Model\AbstractModel $object) + protected function _beforeDelete(\Magento\Model\AbstractModel $object) { return $this; } @@ -685,10 +679,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Perform actions after object delete * - * @param \Magento\Core\Model\AbstractModel|\Magento\Object $object + * @param \Magento\Model\AbstractModel|\Magento\Object $object * @return $this */ - protected function _afterDelete(\Magento\Core\Model\AbstractModel $object) + protected function _afterDelete(\Magento\Model\AbstractModel $object) { return $this; } @@ -696,10 +690,10 @@ abstract class AbstractDb extends \Magento\Core\Model\Resource\AbstractResource /** * Serialize serializable fields of the object * - * @param \Magento\Core\Model\AbstractModel $object + * @param \Magento\Model\AbstractModel $object * @return void */ - protected function _serializeFields(\Magento\Core\Model\AbstractModel $object) + protected function _serializeFields(\Magento\Model\AbstractModel $object) { foreach ($this->_serializableFields as $field => $parameters) { list($serializeDefault, $unserializeDefault) = $parameters; diff --git a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php b/lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php similarity index 95% rename from app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php rename to lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php index 76ca676c9c15f3edc9b042dfd3d76825ef0e8172..55a49e34b9a0b571cdf46abb452f2e409df95554 100644 --- a/app/code/Magento/Core/Model/Resource/Db/Collection/AbstractCollection.php +++ b/lib/Magento/Model/Resource/Db/Collection/AbstractCollection.php @@ -18,19 +18,13 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db\Collection; +namespace Magento\Model\Resource\Db\Collection; /** - * Abstract Core Resource Collection - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> + * Abstract Resource Collection */ abstract class AbstractCollection extends \Magento\Data\Collection\Db { @@ -51,7 +45,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Resource instance * - * @var \Magento\Core\Model\Resource\Db\AbstractDb + * @var \Magento\Model\Resource\Db\AbstractDb */ protected $_resource; @@ -112,27 +106,27 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db protected $_eventObject = ''; /** - * Core event manager proxy + * Event manager proxy * * @var \Magento\Event\ManagerInterface */ protected $_eventManager = null; /** - * @param \Magento\Core\Model\EntityFactory $entityFactory + * @param \Magento\Data\Collection\EntityFactoryInterface $entityFactory * @param \Magento\Logger $logger * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Event\ManagerInterface $eventManager * @param \Zend_Db_Adapter_Abstract $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource + * @param \Magento\Model\Resource\Db\AbstractDb $resource */ public function __construct( - \Magento\Core\Model\EntityFactory $entityFactory, + \Magento\Data\Collection\EntityFactoryInterface $entityFactory, \Magento\Logger $logger, \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Event\ManagerInterface $eventManager, $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null + \Magento\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eventManager = $eventManager; parent::__construct($entityFactory, $logger, $fetchStrategy, $connection); @@ -471,7 +465,7 @@ abstract class AbstractCollection extends \Magento\Data\Collection\Db /** * Get resource instance * - * @return \Magento\Core\Model\Resource\Db\AbstractDb + * @return \Magento\Model\Resource\Db\AbstractDb */ public function getResource() { diff --git a/app/code/Magento/Core/Model/Resource/Db/Profiler.php b/lib/Magento/Model/Resource/Db/Profiler.php similarity index 93% rename from app/code/Magento/Core/Model/Resource/Db/Profiler.php rename to lib/Magento/Model/Resource/Db/Profiler.php index c6c31c786e6abe9e1079ae51f539583eb89fb208..d32255cc980f85b13d8734cebfe5f50f14081c88 100644 --- a/app/code/Magento/Core/Model/Resource/Db/Profiler.php +++ b/lib/Magento/Model/Resource/Db/Profiler.php @@ -1,6 +1,6 @@ <?php /** - * Magento Core profiler for requests to database + * Magento profiler for requests to database * * Magento * @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Db; +namespace Magento\Model\Resource\Db; class Profiler extends \Magento\DB\Profiler { @@ -51,7 +51,7 @@ class Profiler extends \Magento\DB\Profiler protected function _getTimerName($operation) { // default name of connection type - $timerName = \Magento\Core\Model\Resource\Db\Profiler::DEFAULT_CONNECTION_TYPE; + $timerName = \Magento\Model\Resource\Db\Profiler::DEFAULT_CONNECTION_TYPE; // connection type to database if (!empty($this->_type)) { @@ -66,7 +66,7 @@ class Profiler extends \Magento\DB\Profiler $timerName .= '_' . $this->_host; } - return \Magento\Core\Model\Resource\Db\Profiler::TIMER_PREFIX . ':' . $timerName; + return \Magento\Model\Resource\Db\Profiler::TIMER_PREFIX . ':' . $timerName; } /** diff --git a/app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php b/lib/Magento/Model/Resource/Entity/AbstractEntity.php similarity index 94% rename from app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php rename to lib/Magento/Model/Resource/Entity/AbstractEntity.php index 906df00a6856585419fdfd0c89b2013b8ac53c6b..340c61674899b659c9c19a9a694a5494d99d6968 100644 --- a/app/code/Magento/Core/Model/Resource/Entity/AbstractEntity.php +++ b/lib/Magento/Model/Resource/Entity/AbstractEntity.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; abstract class AbstractEntity { diff --git a/app/code/Magento/Core/Model/Resource/Entity/Table.php b/lib/Magento/Model/Resource/Entity/Table.php similarity index 86% rename from app/code/Magento/Core/Model/Resource/Entity/Table.php rename to lib/Magento/Model/Resource/Entity/Table.php index 983f15bd9bcb8966f0eac0c30a113b809814b253..bbfc72d9bf725e5a20413638b778c0baff724455 100644 --- a/app/code/Magento/Core/Model/Resource/Entity/Table.php +++ b/lib/Magento/Model/Resource/Entity/Table.php @@ -18,18 +18,16 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Entity; +namespace Magento\Model\Resource\Entity; /** * Class describing db table resource entity * */ -class Table extends \Magento\Core\Model\Resource\Entity\AbstractEntity +class Table extends \Magento\Model\Resource\Entity\AbstractEntity { /** * Get table diff --git a/app/code/Magento/Core/Model/Resource/Iterator.php b/lib/Magento/Model/Resource/Iterator.php similarity index 86% rename from app/code/Magento/Core/Model/Resource/Iterator.php rename to lib/Magento/Model/Resource/Iterator.php index 841099b3b60c743528d054256f7ff6f4d8611153..d59c1463fb81d59d62ecfb390cdb0fe283bf7ee2 100644 --- a/app/code/Magento/Core/Model/Resource/Iterator.php +++ b/lib/Magento/Model/Resource/Iterator.php @@ -18,18 +18,14 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ /** * Active record implementation - * - * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\Resource; +namespace Magento\Model\Resource; class Iterator extends \Magento\Object { @@ -40,7 +36,7 @@ class Iterator extends \Magento\Object * @param array|string $callbacks * @param array $args * @param \Magento\DB\Adapter\AdapterInterface $adapter - * @return \Magento\Core\Model\Resource\Iterator + * @return \Magento\Model\Resource\Iterator */ public function walk($query, array $callbacks, array $args = array(), $adapter = null) { @@ -66,7 +62,7 @@ class Iterator extends \Magento\Object * @param \Zend_Db_Statement_Interface|Zend_Db_Select|string $query * @param \Zend_Db_Adapter_Abstract $conn * @return \Zend_Db_Statement_Interface - * @throws \Magento\Core\Exception + * @throws \Magento\Model\Exception */ protected function _getStatement($query, $conn = null) { @@ -80,11 +76,11 @@ class Iterator extends \Magento\Object if (is_string($query)) { if (!$conn instanceof \Zend_Db_Adapter_Abstract) { - throw new \Magento\Core\Exception(__('Invalid connection')); + throw new \Magento\Model\Exception(__('Invalid connection')); } return $conn->query($query); } - throw new \Magento\Core\Exception(__('Invalid query')); + throw new \Magento\Model\Exception(__('Invalid query')); } } diff --git a/app/code/Magento/Core/Model/Resource/Type/AbstractType.php b/lib/Magento/Model/Resource/Type/AbstractType.php similarity index 89% rename from app/code/Magento/Core/Model/Resource/Type/AbstractType.php rename to lib/Magento/Model/Resource/Type/AbstractType.php index 095b349949f81f1de769a49a6ed416541a8fd538..e7c006c937e3bc699c1b0207a1bd2ec4ba61f84c 100644 --- a/app/code/Magento/Core/Model/Resource/Type/AbstractType.php +++ b/lib/Magento/Model/Resource/Type/AbstractType.php @@ -18,12 +18,10 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type; +namespace Magento\Model\Resource\Type; abstract class AbstractType { @@ -39,7 +37,7 @@ abstract class AbstractType * * @var String */ - protected $_entityClass = 'Magento\Core\Model\Resource\Entity\AbstractEntity'; + protected $_entityClass = 'Magento\Model\Resource\Entity\AbstractEntity'; /** * Retrieve entity type diff --git a/app/code/Magento/Core/Model/Resource/Type/Db.php b/lib/Magento/Model/Resource/Type/Db.php similarity index 80% rename from app/code/Magento/Core/Model/Resource/Type/Db.php rename to lib/Magento/Model/Resource/Type/Db.php index 68df0a5500cfb4a95f8d1267712dd1f44c09c382..189b81158510aa8b6bbd7daa5877f140b28999ff 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db.php +++ b/lib/Magento/Model/Resource/Type/Db.php @@ -18,20 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type; +namespace Magento\Model\Resource\Type; -abstract class Db extends \Magento\Core\Model\Resource\Type\AbstractType +abstract class Db extends \Magento\Model\Resource\Type\AbstractType { /** * Constructor */ public function __construct() { - $this->_entityClass = 'Magento\Core\Model\Resource\Entity\Table'; + $this->_entityClass = 'Magento\Model\Resource\Entity\Table'; } } diff --git a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php b/lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php similarity index 95% rename from app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php rename to lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php index 82b0d8b36231fb9ca2fec18f03839bbe0a7859df..c8d7a0884d43fc345413276c89a18b9707098258 100644 --- a/app/code/Magento/Core/Model/Resource/Type/Db/Pdo/Mysql.php +++ b/lib/Magento/Model/Resource/Type/Db/Pdo/Mysql.php @@ -21,9 +21,9 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Resource\Type\Db\Pdo; +namespace Magento\Model\Resource\Type\Db\Pdo; -class Mysql extends \Magento\Core\Model\Resource\Type\Db implements \Magento\App\Resource\ConnectionAdapterInterface +class Mysql extends \Magento\Model\Resource\Type\Db implements \Magento\App\Resource\ConnectionAdapterInterface { /** * Filesystem class diff --git a/lib/Magento/Module/Declaration/Reader/Filesystem.php b/lib/Magento/Module/Declaration/Reader/Filesystem.php index af33aa214314a0db68fe5d4251d7972ecd264ce9..4a9fa5a8f7797273cbe4a822fb4fe0255613ed24 100644 --- a/lib/Magento/Module/Declaration/Reader/Filesystem.php +++ b/lib/Magento/Module/Declaration/Reader/Filesystem.php @@ -34,6 +34,10 @@ use Magento\App\State; class Filesystem extends \Magento\Config\Reader\Filesystem { + /** + * Allowed modules + */ + const PARAM_ALLOWED_MODULES = 'allowed_modules'; /** * The list of allowed modules * diff --git a/lib/Magento/Mview/View/Subscription.php b/lib/Magento/Mview/View/Subscription.php index ef8396f97464dedbdfd9bae089d203d237e65038..d9f23edb5c3b84ed4e48bd563f434ecb218e91c3 100644 --- a/lib/Magento/Mview/View/Subscription.php +++ b/lib/Magento/Mview/View/Subscription.php @@ -86,7 +86,7 @@ class Subscription implements SubscriptionInterface \Magento\App\Resource $resource, \Magento\DB\Ddl\TriggerFactory $triggerFactory, \Magento\Mview\View\CollectionInterface $viewCollection, - $view, + \Magento\Mview\ViewInterface $view, $tableName, $columnName ) { @@ -97,9 +97,6 @@ class Subscription implements SubscriptionInterface $this->tableName = $tableName; $this->columnName = $columnName; $this->resource = $resource; - - // Force collection clear - $this->viewCollection->clear(); } /** diff --git a/lib/Magento/Outbound/Authentication/Factory.php b/lib/Magento/Outbound/Authentication/Factory.php deleted file mode 100644 index 22541b23d84c75b8d7fc0cae0c6956e2b8babcde..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Authentication/Factory.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Factory or authentication objects - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Outbound\Authentication; - -use Magento\ObjectManager; -use Magento\Outbound\AuthenticationInterface; - -class Factory -{ - /** - * @var ObjectManager - */ - private $_objectManager; - - /** - * @var array representing the map for authentications and authentication classes - */ - protected $_authenticationMap = array(); - - /** - * @param array $authenticationMap - * @param ObjectManager $objectManager - */ - public function __construct(array $authenticationMap, ObjectManager $objectManager) - { - $this->_authenticationMap = $authenticationMap; - $this->_objectManager = $objectManager; - } - - /** - * Returns an Authentication that matches the type specified within Endpoint - * - * @param string $authenticationType - * @return AuthenticationInterface - * @throws \LogicException - */ - public function getAuthentication($authenticationType) - { - if (!isset($this->_authenticationMap[$authenticationType])) { - throw new \LogicException("There is no authentication for the type given: {$authenticationType}"); - } - - $authentication = $this->_objectManager->get($this->_authenticationMap[$authenticationType]); - if (!$authentication instanceof AuthenticationInterface) { - throw new \LogicException( - "Authentication class for {$authenticationType} does not implement authentication interface" - ); - } - return $authentication; - } -} diff --git a/lib/Magento/Outbound/Authentication/Hmac.php b/lib/Magento/Outbound/Authentication/Hmac.php deleted file mode 100644 index 067c1551d4adac2c7d0d147736ec4c8d6eb27c4e..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Authentication/Hmac.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * This class is capable of creating HMAC signature headers. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Authentication; - -use Magento\Core\Model\StoreManagerInterface; -use Magento\Outbound\AuthenticationInterface; -use Magento\Outbound\UserInterface; -use Magento\UrlInterface; - -class Hmac implements AuthenticationInterface -{ - /** - * The name of the header which stores the HMAC signature for client verification - */ - const HMAC_HEADER = 'Magento-HMAC-Signature'; - - /** - * The name of the header which identifies the domain of the sender to the client - */ - const DOMAIN_HEADER = 'Magento-Sender-Domain'; - - /** - * 256 bit Secure Hash Algorithm is used by default - */ - const SHA256_ALGORITHM = 'sha256'; - - /** - * @var StoreManagerInterface - */ - private $_storeManager; - - /** - * @param StoreManagerInterface $storeManager - */ - public function __construct(StoreManagerInterface $storeManager) - { - $this->_storeManager = $storeManager; - } - - /** - * Get authentication signature to add to the headers - * - * @param string $body - * @param UserInterface $user - * @return array Headers to add to message - * @throws \LogicException - */ - public function getSignatureHeaders($body, UserInterface $user) - { - $secret = $user->getSharedSecret(); - if ('' === $secret || is_null($secret)) { - throw new \LogicException('The shared secret cannot be empty.'); - } - - // Add HMAC Signature - $signature = hash_hmac(self::SHA256_ALGORITHM, $body, $secret); - return array(self::DOMAIN_HEADER => $this->_getDomain(), self::HMAC_HEADER => $signature); - } - - /** - * An overridable method to get the domain name - * - * @return array|bool - */ - protected function _getDomain() - { - return parse_url($this->_storeManager->getSafeStore()->getBaseUrl(UrlInterface::URL_TYPE_WEB), PHP_URL_HOST); - } -} diff --git a/lib/Magento/Outbound/AuthenticationInterface.php b/lib/Magento/Outbound/AuthenticationInterface.php deleted file mode 100644 index 06af4943d08de4def664645d2ced5c391915cf35..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/AuthenticationInterface.php +++ /dev/null @@ -1,41 +0,0 @@ -<?php -/** - * Authentication is used for signing messages so that the subscriber can authenticate their validity. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface AuthenticationInterface -{ - /** - * Get authentication signature to add to the headers - * - * @param string $body - * @param \Magento\Outbound\UserInterface $user - * - * @return array Headers to add to message - */ - public function getSignatureHeaders($body, \Magento\Outbound\UserInterface $user); -} diff --git a/lib/Magento/Outbound/EndpointInterface.php b/lib/Magento/Outbound/EndpointInterface.php deleted file mode 100644 index e0a86c6e2b3821593496862b788076ec10fe4ffc..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/EndpointInterface.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Represents an endpoint to which messages can be sent - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface EndpointInterface -{ - /** - * Data formats - */ - const FORMAT_JSON = 'json'; - - const FORMAT_XML = 'xml'; - - /** Authentication types */ - const AUTH_TYPE_HMAC = 'hmac'; - - const AUTH_TYPE_NONE = 'none'; - - /** - * Returns the endpoint URL of this subscription - * - * @return string - */ - public function getEndpointUrl(); - - /** - * Returns the maximum time in seconds that this subscription is willing to wait before a retry should be attempted - * - * @return int - */ - public function getTimeoutInSecs(); - - /** - * Returns the format this message should be sent in (JSON, XML, etc.) - * - * @return string - */ - public function getFormat(); - - /** - * Returns the user abstraction associated with this subscription or null if no user has been associated yet. - * - * @return \Magento\Outbound\UserInterface|null - */ - public function getUser(); - - /** - * Returns the type of authentication to use when attaching authentication to a message - * - * @return string - */ - public function getAuthenticationType(); -} diff --git a/lib/Magento/Outbound/Formatter/Factory.php b/lib/Magento/Outbound/Formatter/Factory.php deleted file mode 100644 index 2522b4e6b318923bb0ad4039a9979a83976ebab1..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Formatter/Factory.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Factory implementation for the PubSub_FormatterInterface - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -use Magento\ObjectManager; -use Magento\Outbound\FormatterInterface; - -class Factory -{ - /** - * @var ObjectManager - */ - protected $_objectManager; - - /** - * @var array representing the map for formats and formatter classes - */ - protected $_formatterMap = array(); - - /** - * @param array $formatterMap - * @param ObjectManager $objectManager - */ - public function __construct(array $formatterMap, ObjectManager $objectManager) - { - $this->_formatterMap = $formatterMap; - $this->_objectManager = $objectManager; - } - - /** - * Get formatter for specified format - * - * @param string $format - * @return FormatterInterface - * @throws \LogicException - */ - public function getFormatter($format) - { - if (!isset($this->_formatterMap[$format])) { - throw new \LogicException("There is no formatter for the format given: {$format}"); - } - $formatterClassName = $this->_formatterMap[$format]; - - $formatter = $this->_objectManager->get($formatterClassName); - if (!$formatter instanceof FormatterInterface) { - throw new \LogicException("Formatter class for {$format} does not implement FormatterInterface."); - } - return $formatter; - } -} diff --git a/lib/Magento/Outbound/Formatter/Json.php b/lib/Magento/Outbound/Formatter/Json.php deleted file mode 100644 index 7ead0bd109a662b01f52efe6e1e0d9ac6277a21a..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Formatter/Json.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Formatter that converts an array into JSON string. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Formatter; - -class Json implements \Magento\Outbound\FormatterInterface -{ - /** - * The value for the Content-Type header for messages containing a JSON body - */ - const CONTENT_TYPE = 'application/json'; - - /** - * Format the body of a message into JSON - * - * @param array $body - * @throws \LogicException - * @return string formatted body - */ - public function format(array $body) - { - $formattedData = json_encode($body); - if (false === $formattedData) { - throw new \LogicException('The data provided cannot be converted to JSON.'); - } - return $formattedData; - } - - /** - * Returns the content type for JSON formatting - * - * @return string 'application/json' - */ - public function getContentType() - { - return self::CONTENT_TYPE; - } -} diff --git a/lib/Magento/Outbound/FormatterInterface.php b/lib/Magento/Outbound/FormatterInterface.php deleted file mode 100644 index 18b68893c2b06599d918e7171bf8c2d50bab95d9..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/FormatterInterface.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * Formats the body of a message - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface FormatterInterface -{ - /** content type header */ - const CONTENT_TYPE_HEADER = 'Content-Type'; - - /** - * Format the body of a message - * - * @param array $body - * @return string formatted body - */ - public function format(array $body); - - /** - * Returns the content type for the specific formatter - * - * @return string A valid MIME-Type - */ - public function getContentType(); -} diff --git a/lib/Magento/Outbound/Message.php b/lib/Magento/Outbound/Message.php deleted file mode 100644 index ecbe680b4e826dcca3f906babab303282e3e6f9d..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Message.php +++ /dev/null @@ -1,108 +0,0 @@ -<?php -/** - * Message that can be sent to endpoints. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -class Message implements MessageInterface -{ - /** default timeout value in seconds */ - const DEFAULT_TIMEOUT = 20; - - /** - * @var array - */ - protected $_headers = array(); - - /** - * @var string|null - */ - protected $_body; - - /** - * @var int - */ - protected $_timeout; - - /** - * @var string - */ - protected $_endpointUrl; - - /** - * @param string $endpointUrl - * @param array $headers - * @param string|null $body - * @param int $timeout in seconds - */ - public function __construct($endpointUrl, $headers = array(), $body = null, $timeout = self::DEFAULT_TIMEOUT) - { - $this->_endpointUrl = $endpointUrl; - $this->_headers = $headers; - $this->_body = $body; - $this->_timeout = $timeout; - } - - /** - * return endpoint url - * - * @return string - */ - public function getEndpointUrl() - { - return $this->_endpointUrl; - } - - /** - * Return headers array - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * return body - * - * @return string|null - */ - public function getBody() - { - return $this->_body; - } - - /** - * return timeout in seconds - * - * @return int - */ - public function getTimeout() - { - return $this->_timeout; - } -} diff --git a/lib/Magento/Outbound/Message/Factory.php b/lib/Magento/Outbound/Message/Factory.php deleted file mode 100644 index 20c43be8881a2f4b77341192adf0c9d6d84e69cf..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Message/Factory.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php -/** - * Creates new messages - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -use Magento\ObjectManager; -use Magento\Outbound\EndpointInterface; -use Magento\Outbound\FormatterInterface; -use Magento\Outbound\Message; -use Magento\Outbound\Authentication\Factory as AuthenticationFactory; -use Magento\Outbound\Formatter\Factory as FormatterFactory; - -class Factory implements FactoryInterface -{ - /** - * @var ObjectManager - */ - protected $_objectManager; - - /** - * @var FormatterFactory - */ - private $_formatterFactory; - - /** - * @var AuthenticationFactory - */ - private $_authFactory; - - /** - * initialize the class - * - * @param ObjectManager $objectManager - * @param FormatterFactory $formatterFactory - * @param AuthenticationFactory $authFactory - */ - public function __construct( - ObjectManager $objectManager, - FormatterFactory $formatterFactory, - AuthenticationFactory $authFactory - ) { - $this->_objectManager = $objectManager; - $this->_formatterFactory = $formatterFactory; - $this->_authFactory = $authFactory; - } - - /** - * Create a message for a given endpoint, topic and message data - * - * @param EndpointInterface $endpoint - * @param string $topic topic of the message - * @param array $bodyData body of the message - * @return Message - */ - public function create(EndpointInterface $endpoint, $topic, array $bodyData) - { - // Format first since that should turn the body from an array into a string - $formatter = $this->_formatterFactory->getFormatter($endpoint->getFormat()); - $headers = array( - FactoryInterface::TOPIC_HEADER => $topic, - FormatterInterface::CONTENT_TYPE_HEADER => $formatter->getContentType() - ); - $formattedBody = $formatter->format($bodyData); - - $headers = array_merge( - $headers, - $this->_authFactory->getAuthentication( - $endpoint->getAuthenticationType() - )->getSignatureHeaders( - $formattedBody, - $endpoint->getUser() - ) - ); - - return $this->_objectManager->create( - 'Magento\Outbound\Message', - array( - 'endpointUrl' => $endpoint->getEndpointUrl(), - 'headers' => $headers, - 'body' => $formattedBody, - 'timeout' => $endpoint->getTimeoutInSecs() - ) - ); - } -} diff --git a/lib/Magento/Outbound/Message/FactoryInterface.php b/lib/Magento/Outbound/Message/FactoryInterface.php deleted file mode 100644 index baaef67d6b9ef077ebb5f3350a07beafc6757455..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Message/FactoryInterface.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Creates new messages - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Message; - -interface FactoryInterface -{ - /** Topic header */ - const TOPIC_HEADER = 'Magento-Topic'; - - /** - * Create a message for a given endpoint, topic and message data - * - * @param \Magento\Outbound\EndpointInterface $endpoint - * @param string $topic topic of the message - * @param array $bodyData body of the message - * @return \Magento\Outbound\Message - */ - public function create(\Magento\Outbound\EndpointInterface $endpoint, $topic, array $bodyData); -} diff --git a/lib/Magento/Outbound/Transport/Http.php b/lib/Magento/Outbound/Transport/Http.php deleted file mode 100644 index d681f9e064d7ba7f4f22eed06befb07a51565f3b..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Transport/Http.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Dispatches messages over HTTP - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport; - -use Magento\HTTP\Adapter\Curl; -use Magento\Outbound\Message; -use Magento\Outbound\MessageInterface; -use Magento\Outbound\TransportInterface; -use Magento\Outbound\Transport\Http\Response; - -class Http implements TransportInterface -{ - /** - * Http version used by Magento - */ - const HTTP_VERSION = '1.1'; - - /** - * @var Curl - */ - protected $_curl; - - /** - * @param Curl $curl - */ - public function __construct(Curl $curl) - { - $this->_curl = $curl; - } - - /** - * Dispatch message and return response - * - * @param MessageInterface $message - * @return Response - */ - public function dispatch(MessageInterface $message) - { - $config = array('verifypeer' => true, 'verifyhost' => 2); - - $timeout = $message->getTimeout(); - if (!is_null($timeout) && $timeout > 0) { - $config['timeout'] = $timeout; - } else { - $config['timeout'] = Message::DEFAULT_TIMEOUT; - } - $this->_curl->setConfig($config); - - $this->_curl->write( - \Zend_Http_Client::POST, - $message->getEndpointUrl(), - self::HTTP_VERSION, - $this->_prepareHeaders($message->getHeaders()), - $message->getBody() - ); - - return new Response($this->_curl->read()); - } - - /** - * Prepare headers for dispatch - * - * @param string[] $headers - * @return string[] - */ - protected function _prepareHeaders($headers) - { - $result = array(); - foreach ($headers as $headerName => $headerValue) { - $result[] = sprintf('%s: %s', $headerName, $headerValue); - } - return $result; - } -} diff --git a/lib/Magento/Outbound/Transport/Http/Response.php b/lib/Magento/Outbound/Transport/Http/Response.php deleted file mode 100644 index f93615b0cdb05a3273f9eedcd014711aacd0eef5..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/Transport/Http/Response.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Wrapper for \Zend_Http_Response class, provides isSuccessful() method - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound\Transport\Http; - -class Response -{ - /** - * @var \Zend_Http_Response $_response - */ - protected $_response; - - /** - * @param string $string response from an http request - */ - public function __construct($string) - { - $this->_response = \Zend_Http_Response::fromString($string); - } - - /** - * Describes whether response code indicates success - * - * @return bool - */ - public function isSuccessful() - { - return $this->_response->isSuccessful(); - } - - /** - * Gets response status - * - * @return int - */ - public function getStatusCode() - { - return $this->_response->getStatus(); - } - - /** - * Gets response header - * - * @return string - */ - public function getMessage() - { - return $this->_response->getMessage(); - } - - /** - * Gets response body - * - * This class is just hiding the 'getBody' function since calling that after our curl library has already decoded - * the body, could cause an error. A perfect example is if the response for our curl call was gzip'ed, curl would - * have gunzipped it but left the header indicating it was compressed, then \Zend_Http_Response::getBody() would - * attempt to decompress the raw body, which was already decompressed, causing an error/corruption. - * - * @return string - */ - public function getBody() - { - // CURL Doesn't give us access to a truly RAW body, so calling getBody() will fail if Transfer-Encoding is set - return $this->_response->getRawBody(); - } - - /** - * Gets response headers - * - * @return array - */ - public function getHeaders() - { - return $this->_response->getHeaders(); - } - - /** - * Gets a given response header - * - * @param string $headerName - * @return array|null|string - */ - public function getHeader($headerName) - { - return $this->_response->getHeader($headerName); - } -} diff --git a/lib/Magento/Outbound/TransportInterface.php b/lib/Magento/Outbound/TransportInterface.php deleted file mode 100644 index db0f97a48a835f9b885f87178e59d8a7936455f9..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/TransportInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Interface for dispatching messages to subscribers - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface TransportInterface -{ - /** - * Dispatch message and return response - * - * @param \Magento\Outbound\MessageInterface $message - * @return \Magento\Outbound\Transport\Http\Response - */ - public function dispatch(\Magento\Outbound\MessageInterface $message); -} diff --git a/lib/Magento/Outbound/UserInterface.php b/lib/Magento/Outbound/UserInterface.php deleted file mode 100644 index 5d202d9a21231bff07ee1136fadaec0b09fa5a5b..0000000000000000000000000000000000000000 --- a/lib/Magento/Outbound/UserInterface.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * The user is an abstraction for retrieving credentials for Authentication and validating Authorization - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Outbound - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Outbound; - -interface UserInterface -{ - /** - * Returns a shared secret known only by Magento and this user - * - * @return string a shared secret that both the user and Magento know about - */ - public function getSharedSecret(); - - /** - * Checks whether this user has permission for the given topic - * - * @param string $topic topic to check - * @return bool TRUE if permissions exist - */ - public function hasPermission($topic); -} diff --git a/lib/Magento/Phrase.php b/lib/Magento/Phrase.php index ffe027566ab57ce3bd6bd1adf5ecc546b93712ef..5be59e5df78c7f8a807584501d64f30a625ae4c8 100644 --- a/lib/Magento/Phrase.php +++ b/lib/Magento/Phrase.php @@ -80,7 +80,7 @@ class Phrase */ public function render() { - return self::$_renderer ? self::$_renderer->render($this->_text, $this->_arguments) : $this->_text; + return self::$_renderer ? self::$_renderer->render([$this->_text], $this->_arguments) : $this->_text; } /** diff --git a/lib/Magento/Phrase/Renderer/Composite.php b/lib/Magento/Phrase/Renderer/Composite.php index 0cd02bf2adbbf9b73e3e389ef848607ae41690af..621f03d83bd06c59cc42d27b3faa8b20c110c595 100644 --- a/lib/Magento/Phrase/Renderer/Composite.php +++ b/lib/Magento/Phrase/Renderer/Composite.php @@ -51,17 +51,18 @@ class Composite implements RendererInterface } /** - * Render result text + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments = array()) + public function render(array $source, array $arguments = array()) { + $result = $source; foreach ($this->_renderers as $render) { - $text = $render->render($text, $arguments); + $result[] = $render->render($result, $arguments); } - return $text; + return end($result); } } diff --git a/lib/Magento/Phrase/Renderer/Inline.php b/lib/Magento/Phrase/Renderer/Inline.php new file mode 100644 index 0000000000000000000000000000000000000000..4d7d9fa808775f27936e5d0145d13e3f6f1579cc --- /dev/null +++ b/lib/Magento/Phrase/Renderer/Inline.php @@ -0,0 +1,78 @@ +<?php +/** + * Translate Inline Phrase renderer + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Phrase\Renderer; + +class Inline implements \Magento\Phrase\RendererInterface +{ + /** + * @var \Magento\TranslateInterface + */ + protected $translator; + + /** + * @var \Magento\Translate\Inline\ProviderInterface + */ + protected $inlineProvider; + + /** + * @param \Magento\TranslateInterface $translator + * @param \Magento\Translate\Inline\ProviderInterface $inlineProvider + */ + public function __construct( + \Magento\TranslateInterface $translator, + \Magento\Translate\Inline\ProviderInterface $inlineProvider + ) { + $this->translator = $translator; + $this->inlineProvider = $inlineProvider; + } + + /** + * Render source text + * + * @param [] $source + * @param [] $arguments + * @return string + */ + public function render(array $source, array $arguments) + { + $text = end($source); + + if (!$this->inlineProvider->get()->isAllowed()) { + return $text; + } + + if (strpos($text, '{{{') === false + || strpos($text, '}}}') === false + || strpos($text, '}}{{') === false + ) { + $text = '{{{' + . implode('}}{{', array_reverse($source)) + . '}}{{' . $this->translator->getTheme() . '}}}'; + } + + return $text; + } +} diff --git a/lib/Magento/Phrase/Renderer/Placeholder.php b/lib/Magento/Phrase/Renderer/Placeholder.php index 80c38da33ed2062b9a97f65afa7cc04de42d9513..e2cda7057c9014ea2ea639e51580fc442b9837fc 100644 --- a/lib/Magento/Phrase/Renderer/Placeholder.php +++ b/lib/Magento/Phrase/Renderer/Placeholder.php @@ -28,14 +28,16 @@ namespace Magento\Phrase\Renderer; class Placeholder implements \Magento\Phrase\RendererInterface { /** - * {@inheritdoc} + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments) + public function render(array $source, array $arguments) { + $text = end($source); + if ($arguments) { $placeholders = array(); foreach (array_keys($arguments) as $key) { @@ -43,6 +45,7 @@ class Placeholder implements \Magento\Phrase\RendererInterface } $text = str_replace($placeholders, $arguments, $text); } + return $text; } } diff --git a/lib/Magento/Phrase/Renderer/Translate.php b/lib/Magento/Phrase/Renderer/Translate.php index 97d6027c7a5db41c64a913b19fbea42d3ec542b2..89b990cc4a99f0261e77ed68ea8a6636af6c6dba 100644 --- a/lib/Magento/Phrase/Renderer/Translate.php +++ b/lib/Magento/Phrase/Renderer/Translate.php @@ -28,11 +28,9 @@ namespace Magento\Phrase\Renderer; class Translate implements \Magento\Phrase\RendererInterface { /** - * Basic object for translation - * * @var \Magento\TranslateInterface */ - protected $_translator; + protected $translator; /** * Renderer construct @@ -41,20 +39,33 @@ class Translate implements \Magento\Phrase\RendererInterface */ public function __construct(\Magento\TranslateInterface $translator) { - $this->_translator = $translator; + $this->translator = $translator; } /** - * {@inheritdoc} + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments) + public function render(array $source, array $arguments) { - array_unshift($arguments, $text); + $text = end($source); + + $code = $this->translator->getTheme() + . \Magento\View\Service::SCOPE_SEPARATOR + . $text; + + $data = $this->translator->getData(); + + if (array_key_exists($code, $data)) { + return $data[$code]; + } + if (array_key_exists($text, $data)) { + return $data[$text]; + } - return call_user_func(array($this->_translator, 'translate'), $arguments); + return $text; } } diff --git a/lib/Magento/Phrase/RendererInterface.php b/lib/Magento/Phrase/RendererInterface.php index aa9b6526926a4d0171e251d19bf1838f2add7acb..7540d233ac6c36e76ef1424b46f1576e1b3949f5 100644 --- a/lib/Magento/Phrase/RendererInterface.php +++ b/lib/Magento/Phrase/RendererInterface.php @@ -28,11 +28,11 @@ namespace Magento\Phrase; interface RendererInterface { /** - * Render result text + * Render source text * - * @param string $text - * @param array $arguments + * @param [] $source + * @param [] $arguments * @return string */ - public function render($text, array $arguments); + public function render(array $source, array $arguments); } diff --git a/lib/Magento/PubSub/Event.php b/lib/Magento/PubSub/Event.php deleted file mode 100644 index fd1a7cc44c345d682105d2277c9ce2fe10affdb0..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * Represents a PubSub event to be dispatched - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -class Event implements EventInterface -{ - /** - * @var int - */ - protected $_status = EventInterface::STATUS_READY_TO_SEND; - - /** - * @var array - */ - protected $_bodyData; - - /** - * @var array - */ - protected $_headers = array(); - - /** - * @var string - */ - protected $_topic; - - /** - * @param string $topic - * @param array $bodyData - */ - public function __construct($topic, $bodyData) - { - $this->_topic = $topic; - $this->_bodyData = $bodyData; - } - - /** - * Returns the status code of the event. Status indicates if the event has been processed - * or not. - * - * @return int - */ - public function getStatus() - { - return $this->_status; - } - - /** - * Returns a PHP array of data that represents what should be included in the message body. - * - * @return array - */ - public function getBodyData() - { - return $this->_bodyData; - } - - /** - * Prepare headers before return - * - * @return array - */ - public function getHeaders() - { - return $this->_headers; - } - - /** - * Returns a PHP string representing the topic of WebHook - * - * @return string - */ - public function getTopic() - { - return $this->_topic; - } - - /** - * Mark event as processed - * - * @return $this - */ - public function complete() - { - $this->_status = EventInterface::STATUS_PROCESSED; - return $this; - } - - /** - * Mark event as processed - * - * @return $this - */ - public function markAsInProgress() - { - $this->_status = EventInterface::STATUS_IN_PROGRESS; - return $this; - } -} diff --git a/lib/Magento/PubSub/Event/Factory.php b/lib/Magento/PubSub/Event/Factory.php deleted file mode 100644 index 4f313807912195ec5c7ef0998693282ad319c7e5..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event/Factory.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * Stub factory to avoid DI issues. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class Factory implements \Magento\PubSub\Event\FactoryInterface -{ - /** - * Stub won't create an event - * - * @param string $topic Topic on which to publish data - * @param array $data Data to be published. Should only contain primitives - * @return \Magento\PubSub\EventInterface - */ - public function create($topic, $data) - { - return new \Magento\PubSub\Event($topic, $data); - } -} diff --git a/lib/Magento/PubSub/Event/FactoryInterface.php b/lib/Magento/PubSub/Event/FactoryInterface.php deleted file mode 100644 index a7b8d973d80e5ba117233b07f7c42e683b33f4d6..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event/FactoryInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Factory for classes that implement \Magento\PubSub\EventInterface - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface FactoryInterface -{ - /** - * Create new event - * - * @param string $topic Topic on which to publish data - * @param array $data Data to be published. Should only contain primitives - * @return \Magento\PubSub\EventInterface - */ - public function create($topic, $data); -} diff --git a/lib/Magento/PubSub/Event/QueueHandler.php b/lib/Magento/PubSub/Event/QueueHandler.php deleted file mode 100644 index a9d5a25a62b62afd6c2b29896fdf376113f1c016..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event/QueueHandler.php +++ /dev/null @@ -1,95 +0,0 @@ -<?php -/** - * Handles event queue, uses it to build job queue - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -use Magento\PubSub\Job\FactoryInterface as JobFactoryInterface; -use Magento\PubSub\Job\QueueWriterInterface as JobQueueWriterInterface; -use Magento\PubSub\Subscription\CollectionInterface; - -class QueueHandler -{ - /** - * @var QueueReaderInterface - */ - protected $_eventQueue; - - /** - * @var JobQueueWriterInterface - */ - protected $_jobQueue; - - /** - * @var JobFactoryInterface - */ - protected $_jobFactory; - - /** - * @var CollectionInterface - */ - protected $_subscriptionSet; - - /** - * Initialize the class - * - * @param QueueReaderInterface $eventQueue - * @param JobQueueWriterInterface $jobQueue - * @param JobFactoryInterface $jobFactory - * @param CollectionInterface $subscriptionSet - */ - public function __construct( - QueueReaderInterface $eventQueue, - JobQueueWriterInterface $jobQueue, - JobFactoryInterface $jobFactory, - CollectionInterface $subscriptionSet - ) { - $this->_eventQueue = $eventQueue; - $this->_jobQueue = $jobQueue; - $this->_jobFactory = $jobFactory; - $this->_subscriptionSet = $subscriptionSet; - } - - /** - * Build job queue from event queue - * - * @return void - */ - public function handle() - { - $event = $this->_eventQueue->poll(); - while (!is_null($event)) { - $subscriptions = $this->_subscriptionSet->getSubscriptionsByTopic($event->getTopic()); - foreach ($subscriptions as $subscription) { - /** @var $job \Magento\PubSub\JobInterface */ - $job = $this->_jobFactory->create($subscription, $event); - $this->_jobQueue->offer($job); - } - $event->complete(); - $event = $this->_eventQueue->poll(); - } - } -} diff --git a/lib/Magento/PubSub/Event/QueueReaderInterface.php b/lib/Magento/PubSub/Event/QueueReaderInterface.php deleted file mode 100644 index 7f230bcb5cdc20ff2714b9dc3cffd38e377f3f63..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event/QueueReaderInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Represents Event queue for events that still need to be handled - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface QueueReaderInterface -{ - /** - * Return the top event from the queue. - * - * @return \Magento\PubSub\EventInterface|null - */ - public function poll(); -} diff --git a/lib/Magento/PubSub/Event/QueueWriterInterface.php b/lib/Magento/PubSub/Event/QueueWriterInterface.php deleted file mode 100644 index 4ef43a0096bc5b7532e0d44046ad81b78a06a966..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Event/QueueWriterInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Represents Event queue writer for events - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -interface QueueWriterInterface -{ - /** - * Adds the event to the queue. - * - * @param \Magento\PubSub\EventInterface $event - * @return null - */ - public function offer(\Magento\PubSub\EventInterface $event); -} diff --git a/lib/Magento/PubSub/EventInterface.php b/lib/Magento/PubSub/EventInterface.php deleted file mode 100644 index 75631405c93036241459af40da0110266f08d8a9..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/EventInterface.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * Represents a PubSub event to be dispatched - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface EventInterface -{ - /** - * Status is assigned to newly created Event, identify that it is good to be sent to subscribers - */ - const STATUS_READY_TO_SEND = 0; - - /** - * Status is assigned to event when queue handler pick it up for processing - */ - const STATUS_IN_PROGRESS = 1; - - /** - * Status is assigned to event when queue handler successfully processed the event - */ - const STATUS_PROCESSED = 2; - - /** - * Returns the status code of the event. Status indicates if the event has been processed - * or not. - * - * @return int - */ - public function getStatus(); - - /** - * Returns a PHP array of data that represents what should be included in the message body. - * - * @return array - */ - public function getBodyData(); - - /** - * Prepare headers before return - * - * @return array - */ - public function getHeaders(); - - /** - * Returns a PHP string representing the topic of WebHook - * - * @return string - */ - public function getTopic(); - - /** - * Mark event as processed - * - * @return \Magento\PubSub\EventInterface - */ - public function complete(); - - /** - * Mark event as In Progress - * - * @return \Magento\PubSub\Event - */ - public function markAsInProgress(); -} diff --git a/lib/Magento/PubSub/Job/FactoryInterface.php b/lib/Magento/PubSub/Job/FactoryInterface.php deleted file mode 100644 index 057186a79770538c450c3043c4a292cd0f6ff161..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Job/FactoryInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Factory for classes that implement \Magento\PubSub\SubscriptionInterface - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface FactoryInterface -{ - /** - * Create Job - * - * @param \Magento\PubSub\SubscriptionInterface $subscription - * @param \Magento\PubSub\EventInterface $event - * @return \Magento\PubSub\JobInterface|null - */ - public function create(\Magento\PubSub\SubscriptionInterface $subscription, \Magento\PubSub\EventInterface $event); -} diff --git a/lib/Magento/PubSub/Job/QueueHandler.php b/lib/Magento/PubSub/Job/QueueHandler.php deleted file mode 100644 index 6056fc16637255c3c49d2184c828358c340a6a07..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Job/QueueHandler.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Dispatches HTTP messages derived from job queue and handles the responses - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -class QueueHandler -{ - /** - * @var \Magento\PubSub\Job\QueueReaderInterface - */ - protected $_jobQueueReader; - - /** - * @var \Magento\PubSub\Job\QueueWriterInterface - */ - protected $_jobQueueWriter; - - /** - * @var \Magento\Outbound\TransportInterface - */ - protected $_transport; - - /** - * @var \Magento\Outbound\Message\FactoryInterface - */ - protected $_messageFactory; - - /** - * @param \Magento\PubSub\Job\QueueReaderInterface $jobQueueReader - * @param \Magento\PubSub\Job\QueueWriterInterface $jobQueueWriter - * @param \Magento\Outbound\TransportInterface $transport - * @param \Magento\Outbound\Message\FactoryInterface $messageFactory - */ - public function __construct( - \Magento\PubSub\Job\QueueReaderInterface $jobQueueReader, - \Magento\PubSub\Job\QueueWriterInterface $jobQueueWriter, - \Magento\Outbound\TransportInterface $transport, - \Magento\Outbound\Message\FactoryInterface $messageFactory - ) { - $this->_jobQueueReader = $jobQueueReader; - $this->_jobQueueWriter = $jobQueueWriter; - $this->_transport = $transport; - $this->_messageFactory = $messageFactory; - } - - /** - * Process the queue of jobs - * @return null - */ - public function handle() - { - $job = $this->_jobQueueReader->poll(); - while (!is_null($job)) { - $event = $job->getEvent(); - $message = $this->_messageFactory->create( - $job->getSubscription()->getEndpoint(), - $event->getTopic(), - $event->getBodyData() - ); - $response = $this->_transport->dispatch($message); - if ($response->isSuccessful()) { - $job->complete(); - } else { - $job->handleFailure(); - $this->_jobQueueWriter->offer($job); - } - $job = $this->_jobQueueReader->poll(); - } - } -} diff --git a/lib/Magento/PubSub/Job/QueueReaderInterface.php b/lib/Magento/PubSub/Job/QueueReaderInterface.php deleted file mode 100644 index d1e40e40a699fed9788099e8829843c53067b57d..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Job/QueueReaderInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Represents Job Queue for jobs that still need to be run - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface QueueReaderInterface -{ - /** - * Return the top job from the queue. - * - * @return \Magento\PubSub\JobInterface|null - */ - public function poll(); -} diff --git a/lib/Magento/PubSub/Job/QueueWriterInterface.php b/lib/Magento/PubSub/Job/QueueWriterInterface.php deleted file mode 100644 index a4d7da301cc7ea2673414aef03e7aaa28f10cabf..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Job/QueueWriterInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Represents Job queue writer for the jobs - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -interface QueueWriterInterface -{ - /** - * Adds the job to the queue. - * - * @param \Magento\PubSub\JobInterface $job - * @return null - */ - public function offer(\Magento\PubSub\JobInterface $job); -} diff --git a/lib/Magento/PubSub/JobInterface.php b/lib/Magento/PubSub/JobInterface.php deleted file mode 100644 index 2fb6e51e1a825ebc367a75f07b5f46db1919fc1c..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/JobInterface.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Represents a Job that is used to process events and send messages asynchronously - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface JobInterface -{ - /** - * Status is assigned to newly created Job, identify that it is good to be sent to subscriber - */ - const STATUS_READY_TO_SEND = 0; - - /** - * Status is assigned to the Job when queue handler pick it up for processing - */ - const STATUS_IN_PROGRESS = 1; - - /** - * Status is assigned to the Job when queue handler successfully delivered the job to subscriber - */ - const STATUS_SUCCEEDED = 2; - - /** - * Status is assigned to the Job when queue handler failed to delivered the job after N retries - */ - const STATUS_FAILED = 3; - - /** - * Status is assigned to the Job when queue handler failed to delivered the job but will retry more - */ - const STATUS_RETRY = 4; - - /** - * Get the event this job is responsible for processing - * - * @return \Magento\PubSub\EventInterface|null - */ - public function getEvent(); - - /** - * Return the subscription to send a message to - * - * @return \Magento\PubSub\SubscriptionInterface|null - */ - public function getSubscription(); - - /** - * Update the Job status to indicate it has completed successfully - * - * @return \Magento\PubSub\JobInterface - */ - public function complete(); - - /** - * Handle retry on failure logic and update job status accordingly. - * - * @return \Magento\PubSub\JobInterface - */ - public function handleFailure(); - - /** - * Retrieve the status of the Job - * - * @return int - */ - public function getStatus(); - - /** - * Set the status of the Job - * - * @param int $status - * @return \Magento\PubSub\JobInterface - */ - public function setStatus($status); -} diff --git a/lib/Magento/PubSub/Message/DispatcherAsync.php b/lib/Magento/PubSub/Message/DispatcherAsync.php deleted file mode 100644 index b08d84dd07ad0f784fb5f196f31e24c591c79b39..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Message/DispatcherAsync.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Entry point to the dispatch event functionality for the cases in which the queueing is needed - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -use Magento\PubSub\Event\FactoryInterface; -use Magento\PubSub\Event\QueueWriterInterface; - -class DispatcherAsync implements DispatcherAsyncInterface -{ - /** @var FactoryInterface */ - protected $_eventFactory; - - /** @var QueueWriterInterface */ - protected $_eventQueue; - - /** - * @param FactoryInterface $eventFactory - * @param QueueWriterInterface $eventQueue - */ - public function __construct(FactoryInterface $eventFactory, QueueWriterInterface $eventQueue) - { - $this->_eventFactory = $eventFactory; - $this->_eventQueue = $eventQueue; - } - - /** - * Dispatch event with given topic and data - * - * @param string $topic - * @param array $data should only contain primitives, no objects. - * @return void - */ - public function dispatch($topic, $data) - { - $event = $this->_eventFactory->create($topic, $data); - $this->_eventQueue->offer($event); - } -} diff --git a/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php b/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php deleted file mode 100644 index 5dfaff943ebbb6fe596b6824fd91f308d0877d19..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Message/DispatcherAsyncInterface.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Guarantees asynchronous delivery of messages being dispatched. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Message; - -interface DispatcherAsyncInterface -{ - /** - * Dispatch some data on a given topic - * - * @param string $topic - * @param array $data should only contain primitives, no objects. - * @return void - */ - public function dispatch($topic, $data); -} diff --git a/lib/Magento/PubSub/Subscription/CollectionInterface.php b/lib/Magento/PubSub/Subscription/CollectionInterface.php deleted file mode 100644 index a85f336e06a1ddd338ba6fdfa34809fcde9add33..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/Subscription/CollectionInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Service for querying Subscriptions - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Subscription; - -interface CollectionInterface -{ - /** - * Return all subscriptions by topic - * - * @param string $topic - * @return \Magento\PubSub\SubscriptionInterface[] - */ - public function getSubscriptionsByTopic($topic); -} diff --git a/lib/Magento/PubSub/SubscriptionInterface.php b/lib/Magento/PubSub/SubscriptionInterface.php deleted file mode 100644 index 3860c9f20557d91841ffb124823ac65a564c5b59..0000000000000000000000000000000000000000 --- a/lib/Magento/PubSub/SubscriptionInterface.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * Represents a subscription to one or more topics - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_PubSub - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub; - -interface SubscriptionInterface extends \Magento\Outbound\EndpointInterface -{ - const STATUS_INACTIVE = 0; - - const STATUS_ACTIVE = 1; - - const STATUS_REVOKED = 2; - - /** - * Returns a list of topics that this Subscription is subscribed to - * - * @return string[] - */ - public function getTopics(); - - /** - * Determines if the subscription is subscribed to a topic. - * - * @param string $topic The topic to check - * @return boolean True if subscribed, false otherwise - */ - public function hasTopic($topic); - - /** - * Get the status of this endpoint - * - * @return int Should match one of the status constants in \Magento\PubSub\SubscriptionInterface - */ - public function getStatus(); - - /** - * Mark this subscription status as deactivated - * - * @return \Magento\PubSub\SubscriptionInterface The deactivated subscription - */ - public function deactivate(); - - /** - * Mark this subscription status to activated - * - * @return \Magento\PubSub\SubscriptionInterface The activated subscription - */ - public function activate(); - - /** - * Mark this subscription status to revoked - * - * @return \Magento\PubSub\SubscriptionInterface The revoked subscription - */ - public function revoke(); - - /** - * Return endpoint with the subscription - * - * @return \Magento\Outbound\EndpointInterface - */ - public function getEndpoint(); -} diff --git a/lib/Magento/Translate.php b/lib/Magento/Translate.php index c8abd348b313c6f00e33a84fe4ea2fee2ee9dc17..4299bba58dd29d088a65bf23f7e8adf8d19fa7ff 100644 --- a/lib/Magento/Translate.php +++ b/lib/Magento/Translate.php @@ -31,36 +31,6 @@ namespace Magento; */ class Translate implements \Magento\TranslateInterface { - /** - * CSV separator - */ - const CSV_SEPARATOR = ','; - - /** - * Scope separator - */ - const SCOPE_SEPARATOR = '::'; - - /** - * Configuration area key - */ - const CONFIG_KEY_AREA = 'area'; - - /** - * Configuration locale key - */ - const CONFIG_KEY_LOCALE = 'locale'; - - /** - * Configuration scope key - */ - const CONFIG_KEY_SCOPE = 'scope'; - - /** - * Configuration theme key - */ - const CONFIG_KEY_DESIGN_THEME = 'theme'; - /** * Locale code * @@ -85,9 +55,9 @@ class Translate implements \Magento\TranslateInterface /** * Translation data * - * @var array + * @var [] */ - protected $_data = array(); + protected $_data = []; /** * Translation data for data scope (per module) @@ -96,42 +66,18 @@ class Translate implements \Magento\TranslateInterface */ protected $_dataScope; - /** - * Configuration flag to enable inline translations - * - * @var boolean - */ - protected $_translateInline; - - /** - * @var \Magento\Translate\InlineInterface - */ - protected $_inlineInterface; - - /** - * Configuration flag to local enable inline translations - * - * @var boolean - */ - protected $_canUseInline = true; - /** * Locale hierarchy (empty by default) * * @var array */ - protected $_localeHierarchy = array(); + protected $_localeHierarchy = []; /** * @var \Magento\View\DesignInterface */ protected $_viewDesign; - /** - * @var \Magento\Translate\Factory - */ - protected $_translateFactory; - /** * @var \Magento\Cache\FrontendInterface $cache */ @@ -142,11 +88,6 @@ class Translate implements \Magento\TranslateInterface */ protected $_viewFileSystem; - /** - * @var \Magento\Phrase\Renderer\Placeholder - */ - protected $_placeholderRender; - /** * @var \Magento\Module\ModuleList */ @@ -177,30 +118,21 @@ class Translate implements \Magento\TranslateInterface */ protected $_appState; - /** - * @var \Magento\App\Filesystem - */ - protected $filesystem; - /** * @var \Magento\Filesystem\Directory\Read */ protected $directory; /** - * Event manager - * - * @var \Magento\Event\ManagerInterface + * @var App\RequestInterface */ - protected $_eventManager; + protected $request; /** * @param \Magento\View\DesignInterface $viewDesign * @param \Magento\Locale\Hierarchy\Config $config - * @param \Magento\Translate\Factory $translateFactory * @param \Magento\Cache\FrontendInterface $cache * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\Phrase\Renderer\Placeholder $placeholderRender * @param \Magento\Module\ModuleList $moduleList * @param \Magento\Module\Dir\Reader $modulesReader * @param \Magento\BaseScopeResolverInterface $scopeResolver @@ -208,17 +140,15 @@ class Translate implements \Magento\TranslateInterface * @param \Magento\Locale\ResolverInterface $locale * @param \Magento\App\State $appState * @param \Magento\App\Filesystem $filesystem - * @param \Magento\Event\ManagerInterface $eventManager + * @param App\RequestInterface $request * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\View\DesignInterface $viewDesign, \Magento\Locale\Hierarchy\Config $config, - \Magento\Translate\Factory $translateFactory, \Magento\Cache\FrontendInterface $cache, \Magento\View\FileSystem $viewFileSystem, - \Magento\Phrase\Renderer\Placeholder $placeholderRender, \Magento\Module\ModuleList $moduleList, \Magento\Module\Dir\Reader $modulesReader, \Magento\BaseScopeResolverInterface $scopeResolver, @@ -226,39 +156,34 @@ class Translate implements \Magento\TranslateInterface \Magento\Locale\ResolverInterface $locale, \Magento\App\State $appState, \Magento\App\Filesystem $filesystem, - \Magento\Event\ManagerInterface $eventManager + \Magento\App\RequestInterface $request ) { $this->_viewDesign = $viewDesign; - $this->_localeHierarchy = $config->getHierarchy(); - $this->_translateFactory = $translateFactory; $this->_cache = $cache; $this->_viewFileSystem = $viewFileSystem; - $this->_placeholderRender = $placeholderRender; $this->_moduleList = $moduleList; $this->_modulesReader = $modulesReader; $this->_scopeResolver = $scopeResolver; $this->_translateResource = $translate; $this->_locale = $locale; $this->_appState = $appState; - $this->filesystem = $filesystem; + $this->request = $request; $this->directory = $filesystem->getDirectoryRead(\Magento\App\Filesystem::ROOT_DIR); - $this->_eventManager = $eventManager; + $this->_localeHierarchy = $config->getHierarchy(); } /** - * Initialization translation data + * Initialize translation data * - * @param string $area - * @param \Magento\Object $initParams + * @param string|null $area * @param bool $forceReload * @return $this */ - public function init($area = null, $initParams = null, $forceReload = false) + public function loadData($area = null, $forceReload = false) { - $area = isset($area) ? $area : $this->_appState->getAreaCode(); - $this->setConfig(array(self::CONFIG_KEY_AREA => $area)); - - $this->_translateInline = $this->getInlineObject($initParams)->isAllowed(); + $this->setConfig( + ['area' => isset($area) ? $area : $this->_appState->getAreaCode()] + ); if (!$forceReload) { $this->_data = $this->_loadCache(); @@ -266,14 +191,12 @@ class Translate implements \Magento\TranslateInterface return $this; } } - - $this->_data = array(); + $this->_data = []; foreach ($this->_moduleList->getModules() as $module) { $this->_loadModuleTranslation($module['name']); } - - $this->_loadThemeTranslation($forceReload, $area); + $this->_loadThemeTranslation($forceReload); $this->_loadDbTranslation($forceReload); if (!$forceReload) { @@ -292,18 +215,29 @@ class Translate implements \Magento\TranslateInterface protected function setConfig($config) { $this->_config = $config; - if (!isset($this->_config[self::CONFIG_KEY_LOCALE])) { - $this->_config[self::CONFIG_KEY_LOCALE] = $this->getLocale(); + if (!isset($this->_config['locale'])) { + $this->_config['locale'] = $this->getLocale(); } - if (!isset($this->_config[self::CONFIG_KEY_SCOPE])) { - $this->_config[self::CONFIG_KEY_SCOPE] = $this->_scopeResolver->getScope()->getCode(); + if (!isset($this->_config['scope'])) { + $this->_config['scope'] = $this->getScope(); } - if (!isset($this->_config[self::CONFIG_KEY_DESIGN_THEME])) { - $this->_config[self::CONFIG_KEY_DESIGN_THEME] = $this->_viewDesign->getDesignTheme()->getId(); + if (!isset($this->_config['theme'])) { + $this->_config['theme'] = $this->_viewDesign->getDesignTheme()->getId(); } return $this; } + /** + * Retrieve scope code + * + * @return string + */ + protected function getScope() + { + $scope = ($this->getConfig('area') == 'adminhtml') ? 'admin' : null; + return $this->_scopeResolver->getScope($scope)->getCode(); + } + /** * Retrieve config value by key * @@ -318,17 +252,6 @@ class Translate implements \Magento\TranslateInterface return null; } - /** - * Determine if translation is enabled and allowed. - * - * @param mixed $scope - * @return bool - */ - public function isAllowed($scope = null) - { - return $this->getInlineObject()->isAllowed($scope); - } - /** * Load data from module translation files * @@ -374,20 +297,22 @@ class Translate implements \Magento\TranslateInterface if ($key === $value) { continue; } - $key = $this->_prepareDataString($key); - $value = $this->_prepareDataString($value); + + $key = str_replace('""', '"', $key); + $value = str_replace('""', '"', $value); + if ($scope && isset($this->_dataScope[$key]) && !$forceReload) { /** * Checking previous value */ - $scopeKey = $this->_dataScope[$key] . self::SCOPE_SEPARATOR . $key; + $scopeKey = $this->_dataScope[$key] . \Magento\View\Service::SCOPE_SEPARATOR . $key; if (!isset($this->_data[$scopeKey])) { if (isset($this->_data[$key])) { $this->_data[$scopeKey] = $this->_data[$key]; unset($this->_data[$key]); } } - $scopeKey = $scope . self::SCOPE_SEPARATOR . $key; + $scopeKey = $scope . \Magento\View\Service::SCOPE_SEPARATOR . $key; $this->_data[$scopeKey] = $value; } else { $this->_data[$key] = $value; @@ -397,38 +322,22 @@ class Translate implements \Magento\TranslateInterface return $this; } - /** - * Prepare data string - * - * @param string $string - * @return string - */ - protected function _prepareDataString($string) - { - return str_replace('""', '"', $string); - } - /** * Load current theme translation * * @param bool $forceReload - * @param string|null $area * @return $this */ - protected function _loadThemeTranslation($forceReload = false, $area = null) + protected function _loadThemeTranslation($forceReload = false) { - if (!$this->_config[self::CONFIG_KEY_DESIGN_THEME]) { + if (!$this->_config['theme']) { return $this; } $requiredLocaleList = $this->_composeRequiredLocaleList($this->getLocale()); foreach ($requiredLocaleList as $locale) { - $file = $this->_getThemeTranslationFile($locale, $area); - $this->_addData( - $this->_getFileData($file), - self::CONFIG_KEY_DESIGN_THEME . $this->_config[self::CONFIG_KEY_DESIGN_THEME], - $forceReload - ); + $file = $this->_getThemeTranslationFile($locale); + $this->_addData($this->_getFileData($file), 'theme' . $this->_config['theme'], $forceReload); } return $this; } @@ -444,7 +353,7 @@ class Translate implements \Magento\TranslateInterface $requiredLocaleList = $this->_composeRequiredLocaleList($this->getLocale()); foreach ($requiredLocaleList as $locale) { $arr = $this->_translateResource->getTranslationArray(null, $locale); - $this->_addData($arr, $this->getConfig(self::CONFIG_KEY_SCOPE), $forceReload); + $this->_addData($arr, $this->getConfig('scope'), $forceReload); } return $this; } @@ -467,15 +376,13 @@ class Translate implements \Magento\TranslateInterface * Retrieve translation file for theme * * @param string $locale - * @param string|null $area * @return string */ - protected function _getThemeTranslationFile($locale, $area = null) + protected function _getThemeTranslationFile($locale) { - $area = isset($area) ? $area : $this->_appState->getAreaCode(); return $this->_viewFileSystem->getFilename( \Magento\App\Filesystem::LOCALE_DIR . '/' . $locale . '.csv', - array('area' => $area) + ['area' => $this->getConfig('area')] ); } @@ -490,7 +397,7 @@ class Translate implements \Magento\TranslateInterface $data = array(); if ($this->directory->isExist($this->directory->getRelativePath($file))) { $parser = new \Magento\File\Csv(); - $parser->setDelimiter(self::CSV_SEPARATOR); + $parser->setDelimiter(','); $data = $parser->getDataPairs($file); } return $data; @@ -501,7 +408,7 @@ class Translate implements \Magento\TranslateInterface * * @return array */ - protected function getData() + public function getData() { if (is_null($this->_data)) { return array(); @@ -514,7 +421,7 @@ class Translate implements \Magento\TranslateInterface * * @return string */ - protected function getLocale() + public function getLocale() { if (null === $this->_localeCode) { $this->_localeCode = $this->_locale->getLocaleCode(); @@ -526,7 +433,7 @@ class Translate implements \Magento\TranslateInterface * Set locale * * @param string $locale - * @return $this + * @return \Magento\TranslateInterface */ public function setLocale($locale) { @@ -535,83 +442,17 @@ class Translate implements \Magento\TranslateInterface } /** - * Translate + * Retrieve theme code * - * @param array $args * @return string - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function translate($args) - { - $text = array_shift($args); - - if ($this->_isEmptyTranslateArg($text)) { - return ''; - } - - if (!empty($_REQUEST['theme'])) { - $module = self::CONFIG_KEY_DESIGN_THEME . $_REQUEST['theme']['theme_title']; - } else { - $module = self::CONFIG_KEY_DESIGN_THEME . $this->_config[self::CONFIG_KEY_DESIGN_THEME]; - } - $code = $module . self::SCOPE_SEPARATOR . $text; - $translated = $this->_getTranslatedString($text, $code); - $result = $this->_placeholderRender->render($translated, $args); - - if ($this->_translateInline && $this->getTranslateInline()) { - if (strpos( - $result, - '{{{' - ) === false || strpos( - $result, - '}}}' - ) === false || strpos( - $result, - '}}{{' - ) === false - ) { - $result = '{{{' . $result . '}}{{' . $translated . '}}{{' . $text . '}}{{' . $module . '}}}'; - } - } - return $result; - } - - /** - * Check is empty translate argument - * - * @param mixed $text - * @return bool */ - protected function _isEmptyTranslateArg($text) + public function getTheme() { - if (is_object($text) && is_callable(array($text, 'getText'))) { - $text = $text->getText(); + $theme = $this->request->getParam('theme'); + if (empty($theme)) { + return 'theme' . $this->getConfig('theme'); } - return empty($text); - } - - /** - * Set Translate inline mode - * - * @param bool $flag - * @return $this - */ - public function setTranslateInline($flag = false) - { - $this->_canUseInline = $flag; - return $this; - } - - /** - * Retrieve active translate mode - * - * @return bool - * @SuppressWarnings(PHPMD.BooleanGetMethodName) - */ - public function getTranslateInline() - { - return $this->_canUseInline; + return 'theme' . $theme['theme_title']; } /** @@ -621,19 +462,19 @@ class Translate implements \Magento\TranslateInterface */ protected function getCacheId() { - if (is_null($this->_cacheId)) { + if ($this->_cacheId === null) { $this->_cacheId = \Magento\App\Cache\Type\Translate::TYPE_IDENTIFIER; - if (isset($this->_config[self::CONFIG_KEY_LOCALE])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_LOCALE]; + if (isset($this->_config['locale'])) { + $this->_cacheId .= '_' . $this->_config['locale']; } - if (isset($this->_config[self::CONFIG_KEY_AREA])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_AREA]; + if (isset($this->_config['area'])) { + $this->_cacheId .= '_' . $this->_config['area']; } - if (isset($this->_config[self::CONFIG_KEY_SCOPE])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_SCOPE]; + if (isset($this->_config['scope'])) { + $this->_cacheId .= '_' . $this->_config['scope']; } - if (isset($this->_config[self::CONFIG_KEY_DESIGN_THEME])) { - $this->_cacheId .= '_' . $this->_config[self::CONFIG_KEY_DESIGN_THEME]; + if (isset($this->_config['theme'])) { + $this->_cacheId .= '_' . $this->_config['theme']; } } return $this->_cacheId; @@ -663,64 +504,4 @@ class Translate implements \Magento\TranslateInterface $this->_cache->save(serialize($this->getData()), $this->getCacheId(), array(), false); return $this; } - - /** - * Return translated string from text. - * - * @param string $text - * @param string $code - * @return string - */ - protected function _getTranslatedString($text, $code) - { - if (array_key_exists($code, $this->getData())) { - $translated = $this->_data[$code]; - } elseif (array_key_exists($text, $this->getData())) { - $translated = $this->_data[$text]; - } else { - $translated = $text; - } - return $translated; - } - - /** - * Returns the translate interface object. - * - * @param \Magento\Object $initParams - * @return \Magento\Translate\InlineInterface - */ - protected function getInlineObject($initParams = null) - { - if (null === $this->_inlineInterface) { - if ($initParams === null) { - $this->_inlineInterface = $this->_translateFactory->create(); - } else { - $this->_inlineInterface = $this->_translateFactory->create( - $initParams->getParams(), - $initParams->getInlineType() - ); - } - } - return $this->_inlineInterface; - } - - /** - * This method initializes the Translate object for this instance. - * - * @param string $localeCode - * @param string|null $area - * @return \Magento\TranslateInterface - */ - public function initLocale($localeCode, $area = null) - { - $this->setLocale($localeCode); - - $dispatchResult = new \Magento\Object(array('inline_type' => null)); - $this->_eventManager->dispatch( - 'translate_initialization_before', - array('translate_object' => $this, 'result' => $dispatchResult) - ); - $this->init($area, $dispatchResult, true); - return $this; - } } diff --git a/lib/Magento/Translate/Factory.php b/lib/Magento/Translate/Factory.php deleted file mode 100644 index d776e49a9b24f8eb5ae7b0ea235db0e7cbb700d1..0000000000000000000000000000000000000000 --- a/lib/Magento/Translate/Factory.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Translate factory - */ -namespace Magento\Translate; - -class Factory -{ - /** - * Default translate inline class name - */ - const DEFAULT_CLASS_NAME = 'Magento\Translate\InlineInterface'; - - /** - * Object Manager - * - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Object constructor - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Return instance of inline translate object based on passed in class name. - * - * @param array $data - * @param string $className - * @throws \InvalidArgumentException - * @return \Magento\Translate\InlineInterface - */ - public function create(array $data = null, $className = null) - { - if ($className === null) { - $className = self::DEFAULT_CLASS_NAME; - } - $model = $this->_objectManager->get($className, $data); - if (!$model instanceof \Magento\Translate\InlineInterface) { - throw new \InvalidArgumentException('Invalid inline translate model: ' . $className); - } - return $model; - } -} diff --git a/lib/Magento/Translate/Inline.php b/lib/Magento/Translate/Inline.php index 3645abf2c92050c8798be69d9a31ef144a1f1673..c40e588b49cd1ed4ad00ff9200b5bb32d70c96a6 100644 --- a/lib/Magento/Translate/Inline.php +++ b/lib/Magento/Translate/Inline.php @@ -29,134 +29,123 @@ use Magento\BaseScopeInterface; class Inline implements \Magento\Translate\InlineInterface { - /** - * Regular Expression for detected and replace translate - * - * @var string - */ - protected $_tokenRegex = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; - - /** - * @var \Magento\TranslateInterface - */ - protected $_translator; - /** * Indicator to hold state of whether inline translation is allowed * * @var bool */ - protected $_isAllowed; + protected $isAllowed; /** - * @var \Magento\Translate\Inline\ParserFactory + * @var \Magento\Translate\Inline\ParserInterface */ - protected $_parserFactory; + protected $parser; /** * Flag about inserted styles and scripts for inline translates * * @var bool */ - protected $_isScriptInserted = false; + protected $isScriptInserted = false; /** * @var \Magento\UrlInterface */ - protected $_url; + protected $url; /** * @var \Magento\View\LayoutInterface */ - protected $_layout; + protected $layout; /** - * @var \Magento\App\State + * @var \Magento\Translate\Inline\ConfigInterface */ - protected $_appState; + protected $config; /** - * @var \Magento\Translate\Inline\ConfigFactory + * @var \Magento\BaseScopeResolverInterface */ - protected $_configFactory; + protected $scopeResolver; /** - * @var \Magento\BaseScopeResolverInterface + * @var string */ - protected $_scopeResolver; + protected $templateFileName; /** * @var string */ - protected $_templateFileName = ''; + protected $translatorRoute; /** - * @var string + * @var null|string */ - protected $_translatorRoute = ''; + protected $scope; + + /** + * @var Inline\StateInterface + */ + protected $state; /** - * Initialize inline translation model - * * @param \Magento\BaseScopeResolverInterface $scopeResolver - * @param \Magento\Translate\Inline\ParserFactory $parserFactory - * @param \Magento\TranslateInterface $translate * @param \Magento\UrlInterface $url * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Translate\Inline\ConfigFactory $configFactory - * @param \Magento\App\State $appState + * @param Inline\ConfigInterface $config + * @param Inline\ParserInterface $parser + * @param Inline\StateInterface $state * @param string $templateFileName * @param string $translatorRoute + * @param null $scope */ public function __construct( \Magento\BaseScopeResolverInterface $scopeResolver, - \Magento\Translate\Inline\ParserFactory $parserFactory, - \Magento\TranslateInterface $translate, \Magento\UrlInterface $url, \Magento\View\LayoutInterface $layout, - \Magento\Translate\Inline\ConfigFactory $configFactory, - \Magento\App\State $appState, + \Magento\Translate\Inline\ConfigInterface $config, + \Magento\Translate\Inline\ParserInterface $parser, + \Magento\Translate\Inline\StateInterface $state, $templateFileName = '', - $translatorRoute = '' + $translatorRoute = '', + $scope = null ) { - $this->_scopeResolver = $scopeResolver; - $this->_configFactory = $configFactory; - $this->_parserFactory = $parserFactory; - $this->_translator = $translate; - $this->_url = $url; - $this->_layout = $layout; - $this->_appState = $appState; - $this->_templateFileName = $templateFileName; - $this->_translatorRoute = $translatorRoute; + $this->scopeResolver = $scopeResolver; + $this->url = $url; + $this->layout = $layout; + $this->config = $config; + $this->parser = $parser; + $this->state = $state; + $this->templateFileName = $templateFileName; + $this->translatorRoute = $translatorRoute; + $this->scope = $scope; } /** - * Is enabled and allowed Inline Translates + * Check if Inline Translates is allowed * - * @param BaseScopeInterface|int|null $scope * @return bool */ - public function isAllowed($scope = null) + public function isAllowed() { - if (is_null($this->_isAllowed)) { - if (!$scope instanceof BaseScopeInterface) { - $scope = $this->_scopeResolver->getScope($scope); + if ($this->isAllowed === null) { + if (!$this->scope instanceof BaseScopeInterface) { + $scope = $this->scopeResolver->getScope($this->scope); } - - $config = $this->_configFactory->get(); - $this->_isAllowed = $config->isActive($scope) && $config->isDevAllowed($scope); + $this->isAllowed = $this->config->isActive($scope) + && $this->config->isDevAllowed($scope); } - return $this->_translator->getTranslateInline() && $this->_isAllowed; + return $this->state->isEnabled() && $this->isAllowed; } /** - * Disable inline translation functionality + * Retrieve Inline Parser instance * - * @return void + * @return Inline\ParserInterface */ - public function disable() + public function getParser() { - $this->_isAllowed = false; + return $this->parser; } /** @@ -168,22 +157,25 @@ class Inline implements \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false) { - $parser = $this->_parserFactory->get(); - $parser->setIsJson($isJson); - if (!$this->isAllowed()) { + if ($this->scope == 'admin' && !$this->isAllowed()) { + $this->stripInlineTranslations($body); return $this; } + $this->getParser()->setIsJson($isJson); + if (is_array($body)) { foreach ($body as &$part) { $this->processResponseBody($part, $isJson); } } elseif (is_string($body)) { - $content = $parser->processResponseBodyString($body, $this); - $this->_insertInlineScriptsHtml($content); - $body = $parser->getContent(); + $this->getParser()->processResponseBodyString($body); + $this->addInlineScript(); + $body = $this->getParser()->getContent(); } - $parser->setIsJson(\Magento\Translate\Inline\ParserInterface::JSON_FLAG_DEFAULT_STATE); + + $this->getParser()->setIsJson(false); + return $this; } @@ -199,29 +191,42 @@ class Inline implements \Magento\Translate\InlineInterface } /** - * Create block to render script and html with added inline translation content. + * Add inline script code + * + * Insert script and html with + * added inline translation content. * - * @param string $content * @return void */ - protected function _insertInlineScriptsHtml($content) + protected function addInlineScript() { - if ($this->_isScriptInserted || stripos($content, '</body>') === false) { + $content = $this->getParser()->getContent(); + if (stripos($content, '</body>') === false) { return; } + if (!$this->isScriptInserted) { + $this->getParser()->setContent(str_ireplace('</body>', $this->getInlineScript() . '</body>', $content)); + $this->isScriptInserted = true; + } + } + /** + * Retrieve inline script code + * + * Create block to render script and html with + * added inline translation content. + * + * @return string + */ + protected function getInlineScript() + { /** @var $block \Magento\View\Element\Template */ - $block = $this->_layout->createBlock('Magento\View\Element\Template'); - - $block->setAjaxUrl($this->_getAjaxUrl()); - - $block->setTemplate($this->_templateFileName); - - $html = $block->toHtml(); + $block = $this->layout->createBlock('Magento\View\Element\Template'); - $this->_parserFactory->get()->setContent(str_ireplace('</body>', $html . '</body>', $content)); + $block->setAjaxUrl($this->getAjaxUrl()); + $block->setTemplate($this->templateFileName); - $this->_isScriptInserted = true; + return $block->toHtml(); } /** @@ -229,10 +234,12 @@ class Inline implements \Magento\Translate\InlineInterface * * @return string */ - protected function _getAjaxUrl() + protected function getAjaxUrl() { - $scope = $this->_scopeResolver->getScope(); - return $this->_url->getUrl($this->_translatorRoute, array('_secure' => $scope->isCurrentlySecure())); + return $this->url->getUrl( + $this->translatorRoute, + ['_secure' => $this->scopeResolver->getScope()->isCurrentlySecure()] + ); } /** @@ -241,14 +248,14 @@ class Inline implements \Magento\Translate\InlineInterface * @param array|string &$body * @return $this */ - protected function _stripInlineTranslations(&$body) + protected function stripInlineTranslations(&$body) { if (is_array($body)) { foreach ($body as &$part) { - $this->_stripInlineTranslations($part); + $this->stripInlineTranslations($part); } } else if (is_string($body)) { - $body = preg_replace('#' . $this->_tokenRegex . '#', '$1', $body); + $body = preg_replace('#' . \Magento\Translate\Inline\ParserInterface::REGEXP_TOKEN . '#', '$1', $body); } return $this; } diff --git a/lib/Magento/Translate/Inline/ConfigInterface.php b/lib/Magento/Translate/Inline/ConfigInterface.php index 602795dff471725423b2e9f7e17a696fbd4018ac..e11b50272a6eaa17b10c4509ccfc8d32c8a4bed2 100644 --- a/lib/Magento/Translate/Inline/ConfigInterface.php +++ b/lib/Magento/Translate/Inline/ConfigInterface.php @@ -30,7 +30,7 @@ interface ConfigInterface /** * Check whether inline translation is enabled * - * @param int|null $scope + * @param null|string|bool|int|\Magento\Core\Model\Store $scope * @return bool */ public function isActive($scope = null); @@ -38,7 +38,7 @@ interface ConfigInterface /** * Check whether allowed client ip for inline translation * - * @param mixed $scope + * @param null|string|bool|int|\Magento\Core\Model\Store $scope * @return bool */ public function isDevAllowed($scope = null); diff --git a/lib/Magento/Translate/Inline/ParserFactory.php b/lib/Magento/Translate/Inline/ParserFactory.php index 22f3cb38db8c6bfcde4cb209c52a319848b16d20..5b61f797c10e8d2d31ad7dfeaab1ebe629fa5af4 100644 --- a/lib/Magento/Translate/Inline/ParserFactory.php +++ b/lib/Magento/Translate/Inline/ParserFactory.php @@ -27,6 +27,11 @@ namespace Magento\Translate\Inline; class ParserFactory { + /** + * Default instance type + */ + const DEFAULT_INSTANCE_TYPE = 'Magento\Translate\Inline\ParserInterface'; + /** * Object Manager * @@ -50,15 +55,15 @@ class ParserFactory */ public function get() { - return $this->_objectManager->get('Magento\Translate\Inline\ParserInterface'); + return $this->_objectManager->get(self::DEFAULT_INSTANCE_TYPE); } /** - * @param array $data + * @param array $arguments * @return \Magento\Translate\Inline\ParserInterface */ - public function create(array $data = null) + public function create(array $arguments = array()) { - return $this->_objectManager->create('Magento\Translate\Inline\ParserInterface', $data); + return $this->_objectManager->create(self::DEFAULT_INSTANCE_TYPE, $arguments); } } diff --git a/lib/Magento/Translate/Inline/ParserInterface.php b/lib/Magento/Translate/Inline/ParserInterface.php index b9265c685f70d4d7268bb453e865bc15c5e492d2..fe20466db7030e022eafe0e41c770f277996aa9a 100644 --- a/lib/Magento/Translate/Inline/ParserInterface.php +++ b/lib/Magento/Translate/Inline/ParserInterface.php @@ -26,9 +26,9 @@ namespace Magento\Translate\Inline; interface ParserInterface { /** - * Default state for jason flag + * Regular Expression for detected and replace translate */ - const JSON_FLAG_DEFAULT_STATE = false; + const REGEXP_TOKEN = '\{\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\{\{(.*?)\}\}\}'; /** * Parse and save edited translation diff --git a/lib/Magento/Translate/Inline/ConfigFactory.php b/lib/Magento/Translate/Inline/Provider.php similarity index 68% rename from lib/Magento/Translate/Inline/ConfigFactory.php rename to lib/Magento/Translate/Inline/Provider.php index 503f602662a207360d91b6b2cdde1b517f199347..44911077b6dc4d6cfbf06aeead8ca3c3aa408d36 100644 --- a/lib/Magento/Translate/Inline/ConfigFactory.php +++ b/lib/Magento/Translate/Inline/Provider.php @@ -1,7 +1,5 @@ <?php /** - * Inline Translation config factory - * * Magento * * NOTICE OF LICENSE @@ -23,30 +21,31 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Translate\Inline; -class ConfigFactory +class Provider implements ProviderInterface { /** - * @var \Magento\ObjectManager + * @var \Magento\Translate\InlineInterface */ - protected $_objectManager; + protected $inlineTranslate; /** - * @param \Magento\ObjectManager $objectManager + * @param \Magento\Translate\InlineInterface $inlineTranslate */ - public function __construct(\Magento\ObjectManager $objectManager) + public function __construct(\Magento\Translate\InlineInterface $inlineTranslate) { - $this->_objectManager = $objectManager; + $this->inlineTranslate = $inlineTranslate; } /** - * Get instance of inline translate config + * Return instance of inline translate class * - * @return \Magento\Translate\Inline\ConfigInterface + * @return \Magento\Translate\InlineInterface */ public function get() { - return $this->_objectManager->get('Magento\Translate\Inline\ConfigInterface'); + return $this->inlineTranslate; } } diff --git a/lib/Magento/LauncherInterface.php b/lib/Magento/Translate/Inline/ProviderInterface.php similarity index 67% rename from lib/Magento/LauncherInterface.php rename to lib/Magento/Translate/Inline/ProviderInterface.php index 52c70a45f86d4401983715f0a8742b33c20d96d7..0e644613cc62062dff5e5332f488c7f217bf6b6d 100644 --- a/lib/Magento/LauncherInterface.php +++ b/lib/Magento/Translate/Inline/ProviderInterface.php @@ -1,7 +1,5 @@ <?php /** - * Application. Performs user requested actions. - * * Magento * * NOTICE OF LICENSE @@ -20,15 +18,18 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento; -interface LauncherInterface +namespace Magento\Translate\Inline; + +interface ProviderInterface { /** - * @return \Magento\App\ResponseInterface + * Return instance of inline translate class + * + * @return \Magento\Translate\InlineInterface */ - public function launch(); + public function get(); } diff --git a/lib/Magento/Translate/Inline/Proxy.php b/lib/Magento/Translate/Inline/Proxy.php new file mode 100644 index 0000000000000000000000000000000000000000..c4401226565feaded7213c73e957ecca3849aa0d --- /dev/null +++ b/lib/Magento/Translate/Inline/Proxy.php @@ -0,0 +1,160 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +/** + * Proxy class for \Magento\Translate\Inline + */ +class Proxy extends \Magento\Translate\Inline +{ + /** + * Object Manager instance + * + * @var \Magento\ObjectManager + */ + protected $objectManager; + + /** + * Proxied instance name + * + * @var string + */ + protected $instanceName; + + /** + * Proxied instance + * + * @var \Magento\DesignEditor\Model\Translate\Inline + */ + protected $subject; + + /** + * Instance shareability flag + * + * @var bool + */ + protected $isShared; + + /** + * @param \Magento\ObjectManager $objectManager + * @param string $instanceName + * @param bool $shared + */ + public function __construct( + \Magento\ObjectManager $objectManager, + $instanceName = 'Magento\Translate\Inline', + $shared = true + ) { + $this->objectManager = $objectManager; + $this->instanceName = $instanceName; + $this->isShared = $shared; + } + + /** + * @return array + */ + public function __sleep() + { + return array('_subject', '_isShared'); + } + + /** + * Retrieve ObjectManager from global scope + * + * @return void + */ + public function __wakeup() + { + $this->objectManager = \Magento\App\ObjectManager::getInstance(); + } + + /** + * Clone proxied instance + * + * @return void + */ + public function __clone() + { + $this->subject = clone $this->_getSubject(); + } + + /** + * Get proxied instance + * + * @return \Magento\DesignEditor\Model\Translate\Inline + */ + protected function _getSubject() + { + if (!$this->subject) { + $this->subject = true === $this->isShared + ? $this->objectManager->get($this->instanceName) + : $this->objectManager->create($this->instanceName); + } + return $this->subject; + } + + /** + * Check if Inline Translates is allowed + * + * @return bool + */ + public function isAllowed() + { + return $this->_getSubject()->isAllowed(); + } + + /** + * Retrieve Inline Parser instance + * + * @return \Magento\Translate\Inline\ParserInterface + */ + public function getParser() + { + return $this->_getSubject()->getParser(); + } + + /** + * Replace translation templates with HTML fragments + * + * @param array|string &$body + * @param bool $isJson + * @return $this + */ + public function processResponseBody(&$body, $isJson = false) + { + return $this->_getSubject()->processResponseBody($body, $isJson); + } + + /** + * Additional translation mode html attribute is not needed for base inline translation. + * + * @param mixed|string|null $tagName + * @return mixed + */ + public function getAdditionalHtmlAttribute($tagName = null) + { + return $this->_getSubject()->getAdditionalHtmlAttribute($tagName); + } +} diff --git a/lib/Magento/Translate/Inline/State.php b/lib/Magento/Translate/Inline/State.php new file mode 100644 index 0000000000000000000000000000000000000000..c25dc6153827a8dfc795866f7c832a36533ae62f --- /dev/null +++ b/lib/Magento/Translate/Inline/State.php @@ -0,0 +1,102 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +class State implements StateInterface +{ + /** + * Flag to enable/disable inine translation + * + * @var bool + */ + protected $isEnabled = true; + + /** + * @var bool + */ + protected $storedStatus; + + /** + * Disable inline translation + * + * @return void + */ + public function disable() + { + $this->isEnabled = false; + } + + /** + * Enable inline translation + * + * @return void + */ + public function enable() + { + $this->isEnabled = true; + } + + /** + * Check if inline translation enabled/disabled + * + * @return bool + */ + public function isEnabled() + { + return $this->isEnabled; + } + + /** + * Suspend inline translation + * + * Store current inline translation status + * and apply new status or disable inline translation. + * + * @param bool $status + * @return void + */ + public function suspend($status = false) + { + if ($this->storedStatus === null) { + $this->storedStatus = $this->isEnabled; + $this->isEnabled = $status; + } + } + + /** + * Disable inline translation + * + * Restore inline translation status + * or apply new status. + * + * @param bool $status + * @return void + */ + public function resume($status = true) + { + $this->isEnabled = !$status ? $status : $this->storedStatus; + $this->storedStatus = null; + } +} diff --git a/lib/Magento/Translate/Inline/StateInterface.php b/lib/Magento/Translate/Inline/StateInterface.php new file mode 100644 index 0000000000000000000000000000000000000000..b5879eb6ddebdbb38f92c832ab5520696369d7f8 --- /dev/null +++ b/lib/Magento/Translate/Inline/StateInterface.php @@ -0,0 +1,71 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Translate\Inline; + +interface StateInterface +{ + /** + * Disable inline translation + * + * @return void + */ + public function disable(); + + /** + * Enable inline translation + * + * @return void + */ + public function enable(); + + /** + * Check if inline translation enabled/disabled + * + * @return bool + */ + public function isEnabled(); + + /** + * Suspend inline translation + * + * Store current inline translation status + * and apply new status or disable inline translation. + * + * @param bool $status + * @return void + */ + public function suspend($status = false); + + /** + * Disable inline translation + * + * Restore inline translation status + * or apply new status. + * + * @param bool $status + * @return void + */ + public function resume($status = true); +} diff --git a/lib/Magento/Translate/InlineInterface.php b/lib/Magento/Translate/InlineInterface.php index 95a82a8a6f7db1fd76f6e5b88e7f80f62cea8171..09ebc223e0ffa98e68a6279dd135a950c0ade680 100644 --- a/lib/Magento/Translate/InlineInterface.php +++ b/lib/Magento/Translate/InlineInterface.php @@ -36,7 +36,7 @@ interface InlineInterface public function getAdditionalHtmlAttribute($tagName = null); /** - * Is enabled and allowed Inline Translates + * Check if inline translates is allowed * * @return bool */ @@ -50,4 +50,11 @@ interface InlineInterface * @return \Magento\Translate\InlineInterface */ public function processResponseBody(&$body, $isJson = false); + + /** + * Retrieve Inline Parser instance + * + * @return Inline\ParserInterface + */ + public function getParser(); } diff --git a/lib/Magento/Translate/Locale/Resolver/Plugin.php b/lib/Magento/Translate/Locale/Resolver/Plugin.php index 900af82df983e8f360da2fdc4675315e97e79b62..5d395ed1d607b71986f30b2b76a7f2735dfeeb19 100644 --- a/lib/Magento/Translate/Locale/Resolver/Plugin.php +++ b/lib/Magento/Translate/Locale/Resolver/Plugin.php @@ -71,7 +71,8 @@ class Plugin protected function _init($localeCode) { if (!is_null($localeCode)) { - $this->_translate->initLocale($localeCode); + $this->_translate->setLocale($localeCode) + ->loadData(null, true); } } } diff --git a/lib/Magento/TranslateInterface.php b/lib/Magento/TranslateInterface.php index 308558a629aa5117ad10302e784af74d65415433..ac94cec7d5c7bbad03421e0291e94021b9bc7715 100644 --- a/lib/Magento/TranslateInterface.php +++ b/lib/Magento/TranslateInterface.php @@ -1,7 +1,5 @@ <?php /** - * Translator interface - * * Magento * * NOTICE OF LICENSE @@ -36,37 +34,27 @@ interface TranslateInterface const DEFAULT_STRING = 'Translate String'; /** - * Determine if translation is enabled and allowed. + * Initialize translation data * - * @param mixed $scope - * @return bool - */ - public function isAllowed($scope = null); - - /** - * Initialization translation data - * - * @param string $area - * @param \Magento\Object $initParams + * @param string|null $area * @param bool $forceReload * @return \Magento\TranslateInterface */ - public function init($area = null, $initParams = null, $forceReload = false); + public function loadData($area = null, $forceReload = false); /** - * Retrieve active translate mode + * Retrieve translation data * - * @return bool + * @return array */ - public function getTranslateInline(); + public function getData(); /** - * Set Translate inline mode + * Retrieve locale * - * @param bool $flag - * @return \Magento\TranslateInterface + * @return string */ - public function setTranslateInline($flag); + public function getLocale(); /** * Set locale @@ -77,19 +65,9 @@ interface TranslateInterface public function setLocale($locale); /** - * Translate + * Retrieve theme code * - * @param array $args * @return string */ - public function translate($args); - - /** - * This method initializes the Translate object for this instance. - * - * @param string $localeCode - * @param string|null $area - * @return \Magento\TranslateInterface - */ - public function initLocale($localeCode, $area = null); + public function getTheme(); } diff --git a/lib/Magento/Url.php b/lib/Magento/Url.php index 88b79f6cb34a5544b65901f00ff069c9e73c8f92..4398515df5ca06f381dcd4bdc26824366be8a808 100644 --- a/lib/Magento/Url.php +++ b/lib/Magento/Url.php @@ -85,13 +85,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ protected static $_configDataCache; - /** - * Encrypted session identifier - * - * @var string|null - */ - protected static $_encryptedSessionId; - /** * Reserved Route parameter keys * @@ -199,16 +192,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface parent::__construct($data); } - /** - * Get default url type - * - * @return string - */ - protected function _getDefaultUrlType() - { - return \Magento\UrlInterface::URL_TYPE_LINK; - } - /** * Initialize object data from retrieved url * @@ -237,16 +220,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this; } - /** - * Retrieve default controller name - * - * @return string - */ - protected function _getDefaultControllerName() - { - return self::DEFAULT_CONTROLLER_NAME; - } - /** * Set use session rule * @@ -259,18 +232,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this; } - /** - * Set route front name - * - * @param string $name - * @return \Magento\UrlInterface - */ - protected function _setRouteFrontName($name) - { - $this->setData('route_front_name', $name); - return $this; - } - /** * Retrieve use session rule * @@ -284,16 +245,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this->_useSession; } - /** - * Retrieve default action name - * - * @return string - */ - protected function _getDefaultActionName() - { - return self::DEFAULT_ACTION_NAME; - } - /** * Retrieve configuration data * @@ -369,21 +320,11 @@ class Url extends \Magento\Object implements \Magento\UrlInterface protected function _getType() { if (!$this->_routeParamsResolver->hasData('type')) { - $this->_routeParamsResolver->setData('type', $this->_getDefaultUrlType()); + $this->_routeParamsResolver->setData('type', self::DEFAULT_URL_TYPE); } return $this->_routeParamsResolver->getType(); } - /** - * @param string $type - * @return mixed - */ - public function setType($type) - { - $this->_routeParamsResolver->setType($type); - return $this; - } - /** * Retrieve is secure mode URL * @@ -467,8 +408,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $this->_routeParamsResolver->setType(\Magento\UrlInterface::URL_TYPE_DIRECT_LINK); } - $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); - $this->_routeParamsResolver->setType($this->_getDefaultUrlType()); + $result = $this->_getScope()->getBaseUrl($this->_getType(), $this->_isSecure()); + $this->_routeParamsResolver->setType(self::DEFAULT_URL_TYPE); return $result; } @@ -541,12 +482,12 @@ class Url extends \Magento\Object implements \Magento\UrlInterface if ($this->_getControllerName()) { $path .= $this->_getControllerName() . '/'; } elseif ($hasParams) { - $path .= $this->_getDefaultControllerName() . '/'; + $path .= self::DEFAULT_CONTROLLER_NAME . '/'; } if ($this->_getActionName()) { $path .= $this->_getActionName() . '/'; } elseif ($hasParams) { - $path .= $this->_getDefaultActionName() . '/'; + $path .= self::DEFAULT_ACTION_NAME . '/'; } return $path; @@ -575,9 +516,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $routePath .= $key . '/' . $value . '/'; } } - if ($routePath != '' && substr($routePath, -1, 1) !== '/') { - $routePath .= '/'; - } $this->setData('route_path', $routePath); } return $this->_getData('route_path'); @@ -620,9 +558,8 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $this->_getRouteName(), $this->_scopeResolver->getAreaCode() ); - $this->_setRouteFrontName($frontName); + $this->setData('route_front_name', $frontName); } - return $this->_getData('route_front_name'); } @@ -657,11 +594,12 @@ class Url extends \Magento\Object implements \Magento\UrlInterface /** * Retrieve controller name * + * @param mixed $default * @return string|null */ - protected function _getControllerName() + protected function _getControllerName($default = null) { - return $this->_getData('controller_name') ? $this->_getData('controller_name') : null; + return $this->_getData('controller_name') ? $this->_getData('controller_name') : $default; } /** @@ -751,10 +689,10 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ public function addSessionParam() { - if (!self::$_encryptedSessionId) { - self::$_encryptedSessionId = $this->_session->getSessionId(); - } - $this->setQueryParam($this->_sidResolver->getSessionIdQueryParam($this->_session), self::$_encryptedSessionId); + $this->setQueryParam( + $this->_sidResolver->getSessionIdQueryParam($this->_session), + $this->_session->getSessionId() + ); return $this; } @@ -781,37 +719,17 @@ class Url extends \Magento\Object implements \Magento\UrlInterface } /** - * Set query Params as array + * Add query Params as array * * @param array $data * @return \Magento\UrlInterface */ - public function setQueryParams(array $data) + public function addQueryParams(array $data) { - $this->_queryParamsResolver->setQueryParams($data); + $this->_queryParamsResolver->addQueryParams($data); return $this; } - /** - * Purge Query params array - * - * @return \Magento\UrlInterface - */ - public function purgeQueryParams() - { - return $this->_queryParamsResolver->purgeQueryParams(); - } - - /** - * Return Query Params - * - * @return array - */ - protected function _getQueryParams() - { - return $this->_queryParamsResolver->getQueryParams(); - } - /** * Set query param * @@ -867,7 +785,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface $query = null; if (isset($routeParams['_query'])) { - $this->purgeQueryParams(); + $this->_queryParamsResolver->setQueryParams([]); $query = $routeParams['_query']; unset($routeParams['_query']); } @@ -885,10 +803,10 @@ class Url extends \Magento\Object implements \Magento\UrlInterface if (is_string($query)) { $this->_setQuery($query); } elseif (is_array($query)) { - $this->setQueryParams($query, !empty($routeParams['_current'])); + $this->addQueryParams($query, !empty($routeParams['_current'])); } if ($query === false) { - $this->setQueryParams(array()); + $this->addQueryParams(array()); } } @@ -919,19 +837,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface * @return \Magento\UrlInterface */ protected function _prepareSessionUrl($url) - { - return $this->_prepareSessionUrlWithParams($url, array()); - } - - /** - * Check and add session id to URL, session is obtained with parameters - * - * @param string $url - * @param array $params - * - * @return \Magento\UrlInterface - */ - protected function _prepareSessionUrlWithParams($url, array $params) { if (!$this->getUseSession()) { return $this; @@ -1015,7 +920,28 @@ class Url extends \Magento\Object implements \Magento\UrlInterface { return preg_replace_callback( '#(\?|&|&)___SID=([SU])(&|&)?#', - array($this, "_sessionVarCallback"), + // @codingStandardsIgnoreStart + /** + * Callback function for session replace + * + * @param array $match + * @return string + */ + // @codingStandardsIgnoreEnd + function ($match) { + if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { + return $match[1] + . $this->_sidResolver->getSessionIdQueryParam($this->_session) + . '=' . $this->_session->getSessionId() + . (isset($match[3]) ? $match[3] : ''); + } else { + if ($match[1] == '?') { + return isset($match[3]) ? '?' : ''; + } elseif ($match[1] == '&' || $match[1] == '&') { + return isset($match[3]) ? $match[3] : ''; + } + } + }, $html ); } @@ -1045,34 +971,6 @@ class Url extends \Magento\Object implements \Magento\UrlInterface return $this->getData($key); } - /** - * Callback function for session replace - * - * @param array $match - * @return string - */ - protected function _sessionVarCallback($match) - { - if ($this->useSessionIdForUrl($match[2] == 'S' ? true : false)) { - return $match[1] . $this->_sidResolver->getSessionIdQueryParam( - $this->_session - ) . '=' . $this->_session->getSessionId() . (isset( - $match[3] - ) ? $match[3] : ''); - } else { - if ($match[1] == '?' && isset($match[3])) { - return '?'; - } elseif ($match[1] == '?' && !isset($match[3])) { - return ''; - } elseif (($match[1] == '&' || $match[1] == '&') && !isset($match[3])) { - return ''; - } elseif (($match[1] == '&' || $match[1] == '&') && isset($match[3])) { - return $match[3]; - } - } - return ''; - } - /** * Check if users originated URL is one of the domain URLs assigned to scopes * @@ -1102,8 +1000,7 @@ class Url extends \Magento\Object implements \Magento\UrlInterface */ public function getRedirectUrl($url) { - $this->_prepareSessionUrlWithParams($url, array('name' => self::SESSION_NAMESPACE)); - + $this->_prepareSessionUrl($url); $query = $this->_getQuery(false); if ($query) { $url .= (strpos($url, '?') === false ? '?' : '&') . $query; diff --git a/lib/Magento/Url/QueryParamsResolver.php b/lib/Magento/Url/QueryParamsResolver.php index 9f5ee5dff3f27cc3d3829a5376e23eaf0c1c9310..06beda4db672a9b8457049c767ecd0aa5acf89fd 100644 --- a/lib/Magento/Url/QueryParamsResolver.php +++ b/lib/Magento/Url/QueryParamsResolver.php @@ -47,11 +47,10 @@ class QueryParamsResolver extends \Magento\Object implements QueryParamsResolver */ public function setQuery($data) { - if ($this->_getData('query') == $data) { - return $this; + if ($this->_getData('query') != $data) { + $this->unsetData('query_params'); + $this->setData('query', $data); } - $this->unsetData('query_params'); - $this->setData('query', $data); return $this; } @@ -91,16 +90,15 @@ class QueryParamsResolver extends \Magento\Object implements QueryParamsResolver /** * {@inheritdoc} */ - public function purgeQueryParams() + public function setQueryParams(array $data) { - $this->setData('query_params', array()); - return $this; + return $this->setData('query_params', $data); } /** * {@inheritdoc} */ - public function setQueryParams(array $data) + public function addQueryParams(array $data) { $this->unsetData('query'); diff --git a/lib/Magento/Url/QueryParamsResolverInterface.php b/lib/Magento/Url/QueryParamsResolverInterface.php index 3bfcbf5c648518b51ff199043371e1912b6d2a21..4c3382043e869ad856853f3871836e8f5dbc8e11 100644 --- a/lib/Magento/Url/QueryParamsResolverInterface.php +++ b/lib/Magento/Url/QueryParamsResolverInterface.php @@ -58,19 +58,20 @@ interface QueryParamsResolverInterface public function getQueryParams(); /** - * Purge Query params array + * Set query parameters * + * @param array $data * @return \Magento\Url\QueryParamsResolverInterface */ - public function purgeQueryParams(); + public function setQueryParams(array $data); /** - * Set query Params as array + * Add query parameters * * @param array $data * @return \Magento\Url\QueryParamsResolverInterface */ - public function setQueryParams(array $data); + public function addQueryParams(array $data); /** * Unset data from the object. diff --git a/lib/Magento/Url/Validator.php b/lib/Magento/Url/Validator.php index c7c8e6041c3db85f6613cac41ca460aeca00db37..8ec85cc803ca53367b10188bff4b209293fbea26 100644 --- a/lib/Magento/Url/Validator.php +++ b/lib/Magento/Url/Validator.php @@ -39,7 +39,6 @@ class Validator extends \Zend_Validate_Abstract * Error keys */ const INVALID_URL = 'invalidUrl'; - /**#@-*/ /** @@ -68,7 +67,6 @@ class Validator extends \Zend_Validate_Abstract { $this->_setValue($value); - //check valid URL if (!\Zend_Uri::check($value)) { $this->_error(self::INVALID_URL); return false; diff --git a/lib/Magento/UrlInterface.php b/lib/Magento/UrlInterface.php index d6dece6783dff903e5331070b9ea23a4b63364d8..b98e807fbba20157c74810e4a05d34b599d1f08b 100644 --- a/lib/Magento/UrlInterface.php +++ b/lib/Magento/UrlInterface.php @@ -44,6 +44,13 @@ interface UrlInterface const URL_TYPE_JS = 'js'; + /** + * Default url type + * + * Equals to self::URL_TYPE_LINK + */ + const DEFAULT_URL_TYPE = 'link'; + /** * Default controller name */ @@ -103,12 +110,12 @@ interface UrlInterface public function addSessionParam(); /** - * Set query Params as array + * Add query parameters * * @param array $data * @return \Magento\UrlInterface */ - public function setQueryParams(array $data); + public function addQueryParams(array $data); /** * Set query param diff --git a/lib/Magento/View/Context.php b/lib/Magento/View/Context.php index 046e91dbb3a1533fd1fb0663f0daa342ecaa8440..e1899993d53dfe66a49e218f0f84051f8c4947ea 100644 --- a/lib/Magento/View/Context.php +++ b/lib/Magento/View/Context.php @@ -30,8 +30,8 @@ use Magento\Core\Model\Store\Config as StoreConfig; use Magento\View\Url as ViewUrl; use Magento\View\ConfigInterface as ViewConfig; use Magento\Logger; -use Magento\Core\Model\App; use Magento\App\State as AppState; +use Magento\View\LayoutInterface; use Magento\Session\SessionManager; use Magento\App\CacheInterface as Cache; use Magento\App\Cache\StateInterface as CacheState; @@ -146,13 +146,6 @@ class Context */ protected $logger; - /** - * Application - * - * @var \Magento\Core\Model\App - */ - protected $app; - /** * Application state * @@ -176,8 +169,8 @@ class Context * @param ViewConfig $viewConfig * @param CacheState $cacheState * @param Logger $logger - * @param App $app * @param AppState $appState + * @param LayoutInterface $layout * * @todo reduce parameter number * @@ -197,8 +190,8 @@ class Context ViewConfig $viewConfig, CacheState $cacheState, Logger $logger, - App $app, - AppState $appState + AppState $appState, + LayoutInterface $layout ) { $this->request = $request; $this->eventManager = $eventManager; @@ -209,12 +202,12 @@ class Context $this->session = $session; $this->storeConfig = $storeConfig; $this->frontController = $frontController; - $this->viewUrl = $viewUrl; - $this->viewConfig = $viewConfig; - $this->cacheState = $cacheState; - $this->logger = $logger; - $this->app = $app; - $this->appState = $appState; + $this->viewUrl = $viewUrl; + $this->viewConfig = $viewConfig; + $this->cacheState = $cacheState; + $this->logger = $logger; + $this->appState = $appState; + $this->layout = $layout; } /** @@ -357,16 +350,6 @@ class Context return $this->logger; } - /** - * Retrieve application - * - * @return \Magento\Core\Model\App - */ - public function getApp() - { - return $this->app; - } - /** * Retrieve layout area * @@ -374,7 +357,7 @@ class Context */ public function getArea() { - return $this->app->getLayout()->getArea(); + return $this->layout->getArea(); } /** diff --git a/lib/Magento/View/Design/ThemeInterface.php b/lib/Magento/View/Design/ThemeInterface.php index 3f42b9f4f0c7214e35124525c06850c35fb6e92e..f93136a0dfbcde2a4e62f977c3c3301f616fed50 100644 --- a/lib/Magento/View/Design/ThemeInterface.php +++ b/lib/Magento/View/Design/ThemeInterface.php @@ -25,8 +25,6 @@ namespace Magento\View\Design; /** * Interface ThemeInterface - * - * @method int|null getId() */ interface ThemeInterface { diff --git a/lib/Magento/View/DesignLoader.php b/lib/Magento/View/DesignLoader.php index 0e72228f85385326f9c276307c02c55cb30fd6b7..6f2180296b489a2982839428b6efa0f4f7a37e4b 100644 --- a/lib/Magento/View/DesignLoader.php +++ b/lib/Magento/View/DesignLoader.php @@ -35,9 +35,9 @@ class DesignLoader /** * Application * - * @var \Magento\Core\Model\App + * @var \Magento\App\AreaList */ - protected $_app; + protected $_areaList; /** * Layout @@ -47,19 +47,17 @@ class DesignLoader protected $_layout; /** - * Constructor - * * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\App $app - * @param \Magento\View\LayoutInterface $layout + * @param \Magento\App\AreaList $areaList + * @param LayoutInterface $layout */ public function __construct( \Magento\App\RequestInterface $request, - \Magento\Core\Model\App $app, + \Magento\App\AreaList $areaList, \Magento\View\LayoutInterface $layout ) { $this->_request = $request; - $this->_app = $app; + $this->_areaList = $areaList; $this->_layout = $layout; } @@ -70,7 +68,7 @@ class DesignLoader */ public function load() { - $area = $this->_app->getArea($this->_layout->getArea()); + $area = $this->_areaList->getArea($this->_layout->getArea()); $area->load(\Magento\Core\Model\App\Area::PART_DESIGN); $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); $area->detectDesign($this->_request); diff --git a/lib/Magento/View/Element/AbstractBlock.php b/lib/Magento/View/Element/AbstractBlock.php index 99b21c765134b3003fe381ebb5c205c3e65a9f1d..40886401533c62ee6ebd5e4f31ad6459205f686e 100644 --- a/lib/Magento/View/Element/AbstractBlock.php +++ b/lib/Magento/View/Element/AbstractBlock.php @@ -140,13 +140,6 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_logger; - /** - * Application - * - * @var \Magento\Core\Model\App - */ - protected $_app; - /** * Escaper * @@ -166,6 +159,11 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface */ protected $_localeDate; + /** + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + /** * The property is used to define content-scope of block. Can be private or public. * If it isn't defined then application considers it as false. @@ -199,6 +197,8 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_escaper = $context->getEscaper(); $this->filterManager = $context->getFilterManager(); $this->_localeDate = $context->getLocaleDate(); + $this->inlineTranslation = $context->getInlineTranslation(); + $this->_isScopePrivate = false; parent::__construct($data); $this->_construct(); } @@ -635,7 +635,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $html = $this->_loadCache(); if ($html === false) { if ($this->hasData('translate_inline')) { - $this->_translator->setTranslateInline($this->getData('translate_inline')); + $this->inlineTranslation->suspend($this->getData('translate_inline')); } $this->_beforeToHtml(); @@ -643,7 +643,7 @@ abstract class AbstractBlock extends \Magento\Object implements BlockInterface $this->_saveCache($html); if ($this->hasData('translate_inline')) { - $this->_translator->setTranslateInline(true); + $this->inlineTranslation->resume(); } } $html = $this->_afterToHtml($html); diff --git a/lib/Magento/View/Element/Context.php b/lib/Magento/View/Element/Context.php index 58b9e614ab6916160e251857410cbfd9c799975c..e2f2579bc2c6af8d7288e0011f5ba12bdb819430 100644 --- a/lib/Magento/View/Element/Context.php +++ b/lib/Magento/View/Element/Context.php @@ -152,8 +152,11 @@ class Context implements \Magento\ObjectManager\ContextInterface protected $_localeDate; /** - * Constructor - * + * @var \Magento\Translate\Inline\StateInterface + */ + protected $inlineTranslation; + + /** * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager @@ -171,10 +174,9 @@ class Context implements \Magento\ObjectManager\ContextInterface * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate - * @param array $data + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * * @SuppressWarnings(PHPMD.ExcessiveParameterList) - * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( \Magento\App\RequestInterface $request, @@ -194,7 +196,7 @@ class Context implements \Magento\ObjectManager\ContextInterface \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, - array $data = array() + \Magento\Translate\Inline\StateInterface $inlineTranslation ) { $this->_request = $request; $this->_layout = $layout; @@ -213,6 +215,7 @@ class Context implements \Magento\ObjectManager\ContextInterface $this->_escaper = $escaper; $this->_filterManager = $filterManager; $this->_localeDate = $localeDate; + $this->inlineTranslation = $inlineTranslation; } /** @@ -305,6 +308,16 @@ class Context implements \Magento\ObjectManager\ContextInterface return $this->_translator; } + /** + * Get inline translation status object + * + * @return \Magento\Translate\Inline\StateInterface + */ + public function getInlineTranslation() + { + return $this->inlineTranslation; + } + /** * Get URL builder * diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 1cc1eaf77e19ae5fc10c9b03bbc1a44f0b631541..8b910c79a9086c88e891aa42966d1403da02aa89 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -59,8 +59,6 @@ class Context extends \Magento\View\Element\Context protected $_storeManager; /** - * Constructor - * * @param \Magento\App\RequestInterface $request * @param \Magento\View\LayoutInterface $layout * @param \Magento\Event\ManagerInterface $eventManager @@ -78,12 +76,12 @@ class Context extends \Magento\View\Element\Context * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Stdlib\DateTime\TimezoneInterface $localeDate + * @param \Magento\Translate\Inline\StateInterface $inlineTranslation * @param \Magento\App\Filesystem $filesystem * @param \Magento\View\FileSystem $viewFileSystem * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\App\State $appState * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ @@ -105,12 +103,12 @@ class Context extends \Magento\View\Element\Context \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Stdlib\DateTime\TimezoneInterface $localeDate, + \Magento\Translate\Inline\StateInterface $inlineTranslation, \Magento\App\Filesystem $filesystem, \Magento\View\FileSystem $viewFileSystem, \Magento\View\TemplateEnginePool $enginePool, \Magento\App\State $appState, - \Magento\Core\Model\StoreManagerInterface $storeManager, - array $data = array() + \Magento\Core\Model\StoreManagerInterface $storeManager ) { parent::__construct( $request, @@ -130,7 +128,7 @@ class Context extends \Magento\View\Element\Context $escaper, $filterManager, $localeDate, - $data + $inlineTranslation ); $this->_storeManager = $storeManager; diff --git a/pub/cron.php b/pub/cron.php index 7e00cc661c173991c1d38cb98a74b221d84a105a..3ac4fa68e379fa079fc2c9f9d9020aaa1fc17b96 100644 --- a/pub/cron.php +++ b/pub/cron.php @@ -26,10 +26,12 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use Magento\Core\Model\StoreManager; + require dirname(__DIR__) . '/app/bootstrap.php'; umask(0); $params = array( - \Magento\Core\Model\App::PARAM_RUN_CODE => 'admin', + StoreManager::PARAM_RUN_CODE => 'admin', \Magento\Core\Model\Store::CUSTOM_ENTRY_POINT_PARAM => true ); $entryPoint = new \Magento\App\EntryPoint\EntryPoint(BP, $params); diff --git a/pub/get.php b/pub/get.php index e23bae7b7e630702a989b86ffe8e3f23bead67ba..bf2e09045ba70100950a8f2f7f9f7788caebb4dc 100644 --- a/pub/get.php +++ b/pub/get.php @@ -26,6 +26,9 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ +use Magento\App\Cache\Frontend\Factory; +use Magento\Module\Declaration\Reader\Filesystem; + require dirname(__DIR__) . '/app/bootstrap.php'; $mediaDirectory = null; @@ -76,8 +79,8 @@ if ($mediaDirectory) { // Materialize file in application $params = $_SERVER; if (empty($mediaDirectory)) { - $params[\Magento\Core\Model\App::PARAM_ALLOWED_MODULES] = array('Magento_Core'); - $params[\Magento\Core\Model\App::PARAM_CACHE_FORCED_OPTIONS]['frontend_options']['disable_save'] = true; + $params[Filesystem::PARAM_ALLOWED_MODULES] = array('Magento_Core'); + $params[Factory::PARAM_CACHE_FORCED_OPTIONS]['frontend_options']['disable_save'] = true; } $entryPoint = new \Magento\App\EntryPoint\EntryPoint(dirname(__DIR__), $params);