diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c8730a6634896d23533b4c0968f54580567ae65..4baa1101f39e981b3f88d6abef0fed0ec6de5844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,40 @@ +2.0.0.0-dev56 +============= +* Fixed bugs: + * Fixed placing order with PayPal Payments Advanced and Payflow Link + * Fixed losing previously assigned categories after saving the product with changed category selector field + * Fixed losing of a newly created category assignment after variations generation during Configurable product or Gift Card creation + * Fixed the error in order placement with Recurring profile payment +* GitHub requests: + * [#299](https://github.com/magento/magento2/pull/299) -- Fix for issue Refactor Mage_Rating_Model_Resource_Rating_Collection + * [#341](https://github.com/magento/magento2/pull/341) -- Replacing simple preg calls with less expensive alternates +* Modularity improvements: + * Layout page type config moved to library + * Design loader moved to library + * Theme label moved to library +* Themes update: + * Reduced amount of templates and layouts in magento_plushe theme + * Responsive design improvements +* Integrity improvements: + * Covered all Magento classes with argument sequence validator + * Added arguments type duplication validator +* Implemented API Integration UX flows: + * Ability to create and edit API Integrations + * Ability to delete API integrations that were not created using configuration files +* Removed System REST menu item and all associated UX flows: + * Users, Roles, and Webhook Subscriptions sub-menu items were removed +* Removed the Webhook module + 2.0.0.0-dev55 ============= * Modularity improvements: - * Session configuration moved to library - * FormKey logic was moved from Session - * SessionIdFlags from Session was removed + * Session configuration is moved to library + * FormKey logic is moved out from Session model + * SessionIdFlags is removed from Session model * Move Page logic to the Theme module and library -* Created integration module UX +* Created UX for the Integration module * Created authorization service (Magento_Authz module) + * Implemented an API Authz check in the Webapi framework * Fixed bugs: * Fixed the issue that prevented a customer group's shopping cart rules from applying properly to prices. The issue occurred when a customer was manually assigned to a customer group and automatic group assignment was enabled. * Fixed the bug with schema upgrade scripts not running after installation diff --git a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php b/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php index 2769b31300a89aef8559f2b77c4fde5b52d899e1..04f0465b272f7b627b5447e6bb0f7d63849480cf 100644 --- a/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php +++ b/app/code/Magento/Adminhtml/Block/Urlrewrite/Edit/Form.php @@ -174,7 +174,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic // Prepare form /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'use_container' => true, 'method' => 'post', diff --git a/app/code/Magento/Authorizenet/Model/Directpost.php b/app/code/Magento/Authorizenet/Model/Directpost.php index c9abc5bce283e0ce542bc289c845225c675a00f2..878c38cfcd87d7388b63288b3fb943c818e27e4d 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost.php +++ b/app/code/Magento/Authorizenet/Model/Directpost.php @@ -53,79 +53,80 @@ class Directpost extends \Magento\Paygate\Model\Authorizenet */ protected $_storeManager; - /** - * @var \Magento\Sales\Model\OrderFactory - */ - protected $_orderFactory; - /** * @var \Magento\Sales\Model\QuoteFactory */ protected $_quoteFactory; - /** - * @var \Magento\Authorizenet\Model\Directpost\RequestFactory - */ - protected $_requestFactory; - /** * @var \Magento\Authorizenet\Model\Directpost\Response */ protected $_response; /** - * Construct - * - * @param \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory - * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $parentRequestFactory - * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory - * @param \Magento\Sales\Model\OrderFactory $orderFactory - * @param \Magento\Core\Model\Session\AbstractSession $session - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Paygate\Helper\Data $paygateData - * @param \Magento\Module\ModuleListInterface $moduleList - * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory + * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory + * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory + * @param \Magento\Core\Model\Session\AbstractSession $session + * @param \Magento\Paygate\Helper\Data $paygateData + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\QuoteFactory $quoteFactory - * @param \Magento\Authorizenet\Model\Directpost\RequestFactory $requestFactory + * @param \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory * @param \Magento\Authorizenet\Model\Directpost\Response $response * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory, - \Magento\Paygate\Model\Authorizenet\RequestFactory $parentRequestFactory, - \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, - \Magento\Sales\Model\OrderFactory $orderFactory, - \Magento\Core\Model\Session\AbstractSession $session, - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Paygate\Helper\Data $paygateData, - \Magento\Module\ModuleListInterface $moduleList, - \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory, + \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, + \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, + \Magento\Core\Model\Session\AbstractSession $session, + \Magento\Paygate\Helper\Data $paygateData, + \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\QuoteFactory $quoteFactory, - \Magento\Authorizenet\Model\Directpost\RequestFactory $requestFactory, + \Magento\Authorizenet\Model\Directpost\RequestFactory $directRequestFactory, \Magento\Authorizenet\Model\Directpost\Response $response, array $data = array() ) { - parent::__construct($cardsFactory, $parentRequestFactory, $resultFactory, $orderFactory, $session, - $logger, $eventManager, $paygateData, $moduleList, $coreStoreConfig, $paymentData, - $logAdapterFactory, $locale, $centinelService, $data); + parent::__construct( + $eventManager, + $paymentData, + $coreStoreConfig, + $logAdapterFactory, + $logger, + $moduleList, + $locale, + $centinelService, + $cardsFactory, + $requestFactory, + $resultFactory, + $orderFactory, + $session, + $paygateData, + $data + ); $this->_storeManager = $storeManager; - $this->_orderFactory = $orderFactory; $this->_quoteFactory = $quoteFactory; - $this->_requestFactory = $requestFactory; + $this->_requestFactory = $directRequestFactory; $this->_response = $response; } diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Session.php b/app/code/Magento/Authorizenet/Model/Directpost/Session.php index 778a9f409225e0e718be22c31e39e7a279ca0b8d..e7e3dfb566fd9d6f97d30f48d834efd90876179c 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Session.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Session.php @@ -39,15 +39,15 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig + * @param null $sessionName * @param array $data - * @param string|null $sessionName */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array(), - $sessionName = null + $sessionName = null, + array $data = array() ) { parent::__construct($context, $sidResolver, $sessionConfig, $data); $this->start('authorizenet_directpost', $sessionName); diff --git a/app/code/Magento/Authz/Service/AuthorizationV1.php b/app/code/Magento/Authz/Service/AuthorizationV1.php index cce2256d61a246278133a6b11a6f45b517b836aa..3c8d7d86a6efc32e8b51a5878a15c4b20fb185a5 100644 --- a/app/code/Magento/Authz/Service/AuthorizationV1.php +++ b/app/code/Magento/Authz/Service/AuthorizationV1.php @@ -192,6 +192,23 @@ class AuthorizationV1 implements AuthorizationV1Interface return $allowedResources; } + /** + * {@inheritdoc} + */ + public function removePermissions(UserIdentifier $userIdentifier) + { + try { + $this->_deleteRole($userIdentifier); + } catch (ServiceException $e) { + throw $e; + } catch (\Exception $e) { + $this->_logger->logException($e); + throw new ServiceException( + __('Error happened while deleting role and permissions. Check exception log for details.') + ); + } + } + /** * Create new ACL role. * @@ -223,6 +240,28 @@ class AuthorizationV1 implements AuthorizationV1Interface return $role; } + /** + * Remove an ACL role. This deletes the cascading permissions + * + * @param UserIdentifier $userIdentifier + * @return Role + * @throws \LogicException + */ + protected function _deleteRole($userIdentifier) + { + $userType = $userIdentifier->getUserType(); + $userId = $userIdentifier->getUserId(); + switch ($userType) { + case UserIdentifier::USER_TYPE_INTEGRATION: + $roleName = $userType . $userId; + break; + default: + throw new \LogicException("Unknown user type: '{$userType}'."); + } + $role = $this->_roleFactory->create()->load($roleName, 'role_name'); + return $role->delete(); + } + /** * Identify user role from user identifier. * diff --git a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php b/app/code/Magento/Authz/Service/AuthorizationV1Interface.php index 02b6f60d2c140564c1fef5a2601a05f381e8a55e..80cf0be14d375d57a7481a3489ab40dbc08e053b 100644 --- a/app/code/Magento/Authz/Service/AuthorizationV1Interface.php +++ b/app/code/Magento/Authz/Service/AuthorizationV1Interface.php @@ -69,4 +69,12 @@ interface AuthorizationV1Interface * @throws ServiceException */ public function getAllowedResources(UserIdentifier $userIdentifier); + + /** + * Remove user role and associated permissions. + * + * @param UserIdentifier $userIdentifier + * @throws ServiceException + */ + public function removePermissions(UserIdentifier $userIdentifier); } diff --git a/app/code/Magento/Backend/App/Action/Context.php b/app/code/Magento/Backend/App/Action/Context.php index 1eec150730b63289b158f27411237d3ad4305591..c0728e95e41820985c2163037b2c6fe9655fd4f9 100644 --- a/app/code/Magento/Backend/App/Action/Context.php +++ b/app/code/Magento/Backend/App/Action/Context.php @@ -81,11 +81,11 @@ class Context extends \Magento\App\Action\Context * @param \Magento\App\ResponseInterface $response * @param \Magento\ObjectManager $objectManager * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Backend\Model\Session $session * @param \Magento\UrlInterface $url * @param \Magento\App\Response\RedirectInterface $redirect * @param \Magento\App\ActionFlag $actionFlag * @param \Magento\App\ViewInterface $view + * @param \Magento\Backend\Model\Session $session * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Backend\Model\Auth $auth * @param \Magento\Backend\Helper\Data $helper @@ -100,11 +100,11 @@ class Context extends \Magento\App\Action\Context \Magento\App\ResponseInterface $response, \Magento\ObjectManager $objectManager, \Magento\Event\ManagerInterface $eventManager, - \Magento\Backend\Model\Session $session, \Magento\UrlInterface $url, \Magento\App\Response\RedirectInterface $redirect, \Magento\App\ActionFlag $actionFlag, \Magento\App\ViewInterface $view, + \Magento\Backend\Model\Session $session, \Magento\AuthorizationInterface $authorization, \Magento\Backend\Model\Auth $auth, \Magento\Backend\Helper\Data $helper, @@ -114,16 +114,8 @@ class Context extends \Magento\App\Action\Context \Magento\Core\Model\LocaleInterface $locale, $canUseBaseUrl = false ) { - parent::__construct( - $request, - $response, - $objectManager, - $eventManager, - $url, - $redirect, - $actionFlag, - $view - ); + parent::__construct($request, $response, $objectManager, $eventManager, $url, $redirect, $actionFlag, $view); + $this->_session = $session; $this->_authorization = $authorization; $this->_auth = $auth; diff --git a/app/code/Magento/Backend/App/Router/DefaultRouter.php b/app/code/Magento/Backend/App/Router/DefaultRouter.php index 57c1b9c5d02fe8443fe7c9c5fcdf122b971d1f83..bde535d4029a3accc7580bead0aa74db1725f594 100644 --- a/app/code/Magento/Backend/App/Router/DefaultRouter.php +++ b/app/code/Magento/Backend/App/Router/DefaultRouter.php @@ -44,22 +44,22 @@ class DefaultRouter extends \Magento\Core\App\Router\Base protected $_coreConfig; /** - * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\App\ActionFactory $actionFactory * @param \Magento\App\DefaultPathInterface $defaultPath * @param \Magento\App\ResponseFactory $responseFactory * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\State $appState - * @param \Magento\Core\Model\Url|\Magento\UrlInterface $url - * @param \Magento\Core\Model\StoreManager|\Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\UrlInterface $url + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo - * @param $routerId + * @param string $routerId + * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Backend\App\ConfigInterface $backendConfig - * @throws \InvalidArgumentException + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Core\Model\Config $coreConfig, \Magento\App\ActionFactory $actionFactory, \Magento\App\DefaultPathInterface $defaultPath, \Magento\App\ResponseFactory $responseFactory, @@ -70,11 +70,20 @@ class DefaultRouter extends \Magento\Core\App\Router\Base \Magento\Core\Model\Store\Config $storeConfig, \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, $routerId, + \Magento\Core\Model\Config $coreConfig, \Magento\Backend\App\ConfigInterface $backendConfig ) { parent::__construct( - $actionFactory, $defaultPath, $responseFactory, $routeConfig, $appState, $url, $storeManager, $storeConfig, - $urlSecurityInfo, $routerId + $actionFactory, + $defaultPath, + $responseFactory, + $routeConfig, + $appState, + $url, + $storeManager, + $storeConfig, + $urlSecurityInfo, + $routerId ); $this->_coreConfig = $coreConfig; $this->_backendConfig = $backendConfig; diff --git a/app/code/Magento/Backend/Block/Context.php b/app/code/Magento/Backend/Block/Context.php index be933a5adb5a53935e6585c6329c63d2e0771613..28420ebb514d7bf58dd71e2e683ca089f75c50c9 100644 --- a/app/code/Magento/Backend/Block/Context.php +++ b/app/code/Magento/Backend/Block/Context.php @@ -51,14 +51,14 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState - * @param \Magento\AuthorizationInterface $authorization * @param \Magento\Logger $logger * @param \Magento\Core\Model\App $app * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\AuthorizationInterface $authorization * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -77,12 +77,12 @@ class Context extends \Magento\View\Element\Context \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, - \Magento\AuthorizationInterface $authorization, \Magento\Logger $logger, \Magento\Core\Model\App $app, \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, + \Magento\AuthorizationInterface $authorization, array $data = array() ) { $this->_authorization = $authorization; diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php index f5fdd0edbe4e5aed8cca10f7bcd3b9df91a6edb7..3bdedf592d04982060732653e2fea34156bde04a 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Field/Export.php @@ -41,21 +41,21 @@ class Export extends \Magento\Data\Form\Element\AbstractElement protected $_helperFactory; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\App\Helper\HelperFactory $helperFactory - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\App\Helper\HelperFactory $helperFactory, - array $attributes = array() + array $data = array() ) { $this->_helperFactory = $helperFactory; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } public function getElementHtml() diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Field/Regexceptions.php b/app/code/Magento/Backend/Block/System/Config/Form/Field/Regexceptions.php index 933a2a1986e6256f5ad0f6da3bdf7a5eb3e4a765..a65b00c7695003fdd0808f3d034969787f80cfc7 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Field/Regexceptions.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Field/Regexceptions.php @@ -38,20 +38,20 @@ class Regexceptions protected $_elementFactory; /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_labelFactory; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Data\Form\Element\Factory $elementFactory - * @param \Magento\Core\Model\Theme\LabelFactory $labelFactory + * @param \Magento\View\Design\Theme\LabelFactory $labelFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Data\Form\Element\Factory $elementFactory, - \Magento\Core\Model\Theme\LabelFactory $labelFactory, + \Magento\View\Design\Theme\LabelFactory $labelFactory, array $data = array() ) { $this->_elementFactory = $elementFactory; @@ -84,7 +84,7 @@ class Regexceptions public function renderCellTemplate($columnName) { if ($columnName == 'value' && isset($this->_columns[$columnName])) { - /** @var $label \Magento\Core\Model\Theme\Label */ + /** @var $label \Magento\View\Design\Theme\Label */ $label = $this->_labelFactory->create(); $options = $label->getLabelsCollection(__('-- No Theme --')); $element = $this->_elementFactory->create('select'); diff --git a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php index f41d6865deaadceb506e1299470b36bbb0b1707a..9c94e95dd29bfdad78fc6e0c572a0924c5e027cb 100644 --- a/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php +++ b/app/code/Magento/Backend/Block/System/Design/Edit/Tab/General.php @@ -28,7 +28,7 @@ namespace Magento\Backend\Block\System\Design\Edit\Tab; class General extends \Magento\Backend\Block\Widget\Form\Generic { /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_labelFactory; @@ -41,7 +41,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Theme\LabelFactory $labelFactory + * @param \Magento\View\Design\Theme\LabelFactory $labelFactory * @param \Magento\Core\Model\System\Store $systemStore * @param array $data */ @@ -49,7 +49,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Theme\LabelFactory $labelFactory, + \Magento\View\Design\Theme\LabelFactory $labelFactory, \Magento\Core\Model\System\Store $systemStore, array $data = array() ) { @@ -90,7 +90,7 @@ class General extends \Magento\Backend\Block\Widget\Form\Generic )); } - /** @var $label \Magento\Core\Model\Theme\Label */ + /** @var $label \Magento\View\Design\Theme\Label */ $label = $this->_labelFactory->create(); $options = $label->getLabelsCollection(__('-- Please Select --')); $fieldset->addField('design', 'select', array( diff --git a/app/code/Magento/Backend/Block/System/Store/Delete/Form.php b/app/code/Magento/Backend/Block/System/Store/Delete/Form.php index 24afcf4cd7a508eee2c5b2dcf0f0f6225ffbaee1..17f69c304b69b2bbb33a29b39c0df9d4bc36fa51 100644 --- a/app/code/Magento/Backend/Block/System/Store/Delete/Form.php +++ b/app/code/Magento/Backend/Block/System/Store/Delete/Form.php @@ -53,7 +53,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php index c2b29edc020d0235f548e1fbdc0d62634868591a..d8a6907cf186beaddb617406cf9f3384b9f7f950 100644 --- a/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php +++ b/app/code/Magento/Backend/Block/System/Store/Edit/AbstractForm.php @@ -56,7 +56,7 @@ abstract class AbstractForm extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php b/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php index 418f10eadd8354186a80323b5b512ede8badceac..e434932502b613d9b21a8161f068d5d20edcd143 100644 --- a/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php +++ b/app/code/Magento/Backend/Block/System/Variable/Edit/Form.php @@ -54,7 +54,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Backend/Block/Template/Context.php b/app/code/Magento/Backend/Block/Template/Context.php index cc5d8166fb1ebd3e308277064754e5021afe9d91..3ebe55ef7568cf9a7971e5e592ab12d21c67b097 100644 --- a/app/code/Magento/Backend/Block/Template/Context.php +++ b/app/code/Magento/Backend/Block/Template/Context.php @@ -66,16 +66,16 @@ class Context extends \Magento\View\Element\Template\Context * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState - * @param \Magento\App\Dir $dirs * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem - * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\Core\Model\App $app - * @param \Magento\App\State $appState * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\App\Dir $dirs + * @param \Magento\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\AuthorizationInterface $authorization * @param \Magento\Backend\Model\Session $backendSession @@ -101,16 +101,16 @@ class Context extends \Magento\View\Element\Template\Context \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, - \Magento\App\Dir $dirs, \Magento\Logger $logger, - \Magento\Filesystem $filesystem, - \Magento\View\FileSystem $viewFileSystem, - \Magento\View\TemplateEnginePool $enginePool, \Magento\Core\Model\App $app, - \Magento\App\State $appState, \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, + \Magento\App\Dir $dirs, + \Magento\Filesystem $filesystem, + \Magento\View\FileSystem $viewFileSystem, + \Magento\View\TemplateEnginePool $enginePool, + \Magento\App\State $appState, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\AuthorizationInterface $authorization, \Magento\Backend\Model\Session $backendSession, @@ -138,16 +138,16 @@ class Context extends \Magento\View\Element\Template\Context $viewUrl, $viewConfig, $cacheState, - $dirs, $logger, - $filesystem, - $viewFileSystem, - $enginePool, $app, - $appState, $escaper, $filterManager, $locale, + $dirs, + $filesystem, + $viewFileSystem, + $enginePool, + $appState, $storeManager, $data ); diff --git a/app/code/Magento/Backend/Block/Widget/Container.php b/app/code/Magento/Backend/Block/Widget/Container.php index 558184496dbe16e8fb45ae305640f72996d5f8c5..d040ea541b1fa63cfb31890b6756a182c876cd16 100644 --- a/app/code/Magento/Backend/Block/Widget/Container.php +++ b/app/code/Magento/Backend/Block/Widget/Container.php @@ -163,7 +163,7 @@ class Container extends \Magento\Backend\Block\Template * @param mixed $data * @return \Magento\Backend\Block\Widget\Container */ - protected function _updateButton($buttonId, $key=null, $data) + protected function _updateButton($buttonId, $key, $data) { foreach ($this->_buttons as $level => $buttons) { if (isset($buttons[$buttonId])) { @@ -194,7 +194,7 @@ class Container extends \Magento\Backend\Block\Template * @param mixed $data * @return \Magento\Backend\Block\Widget\Container */ - public function updateButton($buttonId, $key = null, $data) + public function updateButton($buttonId, $key, $data) { return $this->_updateButton($buttonId, $key, $data); } 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 d7f94fb6c59b8130329658e29b2263485fe8e520..60ec3d0bab603fc1c50d812ad6ccfdff910fef7d 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 @@ -33,20 +33,20 @@ class Theme extends \Magento\Backend\Block\Widget\Grid\Column\Filter\AbstractFilter { /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_labelFactory; /** * @param \Magento\Backend\Block\Context $context * @param \Magento\Core\Model\Resource\Helper $resourceHelper - * @param \Magento\Core\Model\Theme\LabelFactory $labelFactory + * @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\Core\Model\Theme\LabelFactory $labelFactory, + \Magento\View\Design\Theme\LabelFactory $labelFactory, array $data = array() ) { $this->_labelFactory = $labelFactory; @@ -87,7 +87,7 @@ class Theme { $options = $this->getColumn()->getOptions(); if (empty($options) || !is_array($options)) { - /** @var $label \Magento\Core\Model\Theme\Label */ + /** @var $label \Magento\View\Design\Theme\Label */ $label = $this->_labelFactory->create(); $options = $label->getLabelsCollection(); } diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php index 94ccea59c988d386eb3eb38621e37ac13c6fff5d..0d8f1d53735619910bd0c806dca38c651edbc77d 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Massaction/Additional.php @@ -40,7 +40,7 @@ namespace Magento\Backend\Block\Widget\Grid\Massaction; class Additional extends \Magento\Backend\Block\Widget\Form\Generic { /** - * @var \Magento\Core\Model\Layout\Argument\HandlerFactory + * @var \Magento\View\Layout\Argument\HandlerFactory */ protected $_handlerFactory; @@ -48,14 +48,14 @@ class Additional extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory + * @param \Magento\View\Layout\Argument\HandlerFactory $handlerFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory, + \Magento\View\Layout\Argument\HandlerFactory $handlerFactory, array $data = array() ) { parent::__construct($context, $registry, $formFactory, $data); diff --git a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php index caebd1ee74263872b2f5ddb3f70f1b025942b5be..327a5432a94bdd903194c27f86d2e44697997e25 100644 --- a/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php +++ b/app/code/Magento/Backend/Controller/Adminhtml/System/Config/System/Storage.php @@ -152,6 +152,7 @@ class Storage extends \Magento\Backend\App\Action ->save(); } } + // fall-through intentional case \Magento\Core\Model\File\Storage\Flag::STATE_FINISHED: case \Magento\Core\Model\File\Storage\Flag::STATE_NOTIFIED: $flagData = $flag->getFlagData(); diff --git a/app/code/Magento/Backend/Model/Config/Structure/Reader.php b/app/code/Magento/Backend/Model/Config/Structure/Reader.php index 57e1953bb0726e9fe2b4f795357cd89aac7b85ca..babc69fc95d248090ad0b0ab3869648508bad58a 100644 --- a/app/code/Magento/Backend/Model/Config/Structure/Reader.php +++ b/app/code/Magento/Backend/Model/Config/Structure/Reader.php @@ -65,6 +65,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -73,10 +74,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'system.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Backend/Model/Locale.php b/app/code/Magento/Backend/Model/Locale.php index f79c42fb435fe98307f93a13eb233fb3122e550a..07daff86781d0797f79c2b2ca2889d73608f8a66 100644 --- a/app/code/Magento/Backend/Model/Locale.php +++ b/app/code/Magento/Backend/Model/Locale.php @@ -55,10 +55,6 @@ class Locale extends \Magento\Core\Model\Locale /** * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Backend\Model\Session $session - * @param \Magento\Backend\Model\Locale\Manager $localeManager - * @param \Magento\App\RequestInterface $request - * @param \Magento\Core\Model\Locale\Validator $localeValidator * @param \Magento\Core\Helper\Translate $translate * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\App\State $appState @@ -67,16 +63,16 @@ class Locale extends \Magento\Core\Model\Locale * @param \Magento\Core\Model\App $app * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Core\Model\Date $dateModel - * @param string $locale - * + * @param \Magento\Backend\Model\Session $session + * @param \Magento\Backend\Model\Locale\Manager $localeManager + * @param \Magento\App\RequestInterface $request + * @param \Magento\Core\Model\Locale\Validator $localeValidator + * @param mixed $locale + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Event\ManagerInterface $eventManager, - \Magento\Backend\Model\Session $session, - \Magento\Backend\Model\Locale\Manager $localeManager, - \Magento\App\RequestInterface $request, - \Magento\Core\Model\Locale\Validator $localeValidator, \Magento\Core\Helper\Translate $translate, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\App\State $appState, @@ -85,6 +81,10 @@ class Locale extends \Magento\Core\Model\Locale \Magento\Core\Model\App $app, \Magento\Stdlib\DateTime $dateTime, \Magento\Core\Model\Date $dateModel, + \Magento\Backend\Model\Session $session, + \Magento\Backend\Model\Locale\Manager $localeManager, + \Magento\App\RequestInterface $request, + \Magento\Core\Model\Locale\Validator $localeValidator, $locale = null ) { $this->_session = $session; diff --git a/app/code/Magento/Backend/Model/Menu/Config/Reader.php b/app/code/Magento/Backend/Model/Menu/Config/Reader.php index cbe1a9de74b968164a2437f891f16f59c7a99b8e..73dfd4841d706d2f7f37ce915c22ea1162b1f7f1 100644 --- a/app/code/Magento/Backend/Model/Menu/Config/Reader.php +++ b/app/code/Magento/Backend/Model/Menu/Config/Reader.php @@ -35,6 +35,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -43,10 +44,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'menu.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Backend\Model\Menu\Config\Menu\Dom' + $domDocumentClass = 'Magento\Backend\Model\Menu\Config\Menu\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Backend/Model/Url.php b/app/code/Magento/Backend/Model/Url.php index f4e902d153c1f4efa55ad32ddc723e860aecf585..a79a347df59da3ddded46bce768393e273520563 100644 --- a/app/code/Magento/Backend/Model/Url.php +++ b/app/code/Magento/Backend/Model/Url.php @@ -105,18 +105,18 @@ class Url extends \Magento\Core\Model\Url * @var \Magento\Data\Form\FormKey */ protected $formKey; - + /** * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Backend\Helper\Data $backendHelper + * @param \Magento\Core\Model\App $app + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Session $session * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\Backend\Helper\Data $backendHelper * @param Menu\Config $menuConfig - * @param \Magento\Core\Model\App $app - * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\App\CacheInterface $cache * @param Auth\Session $authSession * @param \Magento\Encryption\EncryptorInterface $encryptor @@ -126,18 +126,20 @@ class Url extends \Magento\Core\Model\Url * @param \Magento\Data\Form\FormKey $formKey * @param null $areaCode * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\RequestInterface $request, \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Backend\Helper\Data $backendHelper, + \Magento\Core\Model\App $app, + \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Session $session, \Magento\Session\SidResolverInterface $sidResolver, + \Magento\Backend\Helper\Data $backendHelper, \Magento\Backend\Model\Menu\Config $menuConfig, - \Magento\Core\Model\App $app, - \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\App\CacheInterface $cache, \Magento\Backend\Model\Auth\Session $authSession, \Magento\Encryption\EncryptorInterface $encryptor, diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml index a03ce759c0406fd47423a096f20d437df79b65b8..44e6841acd7a30645344c8b3e1bd8a7a65f14814 100644 --- a/app/code/Magento/Backend/etc/adminhtml/system.xml +++ b/app/code/Magento/Backend/etc/adminhtml/system.xml @@ -124,7 +124,7 @@ <label>Design Theme</label> <field id="theme_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1"> <label>Design Theme</label> - <source_model>Magento\Core\Model\Theme\Label::getLabelsCollectionForSystemConfiguration</source_model> + <source_model>Magento\View\Design\Theme\Label::getLabelsCollectionForSystemConfiguration</source_model> <backend_model>Magento\Core\Model\Design\Backend\Theme</backend_model> <comment><![CDATA[If no value is specified, the system default will be used. The system default may be modified by third party extensions.]]></comment> </field> diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index 638faa9da90e17b0a4b167560e3a965813408fd3..550e9ec0cdfdecc5cbff9be1bf41d85a6a970b83 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -31,6 +31,7 @@ <preference for="Magento\Backend\Model\Config\Backend\File\RequestData\RequestDataInterface" type="Magento\Backend\Model\Config\Backend\File\RequestData" /> <preference for="Magento\Backend\Model\Auth\Credential\StorageInterface" type="Magento\User\Model\User" /> <preference for="Magento\Adminhtml\Helper\Data" type="Magento\Backend\Helper\Data" /> + <preference for="Magento\Backend\App\ConfigInterface" type="Magento\Backend\App\Config" /> <type name="Magento\App\AreaList"> <param name="areas"> <value> diff --git a/app/code/Magento/Bundle/Model/Product/Price.php b/app/code/Magento/Bundle/Model/Product/Price.php index 9a5b72029060e8949679069b3f2efd9580a45679..409ad68b7fa1b40da4edcea5d73678beef3e21a2 100644 --- a/app/code/Magento/Bundle/Model/Product/Price.php +++ b/app/code/Magento/Bundle/Model/Product/Price.php @@ -140,7 +140,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Catalog\Model\Product $product * @return double */ - public function getFinalPrice($qty = null, $product) + public function getFinalPrice($qty, $product) { if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { return $product->getCalculatedFinalPrice(); @@ -523,7 +523,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Catalog\Model\Product $product * @return decimal */ - public function getTierPrice($qty=null, $product) + public function getTierPrice($qty, $product) { $allGroups = \Magento\Customer\Model\Group::CUST_GROUP_ALL; $prices = $product->getData('tier_price'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php index 1164f299018f6675d9f452f2fbcaa98426261985..28e8f57bbc7925897fcf7435ee7ea56d1e362292 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Helper/Image.php @@ -41,23 +41,23 @@ class Image extends \Magento\Data\Form\Element\Image protected $_storeManager; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\UrlInterface $urlBuilder - * @param array $attributes + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param array $data */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\UrlInterface $urlBuilder, - $attributes = array() + \Magento\Core\Model\StoreManagerInterface $storeManager, + $data = array() ) { $this->_storeManager = $storeManager; - parent::__construct($escaper, $factoryElement, $factoryCollection, $urlBuilder, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $urlBuilder, $data); } protected function _getUrl() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php index f77878d44083f3a491dcc607fa44784d5a88711f..d9acf3257a9169a0d28014eeba21f266f483fc31 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Form/Renderer/Attribute/Urlkey.php @@ -82,7 +82,7 @@ class Urlkey 'disabled' => true, ); /** @var \Magento\Data\Form\Element\Hidden $hidden */ - $hidden = $this->_elementFactory->create('hidden', array('attributes' => $data)); + $hidden = $this->_elementFactory->create('hidden', array('data' => $data)); $hidden->setForm($element->getForm()); $storeId = $element->getForm()->getDataObject()->getStoreId(); @@ -91,7 +91,7 @@ class Urlkey $data['value'] = $element->getValue(); $data['checked'] = $this->_catalogData->shouldSaveUrlRewritesHistory($storeId); /** @var \Magento\Data\Form\Element\Checkbox $checkbox */ - $checkbox = $this->_elementFactory->create('checkbox', array('attributes' => $data)); + $checkbox = $this->_elementFactory->create('checkbox', array('data' => $data)); $checkbox->setForm($element->getForm()); return parent::getElementHtml() . '<br/>' . $hidden->getElementHtml() . $checkbox->getElementHtml() . $checkbox->getLabelHtml(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php index 22481c85d91399ce4684b9df03b83a559788427d..39768756a3e98920ee4c08be164d0482dc707584 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg.php @@ -60,30 +60,30 @@ class Wysiwyg extends \Magento\Data\Form\Element\Textarea protected $_layout; /** - * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig - * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper + * @param \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig + * @param \Magento\View\LayoutInterface $layout * @param \Magento\Module\Manager $moduleManager * @param \Magento\Backend\Helper\Data $backendData - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, - \Magento\View\LayoutInterface $layout, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, + \Magento\Cms\Model\Wysiwyg\Config $wysiwygConfig, + \Magento\View\LayoutInterface $layout, \Magento\Module\Manager $moduleManager, \Magento\Backend\Helper\Data $backendData, - array $attributes = array() + array $data = array() ) { $this->_wysiwygConfig = $wysiwygConfig; $this->_layout = $layout; $this->_moduleManager = $moduleManager; $this->_backendData = $backendData; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php index e732d9182d4febe30b3c7dbf801418aded130215..b57e110878298aabe0209fef0bd4faf402b0f038 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Helper/Form/Wysiwyg/Content.php @@ -69,7 +69,7 @@ class Content { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'wysiwyg_edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Form.php index 8c173867c54b454d7938ee942616ea33d2147b95..15fa712d5a9307dcdecafa8058cd2be4f1e75b2c 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Form.php @@ -41,7 +41,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php index 60792a268b0e55d1941b1f4380b3ae497281b327..690e3f927a4dec452d24c99a07abf4dbff6e781e 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Advanced.php @@ -79,7 +79,7 @@ class Advanced { $attributeObject = $this->getAttributeObject(); - $form = $this->_formFactory->create(array('attributes' => array( + $form = $this->_formFactory->create(array('data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post' diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php index 8ccfc9a5ebaca60ccb997907a9c935e2d3a4779f..70e779234667148dde56f13137eb3912fdb47d3f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php @@ -69,7 +69,7 @@ class Front extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php index 521f1fa1b86ca3e01c0246be6c83dbd13be5f8d6..b336778eadc47ec9282e79f75c86a8b424ffd0f4 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/NewCategory.php @@ -72,7 +72,7 @@ class NewCategory extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'new_category_form', )) ); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php index 28dce9b62ca08ed1c5da8debe885b12c8ed46e0a..d1b6807ba37b9921f8cf11397dbe3509779d718f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/BaseImage.php @@ -63,26 +63,26 @@ class BaseImage extends \Magento\Data\Form\Element\AbstractElement protected $_viewUrl; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\View\UrlFactory $coreViewUrlFactory * @param \Magento\Backend\Model\UrlFactory $backendUrlFactory * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\File\Size $fileConfig - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\View\UrlFactory $coreViewUrlFactory, \Magento\Backend\Model\UrlFactory $backendUrlFactory, \Magento\Catalog\Helper\Data $catalogData, \Magento\File\Size $fileConfig, - array $attributes = array() + array $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->_viewUrl = $coreViewUrlFactory->create(); $this->_url = $backendUrlFactory->create(); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php index c25f519a3d1e9f6a1bf8ab3b45822e4a740379e0..8fd0a345c7d3ffe8dc2df68ee5fac03eab0387fc 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Category.php @@ -48,40 +48,35 @@ class Category extends \Magento\Data\Form\Element\Multiselect */ protected $_collectionFactory; - /** - * @var \Magento\Core\Helper\Data - */ - protected $_coreData; - /** * @var \Magento\Json\EncoderInterface */ protected $_jsonEncoder; /** - * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory - * @param \Magento\Json\EncoderInterface $jsonEncoder - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper + * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\View\LayoutInterface $layout - * @param array $attributes + * @param \Magento\Json\EncoderInterface $jsonEncoder + * @param array $data */ public function __construct( - \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory, - \Magento\Json\EncoderInterface $jsonEncoder, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, + \Magento\Catalog\Model\Resource\Category\CollectionFactory $collectionFactory, \Magento\Backend\Helper\Data $backendData, \Magento\View\LayoutInterface $layout, - array $attributes = array() + \Magento\Json\EncoderInterface $jsonEncoder, + array $data = array() ) { $this->_jsonEncoder = $jsonEncoder; $this->_collectionFactory = $collectionFactory; $this->_backendData = $backendData; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->_layout = $layout; } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php index fba2da65e8a24bcd53d4d14b4c6044da53696948..0c2f515892d8829e211588d545f0fe3d3707ed6f 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery.php @@ -47,24 +47,24 @@ class Gallery extends \Magento\Data\Form\Element\AbstractElement protected $_layout; /** - * @param \Magento\View\LayoutInterface $layout - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param array $data */ public function __construct( - \Magento\View\LayoutInterface $layout, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + \Magento\View\LayoutInterface $layout, + \Magento\Core\Model\StoreManagerInterface $storeManager, + $data = array() ) { $this->_layout = $layout; $this->_storeManager = $storeManager; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } public function getElementHtml() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php index c4c19bab144781604efaf7677441718c03b73b7f..deb8206f74c971ecbc24a562773632f7ded9c7fa 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Price.php @@ -53,27 +53,27 @@ class Price extends \Magento\Data\Form\Element\Text protected $_locale; /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Tax\Helper\Data $taxData - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\LocaleInterface $locale, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\LocaleInterface $locale, \Magento\Tax\Helper\Data $taxData, - array $attributes = array() + array $data = array() ) { $this->_locale = $locale; $this->_storeManager = $storeManager; $this->_taxData = $taxData; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } protected function _construct() diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php index 75cab01e27d2aae66e9a52a5e1eb0d24569367df..374ac3b195fdb51a4625722d7cf67f81b419b100 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Weight.php @@ -52,26 +52,26 @@ class Weight extends \Magento\Data\Form\Element\Text protected $_helper; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\Catalog\Helper\Product $helper - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\Catalog\Helper\Product $helper, - array $attributes = array() + array $data = array() ) { $this->_helper = $helper; $this->_virtual = $factoryElement->create('checkbox'); $this->_virtual->setId(self::VIRTUAL_FIELD_HTML_ID)->setName('is_virtual') ->setLabel($this->_helper->getTypeSwitcherControlLabel()); - $attributes['class'] = + $data['class'] = 'validate-number validate-zero-or-greater validate-number-range number-range-0-99999999.9999'; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php index 67e85f553d8f82cad2a73b6a34ea7494ad4742cd..5af166e54249e0096911e5909901b61c6e4c1435 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Search/Edit/Form.php @@ -82,7 +82,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index 2c6d33afdba4260287b17404cb9efed390c700c1..b35ce907683e79cd4659097b6a75b64c03eafa0c 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -103,7 +103,7 @@ class View extends \Magento\View\Element\Template /** * want to show rss feed in the url */ - if ($this->IsRssCatalogEnable() && $this->IsTopCategory()) { + if ($this->isRssCatalogEnable() && $this->isTopCategory()) { $title = __('%1 RSS Feed', $this->getCurrentCategory()->getName()); $headBlock->addRss($title, $this->getRssLink()); } @@ -116,12 +116,12 @@ class View extends \Magento\View\Element\Template return $this; } - public function IsRssCatalogEnable() + public function isRssCatalogEnable() { return $this->_storeConfig->getConfig('rss/catalog/category'); } - public function IsTopCategory() + public function isTopCategory() { return $this->getCurrentCategory()->getLevel()==2; } diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php index 4dfa461a47c868d7d51060594ef8bc5964f9be5b..976d021cc744393d617b5364aa6ad237a3b05355 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Upsell.php @@ -79,7 +79,6 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct * @param \Magento\Checkout\Model\Resource\Cart $checkoutCart * @param \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility * @param \Magento\Checkout\Model\Session $checkoutSession - * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data */ public function __construct( @@ -92,7 +91,6 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct \Magento\Checkout\Model\Resource\Cart $checkoutCart, \Magento\Catalog\Model\Product\Visibility $catalogProductVisibility, \Magento\Checkout\Model\Session $checkoutSession, - \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_checkoutCart = $checkoutCart; @@ -194,7 +192,7 @@ class Upsell extends \Magento\Catalog\Block\Product\AbstractProduct /** * Set how many items we need to show in upsell block - * Notice: this parametr will be also applied + * Notice: this parameter will be also applied * * @param string $type * @param int $limit diff --git a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php index 23a5997ac928b704f9030f4c85e3b4137e866489..307a86b15ceb83363deb300c22ecba5d73a575c9 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php +++ b/app/code/Magento/Catalog/Model/Attribute/Backend/Customlayoutupdate.php @@ -34,29 +34,20 @@ namespace Magento\Catalog\Model\Attribute\Backend; class Customlayoutupdate extends \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend { - /** - * Product custom layout update attribute validate function. - * In case invalid data throws exception. - * - * @param \Magento\Object $object - * @throws \Magento\Eav\Model\Entity\Attribute\Exception - */ /** - * Layoutupdate validator factory + * Layout update validator factory * * @var \Magento\Core\Model\Layout\Update\ValidatorFactory */ protected $_layoutUpdateValidatorFactory; /** - * Construct - * - * @param \Magento\Core\Model\Layout\Update\ValidatorFactory $layoutUpdateValidatorFactory * @param \Magento\Logger $logger + * @param \Magento\Core\Model\Layout\Update\ValidatorFactory $layoutUpdateValidatorFactory */ public function __construct( - \Magento\Core\Model\Layout\Update\ValidatorFactory $layoutUpdateValidatorFactory, - \Magento\Logger $logger + \Magento\Logger $logger, + \Magento\Core\Model\Layout\Update\ValidatorFactory $layoutUpdateValidatorFactory ) { $this->_layoutUpdateValidatorFactory = $layoutUpdateValidatorFactory; parent::__construct($logger); diff --git a/app/code/Magento/Catalog/Model/Attribute/Config/Reader.php b/app/code/Magento/Catalog/Model/Attribute/Config/Reader.php index a03c78a96a3266c145185fe6270296d38cc59820..237ab6022e6329cc8e644e8dae7a8fdd7978e685 100644 --- a/app/code/Magento/Catalog/Model/Attribute/Config/Reader.php +++ b/app/code/Magento/Catalog/Model/Attribute/Config/Reader.php @@ -27,23 +27,45 @@ namespace Magento\Catalog\Model\Attribute\Config; class Reader extends \Magento\Config\Reader\Filesystem { + /** + * List of id attributes for merge + * + * @var array + */ + protected $_idAttributes = array( + '/config/group' => 'name', + '/config/group/attribute' => 'name', + ); + /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Catalog\Model\Attribute\Config\Converter $converter - * @param \Magento\Catalog\Model\Attribute\Config\SchemaLocator $schemaLocator + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState + * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Catalog\Model\Attribute\Config\Converter $converter, \Magento\Catalog\Model\Attribute\Config\SchemaLocator $schemaLocator, - \Magento\Config\ValidationStateInterface $validationState + \Magento\Config\ValidationStateInterface $validationState, + $fileName = 'catalog_attributes.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - $fileName = 'catalog_attributes.xml'; - $idAttributes = array( - '/config/group' => 'name', - '/config/group/attribute' => 'name', + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); - parent::__construct($fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes); } } diff --git a/app/code/Magento/Catalog/Model/Category/Indexer/Flat.php b/app/code/Magento/Catalog/Model/Category/Indexer/Flat.php index f126ea6af484b1fb9c1375b26c8b425b219b2648..b16fea5c543006d8648883275f8ace07b652d5e4 100644 --- a/app/code/Magento/Catalog/Model/Category/Indexer/Flat.php +++ b/app/code/Magento/Catalog/Model/Category/Indexer/Flat.php @@ -210,6 +210,7 @@ class Flat extends \Magento\Index\Model\Indexer\AbstractIndexer $this->_registerCoreStoreEvent($event); break; } + // fall-through intentional case \Magento\Core\Model\Store\Group::ENTITY: $event->addNewData('catalog_category_flat_skip_call_event_handler', true); $process = $event->getProcess(); diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php index 2e2539825a53e0e2b909be8a699686760bef1f57..2a77459993f48e0a31211a144b62044bb2513df2 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php @@ -89,24 +89,22 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter protected $_customerSession; /** - * Class constructor - * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $catalogLayerFilterPriceAlgorithm - * @param \Magento\Catalog\Model\Layer $catalogLayer * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Catalog\Model\Resource\Layer\Filter\PriceFactory $filterPriceFactory, \Magento\Customer\Model\Session $customerSession, \Magento\Catalog\Model\Layer\Filter\Price\Algorithm $catalogLayerFilterPriceAlgorithm, - \Magento\Catalog\Model\Layer $catalogLayer, \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php index 9972c5f786118b4bce9d9a38d2c6eeb3dbb7f8df..7db7a9859c2d9a186fde9dc53bd2f90604450899 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php @@ -42,28 +42,25 @@ class Groupprice protected $_productAttributeBackendGroupprice; /** - * Construct - * * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Config $config + * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Config $config + \Magento\Core\Model\Config $config, + \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice ) { $this->_productAttributeBackendGroupprice = $productAttributeBackendGroupprice; - parent::__construct($logger, $currencyFactory, $storeManager, $catalogProductType, $catalogData, - $config); + parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config, $catalogProductType); } /** 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 40bc88be6ab5c69da98f2937663b84ecfbbaf3df..cae206db4b7f00377bf3eeb0ca2b233a68d6bdad 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 @@ -60,22 +60,20 @@ abstract class AbstractGroupprice protected $_catalogProductType; /** - * Construct - * * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Config $config + * @param \Magento\Catalog\Model\Product\Type $catalogProductType */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Config $config + \Magento\Core\Model\Config $config, + \Magento\Catalog\Model\Product\Type $catalogProductType ) { $this->_catalogProductType = $catalogProductType; parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php index f2d3db3d839c914cb771992c7ceb2603886a999e..95466d771f5d5f39d14199cb3216658b8f998cfb 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Startdate.php @@ -45,16 +45,14 @@ class Startdate extends \Magento\Eav\Model\Entity\Attribute\Backend\Datetime protected $_date; /** - * Construct - * - * @param \Magento\Core\Model\Date $date - * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Logger $logger + * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Core\Model\Date $date */ public function __construct( - \Magento\Core\Model\Date $date, + \Magento\Logger $logger, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Logger $logger + \Magento\Core\Model\Date $date ) { $this->_date = $date; parent::__construct($logger, $locale); diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php index 5de002872a20e0d289f8d48c0650f0d3b56ab4ab..f2b357a73b7e2487fc35e78b7eae612ca132ac58 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -45,28 +45,25 @@ class Tierprice protected $_productAttributeBackendTierprice; /** - * Construct - * * @param \Magento\Logger $logger * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory - * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Product\Type $catalogProductType * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Core\Model\Config $config + * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice */ public function __construct( \Magento\Logger $logger, \Magento\Directory\Model\CurrencyFactory $currencyFactory, - \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Product\Type $catalogProductType, \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Config $config + \Magento\Core\Model\Config $config, + \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice ) { $this->_productAttributeBackendTierprice = $productAttributeTierprice; - parent::__construct($logger, $currencyFactory, $storeManager, $catalogProductType, $catalogData, - $config); + parent::__construct($logger, $currencyFactory, $storeManager, $catalogData, $config, $catalogProductType); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Indexer/Flat.php b/app/code/Magento/Catalog/Model/Product/Indexer/Flat.php index 1e2e5bde24991c545901bae58da0472ad774229a..eb0732a228f1d9fedd3701cf0078b2e1606ced7a 100644 --- a/app/code/Magento/Catalog/Model/Product/Indexer/Flat.php +++ b/app/code/Magento/Catalog/Model/Product/Indexer/Flat.php @@ -294,6 +294,7 @@ class Flat extends \Magento\Index\Model\Indexer\AbstractIndexer $this->_registerCoreStoreEvent($event); break; } + // fall-through intentional case \Magento\Catalog\Model\Resource\Eav\Attribute::ENTITY: case \Magento\Core\Model\Store\Group::ENTITY: $event->addNewData('catalog_product_flat_skip_call_event_handler', true); 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 e27fd34751ee7a035b04b772c429538e6e25cf0e..9c71199729f4a4f593da17f6c8b58eb4b92773e7 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Date.php @@ -48,17 +48,15 @@ class Date extends \Magento\Catalog\Model\Product\Option\Type\DefaultType protected $_locale; /** - * Construct - * - * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\LocaleInterface $locale * @param array $data */ public function __construct( - \Magento\Core\Model\LocaleInterface $locale, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Core\Model\LocaleInterface $locale, array $data = array() ) { $this->_locale = $locale; 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 ed4a58fd8048f573d0f70bd999d8040a1d9e2490..c9fcc3e8d550c8f04b374ee56953aab8d4a422ff 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -90,30 +90,28 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType protected $_itemOptionFactory; /** - * Construct - * + * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory * @param \Magento\UrlInterface $url * @param \Magento\App\Dir $dir - * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Escaper $escaper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase - * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Filesystem $filesystem * @param \Magento\File\Size $fileSize * @param array $data */ public function __construct( + \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, \Magento\UrlInterface $url, \Magento\App\Dir $dir, - \Magento\Checkout\Model\Session $checkoutSession, \Magento\Escaper $escaper, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, - \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Filesystem $filesystem, \Magento\File\Size $fileSize, - $data = array() + array $data = array() ) { $this->_itemOptionFactory = $itemOptionFactory; $this->_url = $url; 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 83ac16ae1187dd515a1ace9072c43930f8270102..3164914a931ab5b634b39cfd87531aa6a48a3333 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/Select.php @@ -50,16 +50,16 @@ class Select extends \Magento\Catalog\Model\Product\Option\Type\DefaultType /** * @param \Magento\Checkout\Model\Session $checkoutSession + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Stdlib\String $string * @param \Magento\Escaper $escaper - * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param array $data */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Stdlib\String $string, \Magento\Escaper $escaper, - \Magento\Core\Model\Store\Config $coreStoreConfig, array $data = array() ) { $this->string = $string; diff --git a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php index 985f1b154f7d02f9c875d60220aa1e873f5db8f4..2e8eaa7711a291bc888ca98f9950d645a3cccfcf 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php +++ b/app/code/Magento/Catalog/Model/Product/Type/AbstractType.php @@ -899,7 +899,7 @@ abstract class AbstractType * @param \Magento\Catalog\Model\Product $product * @return \Magento\Catalog\Model\Product\Type\AbstractType */ - public function setStoreFilter($store = null, $product) + public function setStoreFilter($store, $product) { $cacheKey = '_cache_instance_store_filter'; $product->setData($cacheKey, $store); diff --git a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php index e680ecaac99b59d6d45692316a898ae62a11d24a..77c5227e90b3e11f837f2b20292e05282a8d4692 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Configurable.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Configurable.php @@ -161,14 +161,18 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType protected $_typeConfigurableFactory; /** - * Construct - * * @codingStandardsIgnoreStart/End * * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Option $catalogProductOption * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Core\Helper\Data $coreData + * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb + * @param \Magento\Filesystem $filesystem + * @param \Magento\Core\Model\Registry $coreRegistry + * @param \Magento\Logger $logger * @param \Magento\Catalog\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory * @param \Magento\Eav\Model\EntityFactory $entityFactory * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory @@ -178,14 +182,8 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType * @param \Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Catalog\Model\Resource\Product\Type\Configurable $catalogProductTypeConfigurable * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Helper\Data $coreData - * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb - * @param \Magento\Filesystem $filesystem - * @param \Magento\Core\Model\Registry $coreRegistry - * @param \Magento\Logger $logger * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -193,6 +191,12 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Catalog\Model\Product\Option $catalogProductOption, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Event\ManagerInterface $eventManager, + \Magento\Core\Helper\Data $coreData, + \Magento\Core\Helper\File\Storage\Database $fileStorageDb, + \Magento\Filesystem $filesystem, + \Magento\Core\Model\Registry $coreRegistry, + \Magento\Logger $logger, \Magento\Catalog\Model\Resource\Product\Type\ConfigurableFactory $typeConfigurableFactory, \Magento\Eav\Model\EntityFactory $entityFactory, \Magento\Eav\Model\Entity\Attribute\SetFactory $attributeSetFactory, @@ -202,12 +206,6 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType \Magento\Catalog\Model\Resource\Product\Type\Configurable\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Catalog\Model\Resource\Product\Type\Configurable $catalogProductTypeConfigurable, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Helper\Data $coreData, - \Magento\Core\Helper\File\Storage\Database $fileStorageDb, - \Magento\Filesystem $filesystem, - \Magento\Core\Model\Registry $coreRegistry, - \Magento\Logger $logger, array $data = array() ) { $this->_typeConfigurableFactory = $typeConfigurableFactory; @@ -219,8 +217,19 @@ class Configurable extends \Magento\Catalog\Model\Product\Type\AbstractType $this->_attributeCollectionFactory = $attributeCollectionFactory; $this->_catalogProductTypeConfigurable = $catalogProductTypeConfigurable; $this->_storeManager = $storeManager; - parent::__construct($productFactory, $catalogProductOption, $eavConfig, $catalogProductType, - $eventManager, $coreData, $fileStorageDb, $filesystem, $coreRegistry, $logger, $data); + parent::__construct( + $productFactory, + $catalogProductOption, + $eavConfig, + $catalogProductType, + $eventManager, + $coreData, + $fileStorageDb, + $filesystem, + $coreRegistry, + $logger, + $data + ); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Type/Configurable/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Configurable/Price.php index 7e4045ee6b0cdb593c4593cc1f093d15bd9b6d50..e9c5b9e3b07ad836e3093dde662569d4e7231616 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Configurable/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Configurable/Price.php @@ -42,7 +42,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Catalog\Model\Product $product * @return double */ - public function getFinalPrice($qty=null, $product) + public function getFinalPrice($qty, $product) { if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { return $product->getCalculatedFinalPrice(); diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php b/app/code/Magento/Catalog/Model/Product/Type/Grouped.php index 2e1060925c1793f79504f4bb48ce662ef0766ef6..aadecf9b8c66edfab5182cbc396e21f70b7e4d00 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Grouped.php @@ -99,38 +99,38 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType protected $_appState; /** - * Construct - * * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Option $catalogProductOption * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Catalog\Model\Product\Type $catalogProductType - * @param \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Product\Status $catalogProductStatus * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Core\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Filesystem $filesystem * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Logger $logger + * @param \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Model\Product\Status $catalogProductStatus * @param \Magento\App\State $appState * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, \Magento\Catalog\Model\Product\Option $catalogProductOption, \Magento\Eav\Model\Config $eavConfig, \Magento\Catalog\Model\Product\Type $catalogProductType, - \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Product\Status $catalogProductStatus, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\Core\Helper\File\Storage\Database $fileStorageDb, \Magento\Filesystem $filesystem, \Magento\Core\Model\Registry $coreRegistry, \Magento\Logger $logger, + \Magento\Catalog\Model\Resource\Product\Link $catalogProductLink, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Model\Product\Status $catalogProductStatus, \Magento\App\State $appState, array $data = array() ) { @@ -138,8 +138,19 @@ class Grouped extends \Magento\Catalog\Model\Product\Type\AbstractType $this->_storeManager = $storeManager; $this->_catalogProductStatus = $catalogProductStatus; $this->_appState = $appState; - parent::__construct($productFactory, $catalogProductOption, $eavConfig, $catalogProductType, - $eventManager, $coreData, $fileStorageDb, $filesystem, $coreRegistry, $logger, $data); + parent::__construct( + $productFactory, + $catalogProductOption, + $eavConfig, + $catalogProductType, + $eventManager, + $coreData, + $fileStorageDb, + $filesystem, + $coreRegistry, + $logger, + $data + ); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php index 0e22db24152e0b0a3b7a0632ac4e8aa39a213c7e..8591eaeb5f4cf7fd1703f959a83a539a6f5d415f 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Grouped/Price.php @@ -42,7 +42,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Catalog\Model\Product $product * @return double */ - public function getFinalPrice($qty=null, $product) + public function getFinalPrice($qty, $product) { if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { return $product->getCalculatedFinalPrice(); diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index 8d1b57b72d01f8b317af1896a85c4e47a41a5eb4..2b6c8d8d3dd85b22377090f9457f198fbfb61d26 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -131,7 +131,7 @@ class Price * @param \Magento\Catalog\Model\Product $product * @return float */ - public function getFinalPrice($qty = null, $product) + public function getFinalPrice($qty, $product) { if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { return $product->getCalculatedFinalPrice(); @@ -235,7 +235,7 @@ class Price * @param \Magento\Catalog\Model\Product $product * @return float */ - public function getTierPrice($qty = null, $product) + public function getTierPrice($qty, $product) { $allGroups = \Magento\Customer\Model\Group::CUST_GROUP_ALL; $prices = $product->getData('tier_price'); @@ -353,7 +353,7 @@ class Price * @param \Magento\Catalog\Model\Product $product * @return array || float */ - public function getFormatedTierPrice($qty=null, $product) + public function getFormatedTierPrice($qty, $product) { $price = $product->getTierPrice($qty); if (is_array($price)) { diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config/Reader.php b/app/code/Magento/Catalog/Model/ProductOptions/Config/Reader.php index a98b554e56517ed3cbbcba58908a74239e2d5f0e..b0df41d4e75dae443d5e31c16ed6002656c5cc7d 100644 --- a/app/code/Magento/Catalog/Model/ProductOptions/Config/Reader.php +++ b/app/code/Magento/Catalog/Model/ProductOptions/Config/Reader.php @@ -43,6 +43,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -51,10 +52,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'product_options.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Catalog/Model/ProductTypes/Config/Reader.php b/app/code/Magento/Catalog/Model/ProductTypes/Config/Reader.php index 6321b9b5fb75a46d8e994bdbbe7a71961f058bde..b23ae4b3355be3cec5703965c5956ec7b5fc8d54 100644 --- a/app/code/Magento/Catalog/Model/ProductTypes/Config/Reader.php +++ b/app/code/Magento/Catalog/Model/ProductTypes/Config/Reader.php @@ -47,6 +47,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -55,10 +56,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'product_types.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php index 0b9f48aac790167a3db847e5cd738017cd500450..3ebf8306126bd384911b9b3edda0f83b87c695cf 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Flat.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Flat.php @@ -736,6 +736,7 @@ class Flat extends \Magento\Index\Model\Resource\AbstractResource } else { break; } + // fall-through intentional case \Magento\DB\Ddl\Table::TYPE_DECIMAL: $options = $column['PRECISION'] . ',' . $column['SCALE']; $_is_unsigned = null; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php index 3a8aa9d12d3f0b57ec956c36b184a025617b0ae0..4da0fb68e364917c9aa4b22241ded6cccb6c2d5b 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Image.php @@ -52,15 +52,13 @@ class Image protected $_fileUploaderFactory; /** - * Construct - * - * @param \Magento\App\Dir $dir * @param \Magento\Logger $logger + * @param \Magento\App\Dir $dir * @param \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory */ public function __construct( - \Magento\App\Dir $dir, \Magento\Logger $logger, + \Magento\App\Dir $dir, \Magento\Core\Model\File\UploaderFactory $fileUploaderFactory ) { $this->_dir = $dir; diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php index ab653e852e2cc5ea3f3150094679dc9690543d7c..b107288adc6cfef4dca4fa470bb1630f664a6914 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Urlkey.php @@ -45,15 +45,11 @@ class Urlkey protected $_catalogUrl; /** - * Construct - * - * @param \Magento\Catalog\Model\Url $catalogUrl * @param \Magento\Logger $logger + * @param \Magento\Catalog\Model\Url $catalogUrl */ - public function __construct( - \Magento\Catalog\Model\Url $catalogUrl, - \Magento\Logger $logger - ) { + public function __construct(\Magento\Logger $logger, \Magento\Catalog\Model\Url $catalogUrl) + { $this->_catalogUrl = $catalogUrl; parent::__construct($logger); } diff --git a/app/code/Magento/Catalog/Model/Session.php b/app/code/Magento/Catalog/Model/Session.php index b550dd7961c6974c2b3a674325fe1ae7e40dd9a4..7d9a489b9440cc69394755b7f3b8a2b0e319941e 100644 --- a/app/code/Magento/Catalog/Model/Session.php +++ b/app/code/Magento/Catalog/Model/Session.php @@ -39,15 +39,15 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param array $data * @param null $sessionName + * @param array $data */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array(), - $sessionName = null + $sessionName = null, + array $data = array() ) { parent::__construct($context, $sidResolver, $sessionConfig, $data); $this->start('catalog', $sessionName); diff --git a/app/code/Magento/Catalog/Model/Template/Filter.php b/app/code/Magento/Catalog/Model/Template/Filter.php index 5b52d053f4e3be47ce46b8c3842ba652581b306e..331e8c9c64b74b121eadb7540d9f1c8d95490d7f 100644 --- a/app/code/Magento/Catalog/Model/Template/Filter.php +++ b/app/code/Magento/Catalog/Model/Template/Filter.php @@ -64,20 +64,20 @@ class Filter extends \Magento\Filter\Template protected $_storeManager; /** - * Construct - * * @param \Magento\Stdlib\String $string * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\View\Url $viewUrl + * @param array $variables */ public function __construct( \Magento\Stdlib\String $string, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\View\Url $viewUrl + \Magento\View\Url $viewUrl, + $variables = array() ) { $this->_storeManager = $storeManager; $this->_viewUrl = $viewUrl; - parent::__construct($string); + parent::__construct($string, $variables); } /** diff --git a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml index 5c133f983c1dea06bb02f144be94b5fec74ae1b4..4f71e645988c33160e6668e66d1877582d408523 100644 --- a/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml @@ -49,31 +49,10 @@ </block> </referenceBlock> <update handle="page_calendar"/> - <block class="Magento\Catalog\Block\Product\View" name="product.info" template="product/view/form.phtml"> - <container name="product.info.form.content" label="invisible" as="product_info_form_content"> - <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="product/view/addtocart.phtml"/> - </container> - <block class="Magento\View\Element\Template" name="product.info.form.options" as="options_container"> - <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="product/view/options/wrapper.phtml"> - <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml"> - <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="product/view/options/type/default.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" as="text" template="product/view/options/type/text.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Options\Type\File" as="file" template="product/view/options/type/file.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" as="date" template="product/view/options/type/date.phtml"/> - </block> - <block class="Magento\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/> - </block> - <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="product/view/options/wrapper/bottom.phtml"> - <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="product/view/addtocart.phtml"/> - <block class="Magento\Catalog\Block\Product\View" name="product.clone_prices" as="prices" template="product/view/price_clone.phtml"/> - </block> - </block> - </block> <referenceContainer name="content"> <container name="product.info.main" label="invisible" htmlTag="div" htmlClass="product info main" before="-"> - <block class="Magento\Catalog\Block\Product\View" name="product.price" template="product/view/price.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml"> + <block class="Magento\Catalog\Block\Product\View" name="product.price" template="product/view/price.phtml" before="-"/> + <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.sku" template="product/view/attribute.phtml" after="product.price"> <arguments> <argument name="at_call" xsi:type="string">getSku</argument> <argument name="at_code" xsi:type="string">sku</argument> @@ -82,8 +61,10 @@ <argument name="add_attribute" xsi:type="string">itemprop="sku"</argument> </arguments> </block> - <block class="Magento\Catalog\Block\Product\View" name="product.info.rating" template="product/view/rating.phtml"/> - <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.overview" template="product/view/attribute.phtml" group="detailed_info"> + <block class="Magento\Catalog\Block\Product\View" name="product.info.rating" template="product/view/rating.phtml" after="product.info.sku"/> + <container name="alert.urls" as="alert_urls" label="Alert Urls" after="product.info.rating"/> + <container name="product.info.type" label="invisible" after="product.info.overview"/> + <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.overview" template="product/view/attribute.phtml" group="detailed_info" after="alert.urls"> <arguments> <argument name="at_call" xsi:type="string">getShortDescription</argument> <argument name="at_code" xsi:type="string">short_description</argument> @@ -93,12 +74,31 @@ <argument name="add_attribute" xsi:type="string">itemprop="description"</argument> </arguments> </block> - <container name="alert.urls" as="alert_urls" label="Alert Urls"/> - <container name="product.info.type" label="invisible"/> - <block class="Magento\Catalog\Block\Product\View" name="product.tierprices" as="tierprices" template="product/view/tierprices.phtml"/> + <block class="Magento\Catalog\Block\Product\View" name="product.tierprices" template="product/view/tierprices.phtml" before="product.info"/> + <block class="Magento\Catalog\Block\Product\View" name="product.info" template="product/view/form.phtml"> + <container name="product.info.form.content" label="invisible" as="product_info_form_content"> + <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="product/view/addtocart.phtml"/> + </container> + <block class="Magento\View\Element\Template" name="product.info.form.options" as="options_container"> + <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper" as="product_options_wrapper" template="product/view/options/wrapper.phtml"> + <block class="Magento\Catalog\Block\Product\View\Options" name="product.info.options" as="product_options" template="product/view/options.phtml"> + <block class="Magento\Catalog\Block\Product\View\Options\Type\DefaultType" as="default" template="product/view/options/type/default.phtml"/> + <block class="Magento\Catalog\Block\Product\View\Options\Type\Text" as="text" template="product/view/options/type/text.phtml"/> + <block class="Magento\Catalog\Block\Product\View\Options\Type\File" as="file" template="product/view/options/type/file.phtml"/> + <block class="Magento\Catalog\Block\Product\View\Options\Type\Select" as="select" template="product/view/options/type/select.phtml"/> + <block class="Magento\Catalog\Block\Product\View\Options\Type\Date" as="date" template="product/view/options/type/date.phtml"/> + </block> + <block class="Magento\View\Element\Html\Calendar" name="html_calendar" as="html_calendar" template="Magento_Theme::js/calendar.phtml"/> + </block> + <block class="Magento\Catalog\Block\Product\View" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="product/view/options/wrapper/bottom.phtml"> + <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart.additional" as="product.info.addtocart" template="product/view/addtocart.phtml"/> + <block class="Magento\Catalog\Block\Product\View" name="product.clone_prices" as="prices" template="product/view/price_clone.phtml"/> + </block> + </block> + </block> <container name="product.info.extrahint" as="extrahint" label="Product View Extra Hint"/> <block class="Magento\Catalog\Block\Product\View" name="product.info.addto" as="addto" template="product/view/addto.phtml"/> - <container name="product.info.social" label="Product social links container" htmlTag="div" htmlClass="social links product"> + <container name="product.info.social" label="Product social links container" htmlTag="div" htmlClass="social links product" after="product.info.addto"> <block class="Magento\Catalog\Block\Product\View" name="product.info.mailto" template="product/view/mailto.phtml"/> </container> </container> diff --git a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php index 1d8d9c2fd9c04f5d0b57445647c70f5c3c0e5a5e..d867957778645c6fe8da69bf0be8f1daa995eb2e 100644 --- a/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php +++ b/app/code/Magento/CatalogInventory/Block/Adminhtml/Form/Field/Stock.php @@ -55,26 +55,24 @@ class Stock extends \Magento\Data\Form\Element\Select protected $_factoryText; /** - * Construct - * - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\TextFactory $factoryText - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\Data\Form\Element\TextFactory $factoryText, - array $attributes = array() + array $data = array() ) { $this->_factoryText = $factoryText; - $this->_qty = isset($attributes['qty']) ? $attributes['qty'] : $this->_createQtyElement(); - unset($attributes['qty']); - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); - $this->setName($attributes['name']); + $this->_qty = isset($data['qty']) ? $data['qty'] : $this->_createQtyElement(); + unset($data['qty']); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); + $this->setName($data['name']); } /** diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php index 34ee5a9e41de6b457d87d378e765e43bc8844c08..db3334dcabbd1db6e5db35a53dab934cedfcf337 100644 --- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php +++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Form.php @@ -47,7 +47,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('catalog_rule/promo_catalog/save'), 'method' => 'post', diff --git a/app/code/Magento/CatalogRule/Model/Observer.php b/app/code/Magento/CatalogRule/Model/Observer.php index 5d8ed38d7b08e360bb9ec43f899b095edd80ffcd..36d844889526316d8b633e831a9d129a11c8aa8c 100644 --- a/app/code/Magento/CatalogRule/Model/Observer.php +++ b/app/code/Magento/CatalogRule/Model/Observer.php @@ -107,10 +107,9 @@ class Observer * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Backend\Model\Session $backendSession - * @param Rule\Product\Price $productPrice * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\Stdlib\DateTime $dateTime - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -124,7 +123,6 @@ class Observer \Magento\Core\Model\LocaleInterface $locale, \Magento\Customer\Model\Session $customerSession, \Magento\Backend\Model\Session $backendSession, - \Magento\CatalogRule\Model\Rule\Product\Price $productPrice, \Magento\Core\Model\Registry $coreRegistry, \Magento\Stdlib\DateTime $dateTime ) { diff --git a/app/code/Magento/CatalogRule/Model/Rule/Action/Collection.php b/app/code/Magento/CatalogRule/Model/Rule/Action/Collection.php index c6928607953a9ad32e9ac984f03eeef32a3d15e0..4c0918300f10c7e45b7cb2f8351c42e39e9e4d51 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Action/Collection.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Action/Collection.php @@ -31,17 +31,17 @@ class Collection extends \Magento\Rule\Model\Action\Collection { /** * @param \Magento\View\Url $viewUrl - * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param array $data */ public function __construct( \Magento\View\Url $viewUrl, - \Magento\Rule\Model\ActionFactory $actionFactory, \Magento\View\LayoutInterface $layout, + \Magento\Rule\Model\ActionFactory $actionFactory, array $data = array() ) { - parent::__construct($viewUrl, $actionFactory, $layout, $data); + parent::__construct($viewUrl, $layout, $actionFactory, $data); $this->setType('Magento\CatalogRule\Model\Rule\Action\Collection'); } diff --git a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php index d2183913c55461c34e4532b3d487328b95e8c4b7..5c8a3abe7a01b7007577ae72bded3d703f3dd07f 100644 --- a/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php +++ b/app/code/Magento/CatalogRule/Model/Rule/Condition/Combine.php @@ -37,13 +37,13 @@ class Combine extends \Magento\Rule\Model\Condition\Combine protected $_productFactory; /** - * @param \Magento\CatalogRule\Model\Rule\Condition\ProductFactory $conditionFactory * @param \Magento\Rule\Model\Condition\Context $context + * @param \Magento\CatalogRule\Model\Rule\Condition\ProductFactory $conditionFactory * @param array $data */ public function __construct( - \Magento\CatalogRule\Model\Rule\Condition\ProductFactory $conditionFactory, \Magento\Rule\Model\Condition\Context $context, + \Magento\CatalogRule\Model\Rule\Condition\ProductFactory $conditionFactory, array $data = array() ) { $this->_productFactory = $conditionFactory; diff --git a/app/code/Magento/CatalogSearch/Block/Autocomplete.php b/app/code/Magento/CatalogSearch/Block/Autocomplete.php index 2f282e0cf3051f2f2e93af85b5a36d430c637388..3acebfb3e7da891070d0e3fbb9a5ec004a2d5b8c 100644 --- a/app/code/Magento/CatalogSearch/Block/Autocomplete.php +++ b/app/code/Magento/CatalogSearch/Block/Autocomplete.php @@ -58,8 +58,9 @@ class Autocomplete extends \Magento\View\Element\AbstractBlock $item['row_class'] .= ' last'; } - $html .= '<li title="'.$this->escapeHtml($item['title']).'" class="'.$item['row_class'].'">' - . '<span class="amount">'.$item['num_of_results'].'</span>'.$this->escapeHtml($item['title']).'</li>'; + $escapedTitle = $this->escapeHtml($item['title']); + $html .= '<li title="'.$escapedTitle.'" class="'.$item['row_class'].'">' + . '<span class="amount">'.$item['num_of_results'].'</span>'.$escapedTitle.'</li>'; } $html.= '</ul>'; diff --git a/app/code/Magento/CatalogSearch/Block/Layer.php b/app/code/Magento/CatalogSearch/Block/Layer.php index 4be2228a3a4b0f0945f0abe996d66464ea82b517..5a22b1279fb6be4bffbebdc6cd7123be09c70d6f 100644 --- a/app/code/Magento/CatalogSearch/Block/Layer.php +++ b/app/code/Magento/CatalogSearch/Block/Layer.php @@ -63,7 +63,6 @@ class Layer extends \Magento\Catalog\Block\Layer\View * @param \Magento\CatalogSearch\Model\Layer $catalogLayer * @param \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider * @param \Magento\CatalogSearch\Helper\Data $catalogSearchData - * @param \Magento\CatalogSearch\Model\Layer $catalogSearchLayer * @param \Magento\Core\Model\Registry $registry * @param array $data */ @@ -72,14 +71,12 @@ class Layer extends \Magento\Catalog\Block\Layer\View \Magento\CatalogSearch\Model\Layer $catalogLayer, \Magento\CatalogSearch\Model\Resource\EngineProvider $engineProvider, \Magento\CatalogSearch\Helper\Data $catalogSearchData, - \Magento\CatalogSearch\Model\Layer $catalogSearchLayer, \Magento\Core\Model\Registry $registry, array $data = array() ) { $this->_engineProvider = $engineProvider; $this->_coreRegistry = $registry; $this->_catalogSearchData = $catalogSearchData; - $this->_catalogSearchLayer = $catalogSearchLayer; parent::__construct($context, $catalogLayer, $data); } diff --git a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php index 8eacc56285ab9b56d97924b1bff1130a07b88e89..474938fed3d7c13803162dff599f2a868a0708af 100644 --- a/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php +++ b/app/code/Magento/Checkout/Block/Adminhtml/Agreement/Edit/Form.php @@ -72,7 +72,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $model = $this->_coreRegistry->registry('checkout_agreement'); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Checkout/Block/Onepage/Success.php b/app/code/Magento/Checkout/Block/Onepage/Success.php index 97a598a3a08801a1c764f520ba702f9fce1da044..c8139e46cc1cbcca9c99b837f23bbd6fee40f74b 100644 --- a/app/code/Magento/Checkout/Block/Onepage/Success.php +++ b/app/code/Magento/Checkout/Block/Onepage/Success.php @@ -58,7 +58,7 @@ class Success extends \Magento\View\Element\Template /** * @var \Magento\Sales\Model\Resource\Recurring\Profile\Collection */ - protected $_profileCollFactory; + protected $_recurringProfileCollectionFactory; /** * @var \Magento\Sales\Model\Order\Config @@ -71,7 +71,7 @@ class Success extends \Magento\View\Element\Template * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory - * @param \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollFactory + * @param \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $recurringProfileCollectionFactory * @param \Magento\Sales\Model\Order\Config $orderConfig * @param array $data */ @@ -81,17 +81,17 @@ class Success extends \Magento\View\Element\Template \Magento\Customer\Model\Session $customerSession, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Sales\Model\Billing\AgreementFactory $agreementFactory, - \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $profileCollFactory, + \Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory $recurringProfileCollectionFactory, \Magento\Sales\Model\Order\Config $orderConfig, array $data = array() ) { + parent::__construct($context, $data); $this->_checkoutSession = $checkoutSession; $this->_customerSession = $customerSession; $this->_orderFactory = $orderFactory; $this->_agreementFactory = $agreementFactory; - $this->_profileCollFactory = $profileCollFactory; + $this->_recurringProfileCollectionFactory = $recurringProfileCollectionFactory; $this->_orderConfig = $orderConfig; - parent::__construct($context, $data); } /** @@ -175,9 +175,8 @@ class Success extends \Magento\View\Element\Template { $profileIds = $this->_checkoutSession->getLastRecurringProfileIds(); if ($profileIds && is_array($profileIds)) { - $collection = $this->_profileCollFactory->create()->getCollection() - ->addFieldToFilter('profile_id', array('in' => $profileIds)) - ; + $collection = $this->_recurringProfileCollectionFactory->create() + ->addFieldToFilter('profile_id', array('in' => $profileIds)); $profiles = array(); foreach ($collection as $profile) { $profiles[] = $profile; diff --git a/app/code/Magento/Checkout/view/frontend/js/opcheckout.js b/app/code/Magento/Checkout/view/frontend/js/opcheckout.js index 1e2f48c7e8d62b7b0adcd4b6de9b6865d5dcf319..501ef6b3c056ef01e4c9971d99e8502cbd4175f0 100644 --- a/app/code/Magento/Checkout/view/frontend/js/opcheckout.js +++ b/app/code/Magento/Checkout/view/frontend/js/opcheckout.js @@ -51,35 +51,40 @@ }, _create: function() { - var _this = this; this.checkoutPrice = this.options.quoteBaseGrandTotal; if (this.options.checkout.suggestRegistration) { $(this.options.checkout.loginGuestSelector).prop('checked', false); $(this.options.checkout.loginRegisterSelector).prop('checked', true); } - this.element - .on('click', this.options.checkout.continueSelector, function() { - $.proxy(_this._continue($(this)), _this); - }) - .on('gotoSection', function(event, section) { - $.proxy(_this._ajaxUpdateProgress(section), _this); - _this.element.trigger('enableSection', {selector: _this.options.sectionSelectorPrefix + section}); - }) - .on('ajaxError', $.proxy(this._ajaxError, this)) - .on('showAjaxLoader', $.proxy(this._ajaxSend, this)) - .on('hideAjaxLoader', $.proxy(this._ajaxComplete, this)) - .on('click', this.options.backSelector, function() { - _this.element.trigger('enableSection', {selector: '#' + _this.element.find('.active').prev().attr('id')}); - }) - .on('click', '[data-action="login-form-submit"]', function() { - $(_this.options.checkout.loginFormSelector).submit(); - }); - $(this.options.checkoutProgressContainer).on('click', '[data-goto-section]', $.proxy(function(e) { - var gotoSection = $(e.target).data('goto-section'); - this._ajaxUpdateProgress(gotoSection); - this.element.trigger('enableSection', {selector: _this.options.sectionSelectorPrefix + gotoSection}); - return false; - }, this)); + var events = {}; + events['click ' + this.options.checkout.continueSelector] = function(e) { + this._continue($(e.target)); + }; + events['click ' + this.options.backSelector] = function() { + this.element.trigger('enableSection', {selector: '#' + this.element.find('.active').prev().attr('id')}); + }; + $.extend(events, { + ajaxError: '_ajaxError', + showAjaxLoader: '_ajaxSend', + hideAjaxLoader: '_ajaxComplete', + gotoSection: function(e, section) { + this._ajaxUpdateProgress(section); + this.element.trigger('enableSection', {selector: this.options.sectionSelectorPrefix + section}); + }, + 'click [data-action=login-form-submit]': function() { + $(this.options.checkout.loginFormSelector).submit(); + } + }); + this._on(events); + + this._on($(this.options.checkoutProgressContainer), { + 'click [data-goto-section]' : function(e) { + var gotoSection = $(e.target).data('goto-section'); + this._ajaxUpdateProgress(gotoSection); + this.element.trigger('enableSection', {selector: this.options.sectionSelectorPrefix + gotoSection}); + return false; + } + }); }, /** @@ -236,16 +241,18 @@ _create: function() { this._super(); - this.element - .on('change', this.options.billing.addressDropdownSelector, $.proxy(function(e) { - this.element.find(this.options.billing.newAddressFormSelector).toggle(!$(e.target).val()); - }, this)) - .on('click', this.options.billing.continueSelector, $.proxy(function() { - if ($(this.options.billing.form).validation && $(this.options.billing.form).validation('isValid')) { - this._billingSave(); - } - }, this)) - .find(this.options.billing.form).validation(); + var events = {}; + events['change ' + this.options.billing.addressDropdownSelector] = function(e) { + this.element.find(this.options.billing.newAddressFormSelector).toggle(!$(e.target).val()); + }; + events['click ' + this.options.billing.continueSelector] = function() { + if ($(this.options.billing.form).validation && $(this.options.billing.form).validation('isValid')) { + this._billingSave(); + } + }; + this._on(events); + + this.element.find(this.options.billing.form).validation(); } , _billingSave: function() { @@ -271,27 +278,31 @@ _create: function() { this._super(); - this.element - .on('change', this.options.shipping.addressDropdownSelector, $.proxy(function(e) { - $(this.options.shipping.newAddressFormSelector).toggle(!$(e.target).val()); - }, this)) - .on('input propertychange', this.options.shipping.form + ' :input[name]', $.proxy(function() { - $(this.options.shipping.copyBillingSelector).prop('checked', false); - }, this)) - .on('click', this.options.shipping.copyBillingSelector, $.proxy(function(e) { - if ($(e.target).is(':checked')) { - this._billingToShipping(); - } - }, this)) - .on('click', this.options.shipping.continueSelector, $.proxy(function() { - if ($(this.options.shipping.form).validation && $(this.options.shipping.form).validation('isValid')) { + var events = {}; + events['change ' + this.options.shipping.addressDropdownSelector] = function(e) { + $(this.options.shipping.newAddressFormSelector).toggle(!$(e.target).val()); + }; + var onInputPropChange = function() { + $(this.options.shipping.copyBillingSelector).prop('checked', false); + }; + events['input ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange; + events['propertychange ' + this.options.shipping.form + ' :input[name]'] = onInputPropChange; + events['click ' + this.options.shipping.copyBillingSelector] = function(e) { + if ($(e.target).is(':checked')) { + this._billingToShipping(); + } + }; + events['click ' + this.options.shipping.continueSelector] = function() { + if ($(this.options.shipping.form).validation && $(this.options.shipping.form).validation('isValid')) { this._ajaxContinue(this.options.shipping.saveUrl, $(this.options.shipping.form).serialize(), false, function() { //Trigger indicating shipping save. eg. GiftMessage listens to this to inject gift options this.element.trigger('shippingSave'); }); - } - }, this)) - .find(this.options.shipping.form).validation(); + } + }; + this._on(events); + + this.element.find(this.options.shipping.form).validation(); }, /** @@ -321,26 +332,29 @@ _create: function() { this._super(); - var _this = this; - this.element - .on('click', this.options.shippingMethod.continueSelector, $.proxy(function() { - if (this._validateShippingMethod()&& - $(this.options.shippingMethod.form).validation && - $(this.options.shippingMethod.form).validation('isValid')) { - this._ajaxContinue(this.options.shippingMethod.saveUrl, $(this.options.shippingMethod.form).serialize()); - } - }, this)) - .on('click', 'input[name="shipping_method"]', function() { - var selectedPrice = _this.shippingCodePrice[$(this).val()] || 0, - oldPrice = _this.shippingCodePrice[_this.currentShippingMethod] || 0; - _this.checkoutPrice = _this.checkoutPrice - oldPrice + selectedPrice; - _this.currentShippingMethod = $(this).val(); - }) - .on('contentUpdated', $.proxy(function() { + var events = {}; + events['click ' + this.options.shippingMethod.continueSelector] = function() { + if (this._validateShippingMethod()&& + $(this.options.shippingMethod.form).validation && + $(this.options.shippingMethod.form).validation('isValid')) { + this._ajaxContinue(this.options.shippingMethod.saveUrl, $(this.options.shippingMethod.form).serialize()); + } + }; + $.extend(events, { + 'click input[name=shipping_method]': function(e) { + var selectedPrice = this.shippingCodePrice[$(e.target).val()] || 0, + oldPrice = this.shippingCodePrice[this.currentShippingMethod] || 0; + this.checkoutPrice = this.checkoutPrice - oldPrice + selectedPrice; + this.currentShippingMethod = $(e.target).val(); + }, + 'contentUpdated': function() { this.currentShippingMethod = this.element.find('input[name="shipping_method"]:checked').val(); this.shippingCodePrice = this.element.find('[data-shipping-code-price]').data('shipping-code-price'); - }, this)) - .find(this.options.shippingMethod.form).validation(); + } + }); + this._on(events); + + this.element.find(this.options.shippingMethod.form).validation(); }, /** @@ -378,15 +392,30 @@ _create: function() { this._super(); - this.element - .on('click', this.options.payment.continueSelector, $.proxy(function() { - if (this._validatePaymentMethod() && - $(this.options.payment.form).validation && - $(this.options.payment.form).validation('isValid')) { - this._ajaxContinue(this.options.payment.saveUrl, $(this.options.payment.form).serialize()); - } - }, this)) - .on('updateCheckoutPrice', $.proxy(function(event, data) { + var events = {}; + events['click ' + this.options.payment.continueSelector] = function() { + if (this._validatePaymentMethod() && + $(this.options.payment.form).validation && + $(this.options.payment.form).validation('isValid')) { + this._ajaxContinue(this.options.payment.saveUrl, $(this.options.payment.form).serialize()); + } + }; + events['contentUpdated ' + this.options.payment.form] = function() { + $(this.options.payment.form).find('dd [name^="payment["]').prop('disabled', true); + var checkoutPrice = this.element.find(this.options.payment.form).find('[data-checkout-price]').data('checkout-price'); + if ($.isNumeric(checkoutPrice)) { + this.checkoutPrice = checkoutPrice; + } + if (this.checkoutPrice < this.options.minBalance) { + this._disablePaymentMethods(); + } else { + this._enablePaymentMethods(); + } + }; + events['click ' + this.options.payment.form + ' dt input:radio'] = '_paymentMethodHandler'; + + $.extend(events, { + updateCheckoutPrice: function(event, data) { if (data.price) { this.checkoutPrice += data.price; } @@ -400,21 +429,12 @@ // Remove free input field, show all payment method this._enablePaymentMethods(); } - }, this)) - .on('contentUpdated', this.options.payment.form, $.proxy(function() { - $(this.options.payment.form).find('dd [name^="payment["]').prop('disabled', true); - var checkoutPrice = this.element.find(this.options.payment.form).find('[data-checkout-price]').data('checkout-price'); - if ($.isNumeric(checkoutPrice)) { - this.checkoutPrice = checkoutPrice; - } - if (this.checkoutPrice < this.options.minBalance) { - this._disablePaymentMethods(); - } else { - this._enablePaymentMethods(); - } - }, this)) - .on('click', this.options.payment.form + ' dt input:radio', $.proxy(this._paymentMethodHandler, this)) - .find(this.options.payment.form).validation({ + } + }); + + this._on(events); + + this.element.find(this.options.payment.form).validation({ errorPlacement: function(error, element) { if (element.attr('data-validate') && element.attr('data-validate').indexOf('validate-cc-ukss') >= 0) { element.parents('form').find('[data-validation-msg="validate-cc-ukss"]').html(error); @@ -499,26 +519,27 @@ _create: function() { this._super(); - this.element - .on('click', this.options.review.continueSelector, $.proxy(this._saveOrder, this)) - .on('saveOrder', this.options.review.container, $.proxy(this._saveOrder, this)) - .on('contentUpdated', this.options.review.container, $.proxy(function() { - var paypalIframe = this.element.find(this.options.review.container) - .find('[data-container="paypal-iframe"]'); - if (paypalIframe.length) { - paypalIframe.show(); - $(this.options.review.submitContainer).hide(); - } - }, this)); + var events = {}; + events['click ' + this.options.review.continueSelector] = this._saveOrder; + events['saveOrder' + this.options.review.container] = this._saveOrder; + events['contentUpdated' + this.options.review.container] = function() { + var paypalIframe = this.element.find(this.options.review.container) + .find('[data-container="paypal-iframe"]'); + if (paypalIframe.length) { + paypalIframe.show(); + $(this.options.review.submitContainer).hide(); + } + }; + this._on(events); }, _saveOrder: function() { - if ($(this.options.payment.form).validation && - $(this.options.payment.form).validation('isValid')) { - this._ajaxContinue( - this.options.review.saveUrl, + if ($(this.options.payment.form).validation && + $(this.options.payment.form).validation('isValid')) { + this._ajaxContinue( + this.options.review.saveUrl, $(this.options.payment.form).serialize() + '&' + $(this.options.review.agreementFormSelector).serialize()); - } + } } }); })(jQuery, window); diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml index b899db32ef36bb2aa8f783ecf6f2e3bad5695fe0..8732368c29fde2062eb85f1f7800bbeff6dbe9e9 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml @@ -24,6 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <update handle="page_one_column"/> <referenceContainer name="content"> <block class="Magento\Checkout\Block\Cart" name="checkout.cart" template="cart.phtml"> <container name="checkout.cart.items" label="invisible" as="with-items"> diff --git a/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml b/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml index 49eedbea9b0d4bc3cc0befd53493394bb8843dff..9ea6704cdc689e3b802d8da167d70243d9ef6150 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/billing.phtml @@ -42,7 +42,7 @@ <div class="field required email"> <label class="label" for="billing:email"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"/> + <input type="email" name="billing[email]" id="billing:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"/> </div> </div> <?php endif; ?> diff --git a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml index 084ebdadb563760593a26e0b1c3ce0585fc0a917..459243004aaedefe8cc5cdd9b4b6e5435865a41b 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/login.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/login.phtml @@ -41,7 +41,7 @@ <div class="field email required"> <label class="label" for="login-email"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" class="input-text" id="login-email" name="login[username]" data-validate="{required:true, 'validate-email':true}" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" /> + <input type="email" class="input-text" id="login-email" name="login[username]" data-validate="{required:true, 'validate-email':true}" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" /> </div> </div> <div class="field password required"> diff --git a/app/code/Magento/Checkout/view/frontend/onepage/review/button.phtml b/app/code/Magento/Checkout/view/frontend/onepage/review/button.phtml index 19906996410079e4f7d6b89d9a63767f119315bb..91008edae7de16778f3d50e2fde99028b5887f51 100644 --- a/app/code/Magento/Checkout/view/frontend/onepage/review/button.phtml +++ b/app/code/Magento/Checkout/view/frontend/onepage/review/button.phtml @@ -22,4 +22,4 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<button role='review-save' type="submit" title="<?php echo __('Place Order') ?>" class="button action checkout"><span><?php echo __('Place Order') ?></span></button> +<button data-role="review-save" type="submit" title="<?php echo __('Place Order') ?>" class="button action checkout"><span><?php echo __('Place Order') ?></span></button> diff --git a/app/code/Magento/Checkout/view/frontend/success.phtml b/app/code/Magento/Checkout/view/frontend/success.phtml index 95681ab6f6e26bf453c8e003ce4d4f85ed7b3109..b13b4eeab3b85c8ce6d3e907590250439c1624c0 100644 --- a/app/code/Magento/Checkout/view/frontend/success.phtml +++ b/app/code/Magento/Checkout/view/frontend/success.phtml @@ -23,36 +23,38 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<h2 class="subtitle"><?php echo __('Thank you for your purchase!') ?></h2> -<?php if ($this->getOrderId()):?> - <?php if ($this->getCanViewOrder()) :?> - <p><?php echo __('Your order # is: %1.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p> - <?php else :?> - <p><?php echo __('Your order # is: %1.', $this->escapeHtml($this->getOrderId())) ?></p> +<div class="checkout success"> + <h2 class="subtitle"><?php echo __('Thank you for your purchase!') ?></h2> + <?php if ($this->getOrderId()):?> + <?php if ($this->getCanViewOrder()) :?> + <p><?php echo __('Your order # is: %1.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getViewOrderUrl()), $this->escapeHtml($this->getOrderId()))) ?></p> + <?php else :?> + <p><?php echo __('Your order # is: %1.', $this->escapeHtml($this->getOrderId())) ?></p> + <?php endif;?> + <p><?php echo __('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p> + <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?> + <p> + <?php echo __('Click <a href="%1" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?> + <?php echo $this->getChildHtml() ?> + </p> + <?php endif;?> <?php endif;?> - <p><?php echo __('You will receive an order confirmation email with details of your order and a link to track its progress.') ?></p> - <?php if ($this->getCanViewOrder() && $this->getCanPrintOrder()) :?> - <p> - <?php echo __('Click <a href="%1" onclick="this.target=\'_blank\'">here to print</a> a copy of your order confirmation.', $this->getPrintUrl()) ?> - <?php echo $this->getChildHtml() ?> - </p> - <?php endif;?> -<?php endif;?> -<?php if ($this->getAgreementRefId()): ?> - <p><?php echo __('Your billing agreement # is: %1.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p> -<?php endif;?> + <?php if ($this->getAgreementRefId()): ?> + <p><?php echo __('Your billing agreement # is: %1.', sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getAgreementUrl()), $this->escapeHtml($this->getAgreementRefId())))?></p> + <?php endif;?> -<?php if ($profiles = $this->getRecurringProfiles()):?> -<p><?php echo __('Your recurring payment profiles:'); ?></p> -<ul> -<?php foreach($profiles as $profile):?> -<?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?> - <li><?php echo __('Payment profile # %1: "%2".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li> -<?php endforeach;?> -</ul> -<?php endif;?> + <?php if ($profiles = $this->getRecurringProfiles()):?> + <p><?php echo __('Your recurring payment profiles:'); ?></p> + <ul> + <?php foreach($profiles as $profile):?> + <?php $profileIdHtml = ($this->getCanViewProfiles() ? sprintf('<a href="%s">%s</a>', $this->escapeHtml($this->getProfileUrl($profile)), $this->escapeHtml($this->getObjectData($profile, 'reference_id'))) : $this->escapeHtml($this->getObjectData($profile, 'reference_id')));?> + <li><?php echo __('Payment profile # %1: "%2".', $profileIdHtml, $this->escapeHtml($this->getObjectData($profile, 'schedule_description')))?></li> + <?php endforeach;?> + </ul> + <?php endif;?> -<div class="actions"> - <a class="action continue" title="<?php echo __('Continue Shopping') ?>" href="<?php echo $this->getUrl() ?>"><span><?php echo __('Continue Shopping') ?></span></a> -</div> + <div class="actions"> + <a class="action continue" title="<?php echo __('Continue Shopping') ?>" href="<?php echo $this->getUrl() ?>"><span><?php echo __('Continue Shopping') ?></span></a> + </div> +</div> \ No newline at end of file diff --git a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php index d946aa452c8f5a7880725f7c3c4473e630d0d216..4a992a8e30c594a9dab36d6d51f9f83c89211a2b 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Block/Edit/Form.php @@ -94,7 +94,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php index c12d78114687a67c7254330579ccce3666761abb..191d22ffcfaaa6dc5c3145b3cd0aba7d25084669 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Form.php @@ -41,7 +41,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php index fd7e6462f1f9790c9a01c9c015fe03233e311044..7af55766780c010f3875403618ddaf4019f0a148 100644 --- a/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php +++ b/app/code/Magento/Cms/Block/Adminhtml/Page/Edit/Tab/Design.php @@ -33,7 +33,7 @@ class Design implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_labelFactory; @@ -47,7 +47,7 @@ class Design * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Theme\Model\Layout\Source\Layout $pageLayout - * @param \Magento\Core\Model\Theme\LabelFactory $labelFactory + * @param \Magento\View\Design\Theme\LabelFactory $labelFactory * @param array $data */ public function __construct( @@ -55,7 +55,7 @@ class Design \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Theme\Model\Layout\Source\Layout $pageLayout, - \Magento\Core\Model\Theme\LabelFactory $labelFactory, + \Magento\View\Design\Theme\LabelFactory $labelFactory, array $data = array() ) { $this->_labelFactory = $labelFactory; @@ -86,7 +86,7 @@ class Design /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'html_id_prefix' => 'page_', )) ); diff --git a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php index 3dc6b5bdbdb9a6a9ae9ed57c085d158a7bd70941..f302d7aeef88c60a631d9ad91d311fc7e54f888d 100644 --- a/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php +++ b/app/code/Magento/Connect/Block/Adminhtml/Extension/Custom/Edit/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml b/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml index 6f4471a3afab8c45e29143d7d8a05f6530442f49..d910d951a384637a2f497e082414ce5a021a69a6 100644 --- a/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml +++ b/app/code/Magento/Contacts/view/frontend/layout/contacts_index_index.xml @@ -24,19 +24,12 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <update handle="page_one_column"/> <referenceBlock name="head"> <action method="setTitle"> <argument translate="true" name="title" xsi:type="string">Contact Us</argument> </action> </referenceBlock> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">2columns-right.phtml</argument> - </action> - <action method="setHeaderTitle"> - <argument translate="true" name="title" xsi:type="string">Contact Us</argument> - </action> - </referenceBlock> <referenceContainer name="content"> <block class="Magento\View\Element\Template" name="contactForm" template="Magento_Contacts::form.phtml"> <container name="form.additional.info" label="Form Additional Info"/> diff --git a/app/code/Magento/Core/App/Action/Plugin/Design.php b/app/code/Magento/Core/App/Action/Plugin/Design.php index 714c9c4c05f9e15d0ca388a7946667bbcde6ca22..8de081265549071bb909e2e1cac992d242ba4819 100644 --- a/app/code/Magento/Core/App/Action/Plugin/Design.php +++ b/app/code/Magento/Core/App/Action/Plugin/Design.php @@ -27,14 +27,14 @@ namespace Magento\Core\App\Action\Plugin; class Design { /** - * @var \Magento\Core\Model\DesignLoader + * @var \Magento\View\DesignLoader */ protected $_designLoader; /** - * @param \Magento\Core\Model\DesignLoader $designLoader + * @param \Magento\View\DesignLoader $designLoader */ - public function __construct(\Magento\Core\Model\DesignLoader $designLoader) + public function __construct(\Magento\View\DesignLoader $designLoader) { $this->_designLoader = $designLoader; } diff --git a/app/code/Magento/Core/Helper/Url.php b/app/code/Magento/Core/Helper/Url.php index b0f07d5f1b8f7df3123ba269d380d5a33c62fdba..3a67e2039386d44cb01fa53401a310af8132da5f 100644 --- a/app/code/Magento/Core/Helper/Url.php +++ b/app/code/Magento/Core/Helper/Url.php @@ -130,9 +130,10 @@ class Url extends \Magento\App\Helper\AbstractHelper public function removeRequestParam($url, $paramKey, $caseSensitive = false) { $regExpression = '/\\?[^#]*?(' . preg_quote($paramKey, '/') . '\\=[^#&]*&?)/' . ($caseSensitive ? '' : 'i'); - while (preg_match($regExpression, $url, $matches) != 0) { + while (preg_match($regExpression, $url, $matches) !== 0) { $paramString = $matches[1]; - if (preg_match('/&$/', $paramString) == 0) { + // if ampersand is at the end of $paramString + if (substr($paramString, -1, 1) != '&') { $url = preg_replace('/(&|\\?)?' . preg_quote($paramString, '/') . '/', '', $url); } else { $url = str_replace($paramString, '', $url); diff --git a/app/code/Magento/Core/Model/App.php b/app/code/Magento/Core/Model/App.php index bb96568d463106036b30dfaea5d2d8ed82cf9a14..edf27a95d8efb2c30959abe4963a027586bb1cd2 100644 --- a/app/code/Magento/Core/Model/App.php +++ b/app/code/Magento/Core/Model/App.php @@ -53,7 +53,7 @@ class App implements \Magento\Core\Model\AppInterface /** * Magento version */ - const VERSION = '2.0.0.0-dev55'; + const VERSION = '2.0.0.0-dev56'; /** @@ -801,7 +801,7 @@ class App implements \Magento\Core\Model\AppInterface 'revision' => '0', 'patch' => '0', 'stability' => 'dev', - 'number' => '55', + 'number' => '56', ); } } diff --git a/app/code/Magento/Core/Model/DataService/Config/Reader.php b/app/code/Magento/Core/Model/DataService/Config/Reader.php index 71f1a287a60119d236c0d5303c5090f1b8503de4..f714a3308d33926a0393445a09aac333c4c7a4d7 100644 --- a/app/code/Magento/Core/Model/DataService/Config/Reader.php +++ b/app/code/Magento/Core/Model/DataService/Config/Reader.php @@ -33,13 +33,11 @@ class Reader extends \Magento\Config\AbstractXml private $_modulesReader; /** - * @param \Magento\Module\Dir\Reader $moduleReader * @param array $configFiles + * @param \Magento\Module\Dir\Reader $moduleReader */ - public function __construct( - \Magento\Module\Dir\Reader $moduleReader, - array $configFiles - ) { + public function __construct(array $configFiles, \Magento\Module\Dir\Reader $moduleReader) + { if (count($configFiles)) { parent::__construct($configFiles); } diff --git a/app/code/Magento/Core/Model/File/Uploader.php b/app/code/Magento/Core/Model/File/Uploader.php index 7b70048ba12b7aabf84249809c5f57047116c0d9..22199b3253800db047ce4b23b12b175cc4e59c2c 100644 --- a/app/code/Magento/Core/Model/File/Uploader.php +++ b/app/code/Magento/Core/Model/File/Uploader.php @@ -63,18 +63,16 @@ class Uploader extends \Magento\File\Uploader protected $_validator; /** - * Init upload - * + * @param string $fileId * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb * @param \Magento\Core\Helper\File\Storage $coreFileStorage * @param \Magento\Core\Model\File\Validator\NotProtectedExtension $validator - * @param $fileId */ public function __construct( + $fileId, \Magento\Core\Helper\File\Storage\Database $coreFileStorageDb, \Magento\Core\Helper\File\Storage $coreFileStorage, - \Magento\Core\Model\File\Validator\NotProtectedExtension $validator, - $fileId + \Magento\Core\Model\File\Validator\NotProtectedExtension $validator ) { $this->_coreFileStorageDb = $coreFileStorageDb; $this->_coreFileStorage = $coreFileStorage; diff --git a/app/code/Magento/Core/Model/Layout.php b/app/code/Magento/Core/Model/Layout.php index 5f06c0c3db669211a14b1d446ea49dcae2ecfef0..dabdb6ffe58d5d177d424cc4f3350d3cbf04639c 100644 --- a/app/code/Magento/Core/Model/Layout.php +++ b/app/code/Magento/Core/Model/Layout.php @@ -917,7 +917,7 @@ class Layout extends \Magento\Simplexml\Config implements \Magento\View\LayoutIn * @param array $options * @throws \Magento\Exception if any of arguments are invalid */ - protected function _generateContainer($name, $label = '', array $options) + protected function _generateContainer($name, $label, array $options) { $this->_structure->setAttribute($name, Element::CONTAINER_OPT_LABEL, $label); unset($options[Element::CONTAINER_OPT_LABEL]); diff --git a/app/code/Magento/Core/Model/Layout/Argument/AbstractHandler.php b/app/code/Magento/Core/Model/Layout/Argument/AbstractHandler.php index 2c72abf591a77538deba77c89fba8651a48ab0b8..b5551fc61ab193d5a2b929517cccf9f485958132 100644 --- a/app/code/Magento/Core/Model/Layout/Argument/AbstractHandler.php +++ b/app/code/Magento/Core/Model/Layout/Argument/AbstractHandler.php @@ -33,8 +33,7 @@ */ namespace Magento\Core\Model\Layout\Argument; -abstract class AbstractHandler - implements \Magento\Core\Model\Layout\Argument\HandlerInterface +abstract class AbstractHandler implements \Magento\View\Layout\Argument\HandlerInterface { /** * @var \Magento\ObjectManager diff --git a/app/code/Magento/Core/Model/Layout/Argument/Handler/ArrayHandler.php b/app/code/Magento/Core/Model/Layout/Argument/Handler/ArrayHandler.php index 3927a804aed872cdb9ad22f2b7b391a72f135a8a..bc08284bf0505c589ce9aea035e98116fd421427 100644 --- a/app/code/Magento/Core/Model/Layout/Argument/Handler/ArrayHandler.php +++ b/app/code/Magento/Core/Model/Layout/Argument/Handler/ArrayHandler.php @@ -36,15 +36,15 @@ namespace Magento\Core\Model\Layout\Argument\Handler; class ArrayHandler extends \Magento\Core\Model\Layout\Argument\AbstractHandler { /** - * @var \Magento\Core\Model\Layout\Argument\HandlerFactory + * @var \Magento\View\Layout\Argument\HandlerFactory */ protected $_handlerFactory; /** - * @param \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory + * @param \Magento\View\Layout\Argument\HandlerFactory $handlerFactory */ public function __construct( - \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory + \Magento\View\Layout\Argument\HandlerFactory $handlerFactory ) { $this->_handlerFactory = $handlerFactory; } diff --git a/app/code/Magento/Core/Model/Layout/Argument/HandlerFactoryInterface.php b/app/code/Magento/Core/Model/Layout/Argument/HandlerFactoryInterface.php deleted file mode 100644 index 4a8ec64688470685483ca5433fe8895a52c8f2e8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Core/Model/Layout/Argument/HandlerFactoryInterface.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 - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Argument handler factory interface - * - * @category Magento - * @package Magento_Core - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Core\Model\Layout\Argument; - -interface HandlerFactoryInterface -{ - /** - * Create concrete handler object - * @return \Magento\Core\Model\Layout\Argument\HandlerInterface - */ - public function createHandler(); -} diff --git a/app/code/Magento/Core/Model/Layout/Argument/Processor.php b/app/code/Magento/Core/Model/Layout/Argument/Processor.php index b4389dd83d6474ba44824f1d6ca84426e7cab684..b44a9e0ecc67350df7c8dad8fe68c23fff6f379f 100644 --- a/app/code/Magento/Core/Model/Layout/Argument/Processor.php +++ b/app/code/Magento/Core/Model/Layout/Argument/Processor.php @@ -36,7 +36,7 @@ namespace Magento\Core\Model\Layout\Argument; class Processor { /** - * @var \Magento\Core\Model\Layout\Argument\HandlerFactory + * @var \Magento\View\Layout\Argument\HandlerFactory */ protected $_handlerFactory; @@ -54,11 +54,11 @@ class Processor /** * @param \Magento\Core\Model\Layout\Argument\Updater $argumentUpdater - * @param \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory + * @param \Magento\View\Layout\Argument\HandlerFactory $handlerFactory */ public function __construct( \Magento\Core\Model\Layout\Argument\Updater $argumentUpdater, - \Magento\Core\Model\Layout\Argument\HandlerFactory $handlerFactory + \Magento\View\Layout\Argument\HandlerFactory $handlerFactory ) { $this->_handlerFactory = $handlerFactory; $this->_argumentUpdater = $argumentUpdater; diff --git a/app/code/Magento/Core/Model/Layout/Merge.php b/app/code/Magento/Core/Model/Layout/Merge.php index 3975d5a91f93d0f01029fcd57d87c16a897ac581..f7c1d46684aaaa2fc9453629463348da5b5b9ecc 100644 --- a/app/code/Magento/Core/Model/Layout/Merge.php +++ b/app/code/Magento/Core/Model/Layout/Merge.php @@ -712,4 +712,26 @@ class Merge implements \Magento\View\Layout\ProcessorInterface $this->_updates = array(); $this->_layoutUpdatesCache = null; } + + /** + * @inheritdoc + */ + public function isCustomerDesignAbstraction(array $abstraction) + { + if (!isset($abstraction['design_abstraction'])) { + return false; + } + return $abstraction['design_abstraction'] === self::DESIGN_ABSTRACTION_CUSTOM; + } + + /** + * @inheritdoc + */ + public function isPageLayoutDesignAbstraction(array $abstraction) + { + if (!isset($abstraction['design_abstraction'])) { + return false; + } + return $abstraction['design_abstraction'] === self::DESIGN_ABSTRACTION_PAGE_LAYOUT; + } } diff --git a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/Reader.php b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/Reader.php index 998be57d93047355f40f3a1e13cb44860d3afd14..d2ebe44ec1e64595d6b52c6d2e132dfe19a7ccfb 100644 --- a/app/code/Magento/Core/Model/Locale/Hierarchy/Config/Reader.php +++ b/app/code/Magento/Core/Model/Locale/Hierarchy/Config/Reader.php @@ -35,25 +35,34 @@ class Reader extends \Magento\Config\Reader\Filesystem ); /** - * @param \Magento\Core\Model\Locale\Hierarchy\Config\FileResolver $fileResolver - * @param \Magento\Core\Model\Locale\Hierarchy\Config\Converter $converter - * @param \Magento\Core\Model\Locale\Hierarchy\Config\SchemaLocator $schemeLocator + * @param FileResolver $fileResolver + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Core\Model\Locale\Hierarchy\Config\FileResolver $fileResolver, \Magento\Core\Model\Locale\Hierarchy\Config\Converter $converter, - \Magento\Core\Model\Locale\Hierarchy\Config\SchemaLocator $schemeLocator, + \Magento\Core\Model\Locale\Hierarchy\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, $fileName = 'config.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemeLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Core/Model/Resource/Theme/Collection.php b/app/code/Magento/Core/Model/Resource/Theme/Collection.php index 4f2a3ace42c8d03b260255679d63f9cb0d55f6b4..05efca13a61d9f0be831fe0e644f98445d0c272f 100644 --- a/app/code/Magento/Core/Model/Resource/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Resource/Theme/Collection.php @@ -29,7 +29,9 @@ */ namespace Magento\Core\Model\Resource\Theme; -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection +class Collection + extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection + implements \Magento\View\Design\Theme\Label\ListInterface, \Magento\View\Design\Theme\ListInterface { /** * Default page size @@ -216,4 +218,16 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl $this->addAreaFilter($area)->addTypeFilter($type); return $this; } + + /** + * @inheritdoc + */ + public function getLabels() + { + $this->_reset()->clear(); + $labels = $this->setOrder('theme_title', \Magento\Data\Collection::SORT_ORDER_ASC) + ->filterVisibleThemes() + ->addAreaFilter(\Magento\Core\Model\App\Area::AREA_FRONTEND); + return $labels->toOptionArray(); + } } diff --git a/app/code/Magento/Core/Model/Session.php b/app/code/Magento/Core/Model/Session.php index 5ad6862ad6767545946da575b9897b3fb4d37796..dc9c435b5a94acd471e9d53cc18a1f44ee09acda 100644 --- a/app/code/Magento/Core/Model/Session.php +++ b/app/code/Magento/Core/Model/Session.php @@ -41,15 +41,15 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param Session\Context $context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param array $data * @param null $sessionName + * @param array $data */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array(), - $sessionName = null + \Magento\Session\Config\ConfigInterface $sessionConfig, + $sessionName = null, + array $data = array() ) { parent::__construct($context, $sidResolver, $sessionConfig, $data); $this->start('core', $sessionName); diff --git a/app/code/Magento/Core/Model/Session/Generic.php b/app/code/Magento/Core/Model/Session/Generic.php index f0404480f59f03e808b33ad9cd809652aba2c8d1..60d367e361fd54ce285f01a5eb3adc45655ea393 100644 --- a/app/code/Magento/Core/Model/Session/Generic.php +++ b/app/code/Magento/Core/Model/Session/Generic.php @@ -30,16 +30,16 @@ class Generic extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig * @param string $sessionNamespace + * @param mixed $sessionName * @param array $data - * @param null $sessionName */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Session\SidResolverInterface $sidResolver, \Magento\Session\Config\ConfigInterface $sessionConfig, $sessionNamespace, - array $data = array(), - $sessionName = null + $sessionName = null, + array $data = array() ) { parent::__construct($context, $sidResolver, $sessionConfig, $data); $this->start($sessionNamespace, $sessionName); diff --git a/app/code/Magento/Core/Model/Theme/Collection.php b/app/code/Magento/Core/Model/Theme/Collection.php index d0b3f1b46b97d1142420a95b8bd0141b2964ce56..6f5896b0470b7e378bac517cbf2aa884164e4cf6 100644 --- a/app/code/Magento/Core/Model/Theme/Collection.php +++ b/app/code/Magento/Core/Model/Theme/Collection.php @@ -29,7 +29,7 @@ */ namespace Magento\Core\Model\Theme; -class Collection extends \Magento\Data\Collection +class Collection extends \Magento\Data\Collection implements \Magento\View\Design\Theme\ListInterface { /** * @var \Magento\Filesystem @@ -350,4 +350,19 @@ class Collection extends \Magento\Data\Collection $themeItems = $this->getItems(); return $theme->getThemePath() && isset($themeItems[$theme->getFullPath()]); } + + /** + * Get theme from file system by area and theme_path + * + * @param string $fullPath + * @return \Magento\View\Design\ThemeInterface + */ + public function getThemeByFullPath($fullPath) + { + list($area, $themePath) = explode('/', $fullPath, 2); + $this->addDefaultPattern($area) + ->addFilter('theme_path', $themePath); + + return $this->getFirstItem(); + } } diff --git a/app/code/Magento/Core/Model/Theme/Domain/Physical.php b/app/code/Magento/Core/Model/Theme/Domain/Physical.php index 2a680d166eeb8edc964fa8b4aff4d3cf5d8ba317..8255611b443776b8e4f9a8ce8917f3fc7bbc7934 100644 --- a/app/code/Magento/Core/Model/Theme/Domain/Physical.php +++ b/app/code/Magento/Core/Model/Theme/Domain/Physical.php @@ -44,7 +44,7 @@ class Physical implements \Magento\View\Design\Theme\Domain\PhysicalInterface protected $_themeFactory; /** - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_themeCopyService; @@ -56,13 +56,13 @@ class Physical implements \Magento\View\Design\Theme\Domain\PhysicalInterface /** * @param \Magento\View\Design\ThemeInterface $theme * @param \Magento\Core\Model\ThemeFactory $themeFactory - * @param \Magento\Core\Model\Theme\CopyService $themeCopyService + * @param \Magento\Theme\Model\CopyService $themeCopyService * @param \Magento\Core\Model\Resource\Theme\Collection $themeCollection */ public function __construct( \Magento\View\Design\ThemeInterface $theme, \Magento\Core\Model\ThemeFactory $themeFactory, - \Magento\Core\Model\Theme\CopyService $themeCopyService, + \Magento\Theme\Model\CopyService $themeCopyService, \Magento\Core\Model\Resource\Theme\Collection $themeCollection ) { $this->_theme = $theme; diff --git a/app/code/Magento/Core/Model/Theme/Domain/Staging.php b/app/code/Magento/Core/Model/Theme/Domain/Staging.php index 2d2a17582c72776b684a34c791816a5fbe443f01..09be9f75cc6b3229146a478b994ba875b3b5fc31 100644 --- a/app/code/Magento/Core/Model/Theme/Domain/Staging.php +++ b/app/code/Magento/Core/Model/Theme/Domain/Staging.php @@ -39,17 +39,17 @@ class Staging implements \Magento\View\Design\Theme\Domain\StagingInterface protected $_theme; /** - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_themeCopyService; /** * @param \Magento\View\Design\ThemeInterface $theme - * @param \Magento\Core\Model\Theme\CopyService $themeCopyService + * @param \Magento\Theme\Model\CopyService $themeCopyService */ public function __construct( \Magento\View\Design\ThemeInterface $theme, - \Magento\Core\Model\Theme\CopyService $themeCopyService + \Magento\Theme\Model\CopyService $themeCopyService ) { $this->_theme = $theme; $this->_themeCopyService = $themeCopyService; diff --git a/app/code/Magento/Core/Model/Theme/Domain/Virtual.php b/app/code/Magento/Core/Model/Theme/Domain/Virtual.php index f538989e18ceab675934e547cc686dd234aead77..0cd748f576eec302a079e549930e250d9953a727 100644 --- a/app/code/Magento/Core/Model/Theme/Domain/Virtual.php +++ b/app/code/Magento/Core/Model/Theme/Domain/Virtual.php @@ -51,7 +51,7 @@ class Virtual implements \Magento\View\Design\Theme\Domain\VirtualInterface protected $_stagingTheme; /** - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_themeCopyService; @@ -65,13 +65,13 @@ class Virtual implements \Magento\View\Design\Theme\Domain\VirtualInterface /** * @param \Magento\View\Design\ThemeInterface $theme * @param \Magento\Core\Model\ThemeFactory $themeFactory - * @param \Magento\Core\Model\Theme\CopyService $themeCopyService + * @param \Magento\Theme\Model\CopyService $themeCopyService * @param \Magento\Theme\Model\Config\Customization $customizationConfig */ public function __construct( \Magento\View\Design\ThemeInterface $theme, \Magento\Core\Model\ThemeFactory $themeFactory, - \Magento\Core\Model\Theme\CopyService $themeCopyService, + \Magento\Theme\Model\CopyService $themeCopyService, \Magento\Theme\Model\Config\Customization $customizationConfig ) { $this->_theme = $theme; diff --git a/app/code/Magento/Core/Model/Theme/Source/Theme.php b/app/code/Magento/Core/Model/Theme/Source/Theme.php index 5a65bd8d86bec6a224ad2e3994a1abab0c492872..9fb385ada9e359d2f23027d1db9efb765a24d3e9 100644 --- a/app/code/Magento/Core/Model/Theme/Source/Theme.php +++ b/app/code/Magento/Core/Model/Theme/Source/Theme.php @@ -29,7 +29,7 @@ */ namespace Magento\Core\Model\Theme\Source; -use Magento\Core\Model\Theme\Label; +use Magento\View\Design\Theme\Label; use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; /** @@ -40,12 +40,12 @@ use Magento\Eav\Model\Entity\Attribute\Source\AbstractSource; class Theme extends AbstractSource { /** - * @var Label + * @var \Magento\View\Design\Theme\Label */ protected $themeLabel; /** - * @param Label $themeLabel + * @param \Magento\View\Design\Theme\Label $themeLabel */ public function __construct(Label $themeLabel) { diff --git a/app/code/Magento/Core/Model/View/Design.php b/app/code/Magento/Core/Model/View/Design.php index b35fc64bacf14c5dd7feabe841c848e68aa7b4a7..9079857446aaceb0efda7e45cf9967e63f94cd35 100644 --- a/app/code/Magento/Core/Model/View/Design.php +++ b/app/code/Magento/Core/Model/View/Design.php @@ -31,25 +31,6 @@ namespace Magento\Core\Model\View; class Design implements \Magento\View\DesignInterface { - /** - * Common node path to theme design configuration - */ - const XML_PATH_THEME_ID = 'design/theme/theme_id'; - - /** - * Regular expressions matches cache - * - * @var array - */ - private static $_regexMatchCache = array(); - - /** - * Custom theme type cache - * - * @var array - */ - private static $_customThemeTypeCache = array(); - /** * Package area * @@ -253,33 +234,6 @@ class Design implements \Magento\View\DesignInterface return $this->_theme; } - /** - * Return package name based on design exception rules - * - * @param array $rules - design exception rules - * @param string $regexpsConfigPath - * @return bool|string - */ - public static function getPackageByUserAgent(array $rules, $regexpsConfigPath = 'path_mock') - { - foreach ($rules as $rule) { - if (!empty(self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']])) { - self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value']; - return $rule['value']; - } - - $regexp = '/' . trim($rule['regexp'], '/') . '/'; - - if (@preg_match($regexp, $_SERVER['HTTP_USER_AGENT'])) { - self::$_regexMatchCache[$rule['regexp']][$_SERVER['HTTP_USER_AGENT']] = true; - self::$_customThemeTypeCache[$regexpsConfigPath] = $rule['value']; - return $rule['value']; - } - } - - return false; - } - /** * {@inheritdoc} */ diff --git a/app/code/Magento/Core/etc/di.xml b/app/code/Magento/Core/etc/di.xml index e7c79712c206b28de68159459a04cabaac5f58e4..992533f8b1c108937a48d4fed068d5f8974956df 100644 --- a/app/code/Magento/Core/etc/di.xml +++ b/app/code/Magento/Core/etc/di.xml @@ -415,31 +415,31 @@ <instance type="Magento\Image\Adapter\Gd2"/> </param> </type> - <type name="Magento\Core\Model\Layout\PageType\Config\Reader"> + <type name="Magento\View\Layout\PageType\Config\Reader"> <param name="fileName"> <value>page_types.xml</value> </param> <param name="converter"> - <instance type="Magento\Core\Model\Layout\PageType\Config\Converter" /> + <instance type="Magento\View\Layout\PageType\Config\Converter" /> </param> <param name="schemaLocator"> - <instance type="Magento\Core\Model\Layout\PageType\Config\SchemaLocator" /> + <instance type="Magento\View\Layout\PageType\Config\SchemaLocator" /> </param> <param name="defaultScope"> <value>frontend</value> </param> </type> - <virtualType name="Magento\Core\Model\Layout\PageType\Config\Data" type="Magento\Config\Data"> + <virtualType name="Magento\View\Layout\PageType\Config\Data" type="Magento\Config\Data"> <param name='reader'> - <instance type="Magento\Core\Model\Layout\PageType\Config\Reader" /> + <instance type="Magento\View\Layout\PageType\Config\Reader" /> </param> <param name="cacheId"> <value>page_types_config</value> </param> </virtualType> - <type name="Magento\Core\Model\Layout\PageType\Config"> + <type name="Magento\View\Layout\PageType\Config"> <param name="dataStorage"> - <instance type="Magento\Core\Model\Layout\PageType\Config\Data" /> + <instance type="Magento\View\Layout\PageType\Config\Data" /> </param> </type> <type name="Magento\Core\Model\Store\Storage\Db"> diff --git a/app/design/frontend/magento_plushe/Magento_Core/template.phtml b/app/code/Magento/Core/view/frontend/template.phtml similarity index 100% rename from app/design/frontend/magento_plushe/Magento_Core/template.phtml rename to app/code/Magento/Core/view/frontend/template.phtml diff --git a/app/code/Magento/Cron/Model/Config/Reader/Xml.php b/app/code/Magento/Cron/Model/Config/Reader/Xml.php index 31e062270e81112ff724f7c1f7ff6a9f2f53acc1..5901d9fc5d4123eb0ed8df11d836cf39b278d985 100644 --- a/app/code/Magento/Cron/Model/Config/Reader/Xml.php +++ b/app/code/Magento/Cron/Model/Config/Reader/Xml.php @@ -41,15 +41,14 @@ class Xml extends \Magento\Config\Reader\Filesystem ); /** - * Initialize parameters - * - * @param \Magento\Config\FileResolverInterface $fileResolver + * @param \Magento\Config\FileResolverInterface $fileResolver * @param \Magento\Cron\Model\Config\Converter\Xml $converter * @param \Magento\Cron\Model\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState - * @param string $fileName - * @param array $idAttributes - * @param string $domDocumentClass + * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -58,10 +57,18 @@ class Xml extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'crontab.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php index 0b41cfa26b474e8328979983770fdbcd7441d011..1b0b096ddd169c8e06317993353c63f337694d25 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Form.php @@ -35,7 +35,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('customer/*/save'), 'method' => 'post', diff --git a/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php index 4ffb6c7c98945ee696af15dde5254ac403588a43..1aee33aa2fc90549e68c1d3c39b663298327c35d 100644 --- a/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php +++ b/app/code/Magento/Customer/Block/Adminhtml/Form/Element/File.php @@ -49,24 +49,24 @@ class File extends \Magento\Data\Form\Element\AbstractElement protected $_adminhtmlData = null; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\Backend\Helper\Data $adminhtmlData * @param \Magento\View\Url $viewUrl - * @param array $attributes + * @param array $data */ - public function __construct( - \Magento\Escaper $escaper, + public function __construct( \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\Backend\Helper\Data $adminhtmlData, \Magento\View\Url $viewUrl, - $attributes = array() + $data = array() ) { $this->_adminhtmlData = $adminhtmlData; $this->_viewUrl = $viewUrl; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('file'); } diff --git a/app/code/Magento/Customer/Model/Session.php b/app/code/Magento/Customer/Model/Session.php index d10c2400f54c8b0a29906a8001fc3be7a28c3910..467ef6584f8c275d3cb9e711b1c9a2c47bce3973 100644 --- a/app/code/Magento/Customer/Model/Session.php +++ b/app/code/Magento/Customer/Model/Session.php @@ -88,15 +88,15 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param \Magento\Customer\Model\Config\Share $configShare + * @param Config\Share $configShare * @param \Magento\Core\Helper\Url $coreUrl * @param \Magento\Customer\Helper\Data $customerData - * @param \Magento\Customer\Model\Resource\Customer $customerResource - * @param \Magento\Customer\Model\CustomerFactory $customerFactory + * @param Resource\Customer $customerResource + * @param CustomerFactory $customerFactory * @param \Magento\Core\Model\UrlFactory $urlFactory * @param \Magento\Core\Model\Session $session - * @param array $data * @param null $sessionName + * @param array $data */ public function __construct( \Magento\Core\Model\Session\Context $context, @@ -109,8 +109,8 @@ class Session extends \Magento\Core\Model\Session\AbstractSession \Magento\Customer\Model\CustomerFactory $customerFactory, \Magento\Core\Model\UrlFactory $urlFactory, \Magento\Core\Model\Session $session, - array $data = array(), - $sessionName = null + $sessionName = null, + array $data = array() ) { $this->_coreUrl = $coreUrl; $this->_customerData = $customerData; diff --git a/app/design/frontend/magento_plushe/Magento_Customer/account/customer.phtml b/app/code/Magento/Customer/view/frontend/account/customer.phtml similarity index 95% rename from app/design/frontend/magento_plushe/Magento_Customer/account/customer.phtml rename to app/code/Magento/Customer/view/frontend/account/customer.phtml index f158025e4468a3d7613937955e63a8235de26cf4..3c867adcf236bd3a31870f1535a5d4681192fb9b 100644 --- a/app/design/frontend/magento_plushe/Magento_Customer/account/customer.phtml +++ b/app/code/Magento/Customer/view/frontend/account/customer.phtml @@ -29,9 +29,9 @@ <span><?php echo $this->getCustomerName(); ?></span> </strong> <?php if($this->getChildHtml()):?> - <menu class="menu" data-target="dropdown"> + <div class="menu" data-target="dropdown"> <?php echo $this->getChildHtml();?> - </menu> + </div> <?php endif; ?> </li> <?php endif; ?> diff --git a/app/code/Magento/Customer/view/frontend/form/confirmation.phtml b/app/code/Magento/Customer/view/frontend/form/confirmation.phtml index 1956b26aa8c7bdbb64565cc1ebca33f623f5ed5a..846c7e3355d606dbae34e9817bca5382ead42bf4 100644 --- a/app/code/Magento/Customer/view/frontend/form/confirmation.phtml +++ b/app/code/Magento/Customer/view/frontend/form/confirmation.phtml @@ -29,7 +29,7 @@ <div class="field email required"> <label for="email_address" class="label"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="email" id="email_address" class="input-text" value="<?php echo $this->escapeHtml($this->getEmail()) ?>" data-validate="{required:true, 'validate-email':true}"> + <input type="email" name="email" id="email_address" class="input-text" value="<?php echo $this->escapeHtml($this->getEmail()) ?>" data-validate="{required:true, 'validate-email':true}"> </div> </div> </fieldset> diff --git a/app/code/Magento/Customer/view/frontend/form/edit.phtml b/app/code/Magento/Customer/view/frontend/form/edit.phtml index 2aa77595ea1a62f5e667a44538783088c595e3a1..5a2abcf2e3272caca6e839869182c5437d410f59 100644 --- a/app/code/Magento/Customer/view/frontend/form/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/form/edit.phtml @@ -31,7 +31,7 @@ <div class="field email required"> <label class="label" for="email"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"> + <input type="email" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"> </div> </div> <?php $_dob = $this->getLayout()->createBlock('Magento\Customer\Block\Widget\Dob') ?> diff --git a/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml b/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml index 48cd1f7dee4491c8bbac58c39ae150c1d01ec404..1e1a42e50a9e938750bf090786afab4e6e969553 100644 --- a/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml +++ b/app/code/Magento/Customer/view/frontend/form/forgotpassword.phtml @@ -29,7 +29,7 @@ <div class="field email required"> <label for="email_address" class="label"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="email" alt="email" id="email_address" class="input-text" value="<?php echo $this->escapeHtml($this->getEmailValue()) ?>" data-validate="{required:true, 'validate-email':true}"> + <input type="email" name="email" alt="email" id="email_address" class="input-text" value="<?php echo $this->escapeHtml($this->getEmailValue()) ?>" data-validate="{required:true, 'validate-email':true}"> </div> </div> <?php echo $this->getChildHtml('form_additional_info'); ?> diff --git a/app/code/Magento/Customer/view/frontend/form/login.phtml b/app/code/Magento/Customer/view/frontend/form/login.phtml index 374fc86688ef327812eef17a6f61ae601ea118bd..407bdd903296ceae7c66799e2c42f8745bb82f1b 100644 --- a/app/code/Magento/Customer/view/frontend/form/login.phtml +++ b/app/code/Magento/Customer/view/frontend/form/login.phtml @@ -39,7 +39,7 @@ <div class="field email required"> <label class="label" for="email"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" type="text" class="input-text" title="<?php echo __('Email Address') ?>" data-validate="{required:true, 'validate-email':true}"> + <input name="login[username]" value="<?php echo $this->escapeHtml($this->getUsername()) ?>" id="email" type="email" class="input-text" title="<?php echo __('Email Address') ?>" data-validate="{required:true, 'validate-email':true}"> </div> </div> <div class="field password required"> diff --git a/app/code/Magento/Customer/view/frontend/form/register.phtml b/app/code/Magento/Customer/view/frontend/form/register.phtml index 23feacec27fa4a7287d50819b7580ab3c39fe69c..ec373e313333018bdfa433ae1eba8b483c1e2bf6 100644 --- a/app/code/Magento/Customer/view/frontend/form/register.phtml +++ b/app/code/Magento/Customer/view/frontend/form/register.phtml @@ -42,7 +42,7 @@ <div class="field required"> <label for="email_address" class="label"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"> + <input type="email" name="email" id="email_address" value="<?php echo $this->escapeHtml($this->getFormData()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text" data-validate="{required:true, 'validate-email':true}"> </div> </div> <?php if ($this->isNewsletterEnabled()): ?> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml index 6a4ef38b38634965654dd80522f7f043ded5d483..cdb1ff1405e392efc918e80cb341ca2d8f683a48 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_account.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_account.xml @@ -24,9 +24,12 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" label="Customer My Account (All Pages)" design_abstraction="custom"> - <referenceContainer name="content"> - <container name="my.account.wrapper" label="My Account Wrapper" htmlTag="div" htmlClass="my-account" after="-"/> - </referenceContainer> + <update handle="page_two_columns_left"/> + <referenceBlock name="root"> + <action method="addBodyClass"> + <argument name="class" xsi:type="string">account</argument> + </action> + </referenceBlock> <referenceContainer name="left"> <block class="Magento\View\Element\Html\Links" name="customer_account_navigation" before="-" template="Magento_Customer::account/navigation.phtml"> <block class="Magento\View\Element\Html\Link\Current" name="customer-account-navigation-account-link"> diff --git a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml index c4faa5b6d62f2bc88d93fe0fcbe8e346c18a9258..2ce6bfeaa3799ec7297cf2649db00c97340613a5 100644 --- a/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml +++ b/app/code/Magento/Customer/view/frontend/layout/customer_address_form.xml @@ -25,6 +25,11 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> + <referenceBlock name="customer-account-navigation-address-link"> + <arguments> + <argument name="is_highlighted" xsi:type="boolean">true</argument> + </arguments> + </referenceBlock> <referenceContainer name="content"> <block class="Magento\Customer\Block\Address\Edit" name="customer_address_edit" template="address/edit.phtml"/> </referenceContainer> diff --git a/app/code/Magento/Customer/view/frontend/layout/default.xml b/app/code/Magento/Customer/view/frontend/layout/default.xml index aefd5ecf386c45779c894af9bc3d4d3f7d0fea78..be8d4da7aa04a4bf1cc90c2fb92d3d15758f8978 100644 --- a/app/code/Magento/Customer/view/frontend/layout/default.xml +++ b/app/code/Magento/Customer/view/frontend/layout/default.xml @@ -30,6 +30,11 @@ <argument name="label" xsi:type="string">My Account</argument> </arguments> </block> + <block class="Magento\Customer\Block\Account\RegisterLink" after="authorization-link-login" name="register-link"> + <arguments> + <argument name="label" xsi:type="string">Register</argument> + </arguments> + </block> <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link" after="onepage-checkout-link"/> </referenceBlock> </layout> 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 69e5010302bc2a25d2187a98eed03bb0524e68ed..a6e3f430b034ab3efa7ad7ca948150bbf3e1298b 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Form/Element/Composite/AbstractComposite.php @@ -70,25 +70,25 @@ abstract class AbstractComposite protected $_elementsFactory; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory * @param \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory $rendererFactory - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Element\Factory $elementsFactory, \Magento\DesignEditor\Model\Editor\Tools\QuickStyles\Form\Renderer\Factory $rendererFactory, - $attributes = array() + $data = array() ) { $this->_elementsFactory = $elementsFactory; $this->_rendererFactory = $rendererFactory; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } /** diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php index c8694d00acfb15a530cd1c151e654c2f61e66338..43b3fbb410093b885a540fcb6d70343d685a11e1 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Custom.php @@ -71,7 +71,7 @@ class Custom extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'action' => '#', 'method' => 'post', )) diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php index 09593dcd3ea9273144d0cd579a7307792264ebc3..e579b83550679a72d2278e6ab59a97cb4c76b6fc 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/ImageSizing.php @@ -92,7 +92,7 @@ class ImageSizing extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'action' => '#', 'method' => 'post', )) diff --git a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php index 041d724c04dee19c845afde61cc71328bf5abfde..44a78d00eed2d0eafb1455c17494bdb59bb934fd 100644 --- a/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php +++ b/app/code/Magento/DesignEditor/Block/Adminhtml/Editor/Tools/Code/Js.php @@ -73,7 +73,7 @@ class Js extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'action' => '#', 'method' => 'post', )) 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 b4ecc0e88584cde6a288dd890d531a376f5ada92..6176e5fb19642e34adeaf20f2f4918cb98b34e9e 100644 --- a/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php +++ b/app/code/Magento/DesignEditor/Controller/Adminhtml/System/Design/Editor.php @@ -272,8 +272,8 @@ class Editor extends \Magento\Backend\App\Action $themeId = (int)$this->getRequest()->getParam('theme_id'); /** @var $themeCopy \Magento\View\Design\ThemeInterface */ $themeCopy = $this->_objectManager->create('Magento\View\Design\ThemeInterface'); - /** @var $copyService \Magento\Core\Model\Theme\CopyService */ - $copyService = $this->_objectManager->get('Magento\Core\Model\Theme\CopyService'); + /** @var $copyService \Magento\Theme\Model\CopyService */ + $copyService = $this->_objectManager->get('Magento\Theme\Model\CopyService'); try { $theme = $this->_loadThemeById($themeId); if (!$theme->isVirtual()) { @@ -314,8 +314,8 @@ class Editor extends \Magento\Backend\App\Action } try { - /** @var $copyService \Magento\Core\Model\Theme\CopyService */ - $copyService = $this->_objectManager->get('Magento\Core\Model\Theme\CopyService'); + /** @var $copyService \Magento\Theme\Model\CopyService */ + $copyService = $this->_objectManager->get('Magento\Theme\Model\CopyService'); $stagingTheme = $virtualTheme->getDomainModel(\Magento\View\Design\ThemeInterface::TYPE_VIRTUAL) ->getStagingTheme(); switch ($revertTo) { diff --git a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php index b537723770320483e2ed1edd5cc8fc5862c10631..59a2736d00b7dfac20b8d071fd54b277b093b97a 100644 --- a/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php +++ b/app/code/Magento/DesignEditor/Controller/Varien/Router/Standard.php @@ -63,10 +63,12 @@ class Standard extends \Magento\Core\App\Router\Base * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Store\Config $storeConfig * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo + * @param string $routerId * @param \Magento\App\RouterListInterface $routerList * @param \Magento\ObjectManager $objectManager * @param \Magento\Core\App\Request\RewriteService $urlRewriteService - * @param $routerId + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\App\ActionFactory $actionFactory, @@ -78,14 +80,22 @@ class Standard extends \Magento\Core\App\Router\Base \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Store\Config $storeConfig, \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, + $routerId, \Magento\App\RouterListInterface $routerList, \Magento\ObjectManager $objectManager, - \Magento\Core\App\Request\RewriteService $urlRewriteService, - $routerId + \Magento\Core\App\Request\RewriteService $urlRewriteService ) { parent::__construct( - $actionFactory, $defaultPath, $responseFactory, $routeConfig, $appState, $url, $storeManager, $storeConfig, - $urlSecurityInfo, $routerId + $actionFactory, + $defaultPath, + $responseFactory, + $routeConfig, + $appState, + $url, + $storeManager, + $storeConfig, + $urlSecurityInfo, + $routerId ); $this->_urlRewriteService = $urlRewriteService; $this->_objectManager = $objectManager; diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php index d622780ec6c7f436f549c6fd291cacade1e846e2..604a3f8153bfbe4eb79b8efa42c0b309101ec004 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Builder.php @@ -103,7 +103,7 @@ class Builder if ($isFilePresent) { /** @var $form \Magento\Data\Form */ $form = $this->_formFactory->create(array( - 'attributes' => $data, + 'data' => $data, )); $this->_addElementTypes($form); @@ -112,7 +112,7 @@ class Builder $this->_populateColumns($columns, $data['tab']); } else { $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'action' => '#', )) ); diff --git a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Element/Factory.php b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Element/Factory.php index 9ed53b372899d035d0fa0de943d7cc0d9a6b8ede..1b2f9bcfd447aa6461dacea9e571bd1d66b3e51b 100644 --- a/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Element/Factory.php +++ b/app/code/Magento/DesignEditor/Model/Editor/Tools/QuickStyles/Form/Element/Factory.php @@ -48,6 +48,6 @@ class Factory */ public function create($className, array $data = array()) { - return $this->_objectManager->create($className, array('attributes' => $data)); + return $this->_objectManager->create($className, array('data' => $data)); } } diff --git a/app/code/Magento/DesignEditor/Model/State.php b/app/code/Magento/DesignEditor/Model/State.php index 51081a97d5212ce5a9eacce2ec7731dfa4af4231..72f235298599120a010d4367e3e99316e5a63338 100644 --- a/app/code/Magento/DesignEditor/Model/State.php +++ b/app/code/Magento/DesignEditor/Model/State.php @@ -191,11 +191,11 @@ class State if ($this->_themeContext->getEditableTheme()) { $themeId = $this->_themeContext->getVisibleTheme()->getId(); $this->_application->getStore()->setConfig( - \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, + \Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId ); $this->_application->getConfig()->setValue( - \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, + \Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId ); } diff --git a/app/code/Magento/DesignEditor/Model/Theme/Context.php b/app/code/Magento/DesignEditor/Model/Theme/Context.php index c98c55ecb9e72843863a9a014f5694d224561e2d..3bc3d6e70ccd35aff9bbd7446569d82d6c826b5a 100644 --- a/app/code/Magento/DesignEditor/Model/Theme/Context.php +++ b/app/code/Magento/DesignEditor/Model/Theme/Context.php @@ -37,7 +37,7 @@ class Context protected $_themeFactory; /** - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_copyService; @@ -55,11 +55,11 @@ class Context * Initialize dependencies * * @param \Magento\Core\Model\ThemeFactory $themeFactory - * @param \Magento\Core\Model\Theme\CopyService $copyService + * @param \Magento\Theme\Model\CopyService $copyService */ public function __construct( \Magento\Core\Model\ThemeFactory $themeFactory, - \Magento\Core\Model\Theme\CopyService $copyService + \Magento\Theme\Model\CopyService $copyService ) { $this->_themeFactory = $themeFactory; $this->_copyService = $copyService; diff --git a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php index 2892d3c06120304479842ceaaf09f5261b42c959..6ed4970bc953fcadfb243a797596edfd2b5b8874 100644 --- a/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php +++ b/app/code/Magento/DesignEditor/Model/Url/NavigationMode.php @@ -56,25 +56,27 @@ class NavigationMode extends \Magento\Core\Model\Url * @param \Magento\App\Route\ConfigInterface $routeConfig * @param \Magento\App\RequestInterface $request * @param \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo - * @param \Magento\DesignEditor\Helper\Data $helper * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\App $app * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\Session $session * @param \Magento\Session\SidResolverInterface $sidResolver + * @param \Magento\DesignEditor\Helper\Data $helper * @param string $areaCode * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\App\Route\ConfigInterface $routeConfig, \Magento\App\RequestInterface $request, \Magento\Core\Model\Url\SecurityInfoInterface $urlSecurityInfo, - \Magento\DesignEditor\Helper\Data $helper, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\App $app, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\Session $session, \Magento\Session\SidResolverInterface $sidResolver, + \Magento\DesignEditor\Helper\Data $helper, $areaCode, array $data = array() ) { diff --git a/app/code/Magento/DesignEditor/etc/di.xml b/app/code/Magento/DesignEditor/etc/di.xml index a9748f13bb728f163571a3167c7f85264ca1849d..8a56ee6004c1391da18032d38e6def7fe90828b3 100644 --- a/app/code/Magento/DesignEditor/etc/di.xml +++ b/app/code/Magento/DesignEditor/etc/di.xml @@ -29,7 +29,7 @@ <value>vde</value> </param> </type> - <type name="Magento\Core\Model\Theme\CopyService"> + <type name="Magento\Theme\Model\CopyService"> <plugin name="design_editor_theme_copy_service_plugin" type="Magento\DesignEditor\Model\Plugin\ThemeCopyService"/> </type> <type name="Magento\DesignEditor\Helper\Data"> diff --git a/app/code/Magento/Downloadable/Model/Product/Price.php b/app/code/Magento/Downloadable/Model/Product/Price.php index bd46745082d536f306f51867e38769208b8001c4..28f3ceae351336a7a0d995e5485ab10c6fbcd73c 100644 --- a/app/code/Magento/Downloadable/Model/Product/Price.php +++ b/app/code/Magento/Downloadable/Model/Product/Price.php @@ -42,7 +42,7 @@ class Price extends \Magento\Catalog\Model\Product\Type\Price * @param \Magento\Catalog\Model\Product $product * @return float */ - public function getFinalPrice($qty=null, $product) + public function getFinalPrice($qty, $product) { if (is_null($qty) && !is_null($product->getCalculatedFinalPrice())) { return $product->getCalculatedFinalPrice(); diff --git a/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml b/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml index 4e6157bf2eb9d02eaa9cd35d577738d653f119d0..c0e12644d00d9089598964c26d04f795498b454a 100644 --- a/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml +++ b/app/code/Magento/Downloadable/view/frontend/customer/products/list.phtml @@ -61,7 +61,7 @@ </tbody> </table> <?php else: ?> - <p class="empty"><?php echo __('You have not purchased any downloadable products yet.'); ?></p> + <div class="message info empty"><span><?php echo __('You have not purchased any downloadable products yet.'); ?></span></div> <?php endif; ?> <div class="downloadable products toolbar"> <?php echo $this->getChildHtml('pager'); ?> diff --git a/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml b/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml index a4616435e4e40613cd17abf9fa42abcbe0d28019..feeee4aa3fa438efe91df2e3880c8b460267d3bb 100644 --- a/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml +++ b/app/code/Magento/Downloadable/view/frontend/layout/downloadable_customer_products.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Downloadable\Block\Customer\Products\ListProducts" name="downloadable_customer_products_list" template="customer/products/list.phtml"/> </referenceContainer> <referenceBlock name="root"> diff --git a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php index e7483e0fbb562ddd10ee832dcff7ffae13596162..5a516296e923ce6f6b63131deb727c9ab845550f 100644 --- a/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php +++ b/app/code/Magento/Eav/Block/Adminhtml/Attribute/Edit/Main/AbstractMain.php @@ -116,7 +116,7 @@ abstract class AbstractMain /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Eav/Model/Attribute/Data/Multiselect.php b/app/code/Magento/Eav/Model/Attribute/Data/Multiselect.php index d65cfdd4a76840037429c4f403dc826d3e17c41f..acab8a8935b9db84b41066a0e8e0e908df485194 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/Multiselect.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/Multiselect.php @@ -82,6 +82,7 @@ class Multiselect extends \Magento\Eav\Model\Attribute\Data\Select case \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_JSON: case \Magento\Eav\Model\AttributeDataFactory::OUTPUT_FORMAT_ARRAY: $output = $values; + // fall-through intentional default: $output = array(); foreach ($values as $value) { diff --git a/app/code/Magento/Email/Model/Sender.php b/app/code/Magento/Email/Model/Sender.php index 1f4b58e3c74cc73b64dc6243ccbc1cd264d6b6a1..b3b93de453d2f901d4c9661d70ea6f6561c0f974 100644 --- a/app/code/Magento/Email/Model/Sender.php +++ b/app/code/Magento/Email/Model/Sender.php @@ -68,7 +68,7 @@ class Sender * @param int $storeId * @return \Magento\Email\Model\Sender */ - public function send($email, $name, $template, $sender, $templateParams = array(), $storeId) + public function send($email, $name, $template, $sender, $templateParams, $storeId) { $this->_store->load($storeId); $this->_emailInfo->addTo($email, $name); diff --git a/app/code/Magento/Email/Model/Template/Config/Reader.php b/app/code/Magento/Email/Model/Template/Config/Reader.php index dd27e292f98cec5e455775c05c8a0636278a5b78..3c52bbf0b5949274bdef3eaa6f7162af9cffca49 100644 --- a/app/code/Magento/Email/Model/Template/Config/Reader.php +++ b/app/code/Magento/Email/Model/Template/Config/Reader.php @@ -33,25 +33,36 @@ class Reader extends \Magento\Config\Reader\Filesystem private $_moduleDirResolver; /** - * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Email\Model\Template\Config\Converter $converter - * @param \Magento\Email\Model\Template\Config\SchemaLocator $schemaLocator - * @param \Magento\Config\ValidationStateInterface $validationState - * @param \Magento\Module\Dir\ReverseResolver $moduleDirResolver + * List of id attributes for merge + * + * @var array */ + protected $_idAttributes = array( + '/config/template' => 'id', + ); + public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Email\Model\Template\Config\Converter $converter, \Magento\Email\Model\Template\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - \Magento\Module\Dir\ReverseResolver $moduleDirResolver + \Magento\Module\Dir\ReverseResolver $moduleDirResolver, + $fileName = 'email_templates.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - $fileName = 'email_templates.xml'; - $idAttributes = array( - '/config/template' => 'id', - ); - parent::__construct($fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes); $this->_moduleDirResolver = $moduleDirResolver; + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope + ); } /** diff --git a/app/code/Magento/Email/Model/Template/Filter.php b/app/code/Magento/Email/Model/Template/Filter.php index cfdcf34c7ad933c9d8338dfc511ba8aeaf17289a..cce841106a2f94c8908ef378d690cde729c93eeb 100644 --- a/app/code/Magento/Email/Model/Template/Filter.php +++ b/app/code/Magento/Email/Model/Template/Filter.php @@ -121,7 +121,6 @@ class Filter extends \Magento\Filter\Template protected $_appState; /** - * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @param \Magento\Stdlib\String $string * @param \Magento\Logger $logger * @param \Magento\Escaper $escaper @@ -132,6 +131,9 @@ class Filter extends \Magento\Filter\Template * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\LayoutFactory $layoutFactory * @param \Magento\App\State $appState + * @param array $variables + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\Stdlib\String $string, @@ -143,7 +145,8 @@ class Filter extends \Magento\Filter\Template \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\View\LayoutInterface $layout, \Magento\View\LayoutFactory $layoutFactory, - \Magento\App\State $appState + \Magento\App\State $appState, + $variables = array() ) { $this->_escaper = $escaper; $this->_viewUrl = $viewUrl; @@ -155,7 +158,7 @@ class Filter extends \Magento\Filter\Template $this->_layout = $layout; $this->_layoutFactory = $layoutFactory; $this->_appState = $appState; - parent::__construct($string); + parent::__construct($string, $variables); } /** diff --git a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php index a66753612c8da4f27b315b35b070b9db32c2bbfb..ee3ee63b86746e04cacde8e0c26c75e0c21a9879 100644 --- a/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php +++ b/app/code/Magento/GiftMessage/Block/Adminhtml/Product/Helper/Form/Config.php @@ -44,21 +44,21 @@ class Config protected $_coreStoreConfig; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\Core\Model\Store\Config $coreStoreConfig, - $attributes = array() + $data = array() ) { $this->_coreStoreConfig = $coreStoreConfig; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } /** diff --git a/app/code/Magento/GiftMessage/Model/Message.php b/app/code/Magento/GiftMessage/Model/Message.php index a8cd97b7120ae0739315b135b3d472c9e194d8a3..0228e88443b005ab7f8faf93b95a125ec4af9413 100644 --- a/app/code/Magento/GiftMessage/Model/Message.php +++ b/app/code/Magento/GiftMessage/Model/Message.php @@ -63,8 +63,8 @@ class Message extends \Magento\Core\Model\AbstractModel public function __construct( \Magento\Core\Model\Context $context, \Magento\Core\Model\Registry $registry, - \Magento\GiftMessage\Model\Resource\Message $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, + \Magento\GiftMessage\Model\Resource\Message $resource, + \Magento\Data\Collection\Db $resourceCollection, \Magento\GiftMessage\Model\TypeFactory $typeFactory, array $data = array() ) { diff --git a/app/code/Magento/GoogleAnalytics/Block/Ga.php b/app/code/Magento/GoogleAnalytics/Block/Ga.php index ddce627f4754b3e73853d91693995fd9c86bc155..d117d0714085366f3516c80217fe315011016cde 100644 --- a/app/code/Magento/GoogleAnalytics/Block/Ga.php +++ b/app/code/Magento/GoogleAnalytics/Block/Ga.php @@ -99,7 +99,7 @@ class Ga extends \Magento\View\Element\Template { $pageName = trim($this->getPageName()); $optPageURL = ''; - if ($pageName && preg_match('/^\/.*/i', $pageName)) { + if ($pageName && substr($pageName, 0, 1) == '/' && strlen($pageName) > 1) { $optPageURL = ", '{$this->escapeJsQuote($pageName)}'"; } return " diff --git a/app/code/Magento/GoogleAnalytics/Model/Observer.php b/app/code/Magento/GoogleAnalytics/Model/Observer.php index 4e3b0c7911d6a4a94fe77f4340138e69d52b1aa8..bcb839b1fc06b4dc25b2d0768a80a14251d8f4af 100644 --- a/app/code/Magento/GoogleAnalytics/Model/Observer.php +++ b/app/code/Magento/GoogleAnalytics/Model/Observer.php @@ -49,7 +49,7 @@ class Observer protected $_googleAnalyticsData = null; /** - * @var \Magento\Core\Model\Layout + * @var \Magento\View\LayoutInterface */ protected $_layout; @@ -60,12 +60,12 @@ class Observer /** * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Core\Model\Layout $layout + * @param \Magento\View\LayoutInterface $layout * @param \Magento\GoogleAnalytics\Helper\Data $googleAnalyticsData */ public function __construct( \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Core\Model\Layout $layout, + \Magento\View\LayoutInterface $layout, \Magento\GoogleAnalytics\Helper\Data $googleAnalyticsData ) { $this->_googleAnalyticsData = $googleAnalyticsData; diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php index 2c3a829d33f0cb423e2a06b33b232ea5023ba4cc..ea7a51b8586ee29b2e4a6bb22767ce67cdcf95da 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Callback.php @@ -64,24 +64,24 @@ class Callback extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml protected $string; /** + * @param \Magento\ObjectManager $objectManager + * @param \Magento\Core\Model\Translate $translator + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Core\Helper\Data $coreData * @param \Magento\GoogleCheckout\Helper\Data $googleCheckoutData * @param \Magento\Tax\Helper\Data $taxData - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Stdlib\String $string * @param array $data */ public function __construct( + \Magento\ObjectManager $objectManager, + \Magento\Core\Model\Translate $translator, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\Core\Helper\Data $coreData, \Magento\GoogleCheckout\Helper\Data $googleCheckoutData, \Magento\Tax\Helper\Data $taxData, - \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Stdlib\String $string, array $data = array() ) { diff --git a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php index cf44cff5d64820d0c16bc30d1edecea56b891954..8d6dc445dff5854041698fe8c6222bd40af61aaa 100644 --- a/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php +++ b/app/code/Magento/GoogleCheckout/Model/Api/Xml/Checkout.php @@ -93,25 +93,25 @@ class Checkout extends \Magento\GoogleCheckout\Model\Api\Xml\AbstractXml protected $_eventManager = null; /** + * @param \Magento\ObjectManager $objectManager + * @param \Magento\Core\Model\Translate $translator + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Customer\Helper\Data $customerData * @param \Magento\GoogleCheckout\Helper\Data $googleCheckoutData * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Weee\Helper\Data $weeeData - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Core\Model\Translate $translator - * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param array $data */ public function __construct( + \Magento\ObjectManager $objectManager, + \Magento\Core\Model\Translate $translator, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Event\ManagerInterface $eventManager, \Magento\Customer\Helper\Data $customerData, \Magento\GoogleCheckout\Helper\Data $googleCheckoutData, \Magento\Tax\Helper\Data $taxData, \Magento\Weee\Helper\Data $weeeData, - \Magento\ObjectManager $objectManager, - \Magento\Core\Model\Translate $translator, - \Magento\Core\Model\Store\Config $coreStoreConfig, array $data = array() ) { $this->_eventManager = $eventManager; diff --git a/app/code/Magento/GoogleCheckout/Model/Payment.php b/app/code/Magento/GoogleCheckout/Model/Payment.php index 9c4543a17cd41cf747457f5b5ac7083cb12e08ba..b76378021d3d3a77f5827281f51e7ccd0c2c3e85 100644 --- a/app/code/Magento/GoogleCheckout/Model/Payment.php +++ b/app/code/Magento/GoogleCheckout/Model/Payment.php @@ -64,13 +64,13 @@ class Payment extends \Magento\Payment\Model\Method\AbstractMethod protected $dateFactory; public function __construct( - \Magento\Core\Model\DateFactory $dateFactory, - \Magento\Core\Model\UrlFactory $urlFactory, - \Magento\GoogleCheckout\Model\ApiFactory $apiFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Core\Model\DateFactory $dateFactory, + \Magento\Core\Model\UrlFactory $urlFactory, + \Magento\GoogleCheckout\Model\ApiFactory $apiFactory, array $data = array() ) { $this->dateFactory = $dateFactory; diff --git a/app/code/Magento/GoogleShopping/Model/Service/Item.php b/app/code/Magento/GoogleShopping/Model/Service/Item.php index 35be6c55869cb2f98ab3185aee7d7ad160896819..885e2438d1bee0e6d28c3f2cb85c6699b2cc70a0 100644 --- a/app/code/Magento/GoogleShopping/Model/Service/Item.php +++ b/app/code/Magento/GoogleShopping/Model/Service/Item.php @@ -49,17 +49,17 @@ class Item extends \Magento\GoogleShopping\Model\Service /** * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory - * @param \Magento\Core\Model\Date $date * @param \Magento\Core\Model\Registry $coreRegistry * @param \Magento\GoogleShopping\Model\Config $config + * @param \Magento\Core\Model\Date $date * @param \Magento\GoogleShopping\Helper\Data $gsData * @param array $data */ public function __construct( \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, - \Magento\Core\Model\Date $date, \Magento\Core\Model\Registry $coreRegistry, \Magento\GoogleShopping\Model\Config $config, + \Magento\Core\Model\Date $date, \Magento\GoogleShopping\Helper\Data $gsData, array $data = array() ) { diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php index f771269af4e7939f00ec4016fb98fb37c67373bf..943ea21bd277363d0814b97c5b5b904308eb6647 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Export/Edit/Form.php @@ -75,7 +75,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('adminhtml/*/getFilter'), 'method' => 'post', diff --git a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php index 608d1a813006d996418081a3c405530cc1301f86..dbc7b55bc3e40fc6338addfac5e573dd1ea4801f 100644 --- a/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php +++ b/app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php @@ -85,7 +85,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('adminhtml/*/validate'), 'method' => 'post', diff --git a/app/code/Magento/ImportExport/Model/Export/Config/Reader.php b/app/code/Magento/ImportExport/Model/Export/Config/Reader.php index bdec2c430e82342494b5fd287b12a4a0f8fb38b8..28c4907db4f3b35a021ac0e45d509e6ee040e7e7 100644 --- a/app/code/Magento/ImportExport/Model/Export/Config/Reader.php +++ b/app/code/Magento/ImportExport/Model/Export/Config/Reader.php @@ -39,11 +39,12 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver * @param \Magento\ImportExport\Model\Export\Config\Converter $converter - * @param \Magento\Config\ValidationStateInterface $validationState * @param \Magento\ImportExport\Model\Export\Config\SchemaLocator $schemaLocator + * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -52,10 +53,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'export.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } diff --git a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php index 7e4d1096c5973497a80eba5d215a79ea9cc2d7f6..62333f7e03947877cf127d99418a3a5333539a03 100644 --- a/app/code/Magento/ImportExport/Model/Export/Entity/Product.php +++ b/app/code/Magento/ImportExport/Model/Export/Entity/Product.php @@ -653,8 +653,10 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity switch($lastMemoryLimitLetter) { case 'g': $memoryLimit *= 1024; + // fall-through intentional case 'm': $memoryLimit *= 1024; + // fall-through intentional case 'k': $memoryLimit *= 1024; break; diff --git a/app/code/Magento/ImportExport/Model/Import/Config/Reader.php b/app/code/Magento/ImportExport/Model/Import/Config/Reader.php index 159ad4daa794c24ae4b2ffc52ba6a5bbcea76697..799e251217e024a505664d91d9efad6fb693d1ec 100644 --- a/app/code/Magento/ImportExport/Model/Import/Config/Reader.php +++ b/app/code/Magento/ImportExport/Model/Import/Config/Reader.php @@ -38,11 +38,12 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver * @param \Magento\ImportExport\Model\Import\Config\Converter $converter - * @param \Magento\Config\ValidationStateInterface $validationState * @param \Magento\ImportExport\Model\Import\Config\SchemaLocator $schemaLocator + * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -51,10 +52,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'import.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php index 244cf30a12510a3048012bd7603d53a249bdd4c2..e83f10e43f303bb228adbf64d861ba1c8254725b 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Configurable.php @@ -153,20 +153,20 @@ class Configurable /** * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac + * @param array $params * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypesConfig * @param \Magento\ImportExport\Model\Resource\Helper $resourceHelper * @param \Magento\App\Resource $resource * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $_productColFac - * @param array $params */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, + array $params, \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypesConfig, \Magento\ImportExport\Model\Resource\Helper $resourceHelper, \Magento\App\Resource $resource, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $_productColFac, - array $params + \Magento\Catalog\Model\Resource\Product\CollectionFactory $_productColFac ) { $this->_productTypesConfig = $productTypesConfig; $this->_resourceHelper = $resourceHelper; diff --git a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php index abe164fd975b87349ec46185273f6346c2ff48d8..6b016d3abda1132baec1745e6e1bf786125324f3 100644 --- a/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php +++ b/app/code/Magento/ImportExport/Model/Import/Entity/Product/Type/Grouped.php @@ -70,20 +70,19 @@ class Grouped /** * @param \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac + * @param array $params * @param \Magento\ImportExport\Model\ImportFactory $importFactory * @param \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory * @param \Magento\App\Resource $resource - * @param array $params */ public function __construct( \Magento\Eav\Model\Resource\Entity\Attribute\Set\CollectionFactory $attrSetColFac, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $prodAttrColFac, + array $params, \Magento\ImportExport\Model\ImportFactory $importFactory, \Magento\Catalog\Model\Resource\Product\LinkFactory $productLinkFactory, - \Magento\App\Resource $resource, - array $params - ) - { + \Magento\App\Resource $resource + ) { $this->_importFactory = $importFactory; $this->_resource = $resource; $this->_productLinkFactory = $productLinkFactory; diff --git a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Form.php b/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Form.php index 8dd4f0791d9cfdd3eaefde8eb76410930ebe3c16..f0699b20eaff6aa8480959b855016f3f558d806f 100644 --- a/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Form.php +++ b/app/code/Magento/Index/Block/Adminhtml/Process/Edit/Form.php @@ -32,7 +32,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getActionUrl(), 'method' => 'post', diff --git a/app/code/Magento/Index/Model/Indexer/Config/Reader.php b/app/code/Magento/Index/Model/Indexer/Config/Reader.php index d46fe4775c2e602dbab2129a315c361a044fa5fc..1a93bcdafc1a90216163ad085478e0ab1a475fed 100644 --- a/app/code/Magento/Index/Model/Indexer/Config/Reader.php +++ b/app/code/Magento/Index/Model/Indexer/Config/Reader.php @@ -45,6 +45,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -53,10 +54,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'indexers.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } diff --git a/app/code/Magento/Index/Model/Shell.php b/app/code/Magento/Index/Model/Shell.php index b3822a9f1438428e0424b17ac4795b0bcd19753f..3ddf6efef97a948fb656a72c07f9ac83d28ba7e8 100644 --- a/app/code/Magento/Index/Model/Shell.php +++ b/app/code/Magento/Index/Model/Shell.php @@ -48,16 +48,16 @@ class Shell extends \Magento\Core\Model\AbstractShell protected $_indexer; /** - * @param \Magento\Index\Model\Indexer $indexer * @param \Magento\Filesystem $filesystem * @param string $entryPoint * @param \Magento\App\Dir $dir + * @param \Magento\Index\Model\Indexer $indexer */ public function __construct( - \Magento\Index\Model\Indexer $indexer, \Magento\Filesystem $filesystem, $entryPoint, - \Magento\App\Dir $dir + \Magento\App\Dir $dir, + \Magento\Index\Model\Indexer $indexer ) { $this->_indexer = $indexer; parent::__construct($filesystem, $entryPoint, $dir); diff --git a/app/code/Magento/Install/App/Action/Plugin/Design.php b/app/code/Magento/Install/App/Action/Plugin/Design.php index 141bd171386fee6c98c22cac637d003eaa374991..58423881ca8b715b8f025cf09bdb140676de0911 100644 --- a/app/code/Magento/Install/App/Action/Plugin/Design.php +++ b/app/code/Magento/Install/App/Action/Plugin/Design.php @@ -42,9 +42,9 @@ class Design protected $_layout; /** - * @var \Magento\Core\Model\Theme\CollectionFactory + * @var \Magento\View\Design\Theme\ListInterface */ - protected $_collectionFactory; + protected $_themeList; /** * @var \Magento\View\DesignInterface @@ -56,17 +56,17 @@ class Design * @param \Magento\Core\Model\App $app * @param \Magento\View\LayoutInterface $layout * @param \Magento\View\DesignInterface $viewDesign - * @param \Magento\Core\Model\Theme\CollectionFactory $collectionFactory + * @param \Magento\View\Design\Theme\ListInterface $themeList */ public function __construct( \Magento\App\RequestInterface $request, \Magento\Core\Model\App $app, \Magento\View\LayoutInterface $layout, \Magento\View\DesignInterface $viewDesign, - \Magento\Core\Model\Theme\CollectionFactory $collectionFactory + \Magento\View\Design\Theme\ListInterface $themeList ) { $this->_viewDesign = $viewDesign; - $this->_collectionFactory = $collectionFactory; + $this->_themeList = $themeList; $this->_request = $request; $this->_app = $app; $this->_layout = $layout; @@ -84,11 +84,9 @@ class Design $area = $this->_app->getArea($areaCode); $area->load(\Magento\Core\Model\App\Area::PART_CONFIG); - /** @var $themesCollection \Magento\Core\Model\Theme\Collection */ - $themesCollection = $this->_collectionFactory->create(); - $themeModel = $themesCollection->addDefaultPattern($areaCode) - ->addFilter('theme_path', $this->_viewDesign->getConfigurationDesignTheme($areaCode)) - ->getFirstItem(); + $themePath = $this->_viewDesign->getConfigurationDesignTheme($areaCode); + $themeFullPath = $areaCode . \Magento\View\Design\ThemeInterface::PATH_SEPARATOR . $themePath; + $themeModel = $this->_themeList->getThemeByFullPath($themeFullPath); $this->_viewDesign->setArea($areaCode)->setDesignTheme($themeModel); $area->detectDesign($this->_request); diff --git a/app/code/Magento/Install/etc/di.xml b/app/code/Magento/Install/etc/di.xml index 7460d942e67b45eb059e430c65c67f10b4d66901..551fc38f61bfa2b98cdc96237e356896367b456c 100644 --- a/app/code/Magento/Install/etc/di.xml +++ b/app/code/Magento/Install/etc/di.xml @@ -24,6 +24,7 @@ */ --> <config> + <preference for="Magento\View\Design\Theme\ListInterface" type="Magento\Core\Model\Theme\Collection" /> <virtualType name="Magento\Install\Model\Session" type="Magento\Core\Model\Session\Generic"> <param name="sessionNamespace"> <value>install</value> diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php index a4b1a47c2ccbe2e3627e9b63be0dac7b1a82fb5e..1bfaaefb92324f8d7cb7b9a52cff9f031f3096b8 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Activate/Permissions/Tabs.php @@ -1,6 +1,6 @@ <?php /** - * API permissions tab for integration activation dialog. + * Permissions tab for integration activation dialog. * * Magento * diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php index a074c1c8922222da609b4a4b84508df45ba66825..8f32e05d58b0eb46d665dca416f172c665bb2c98 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit.php @@ -1,5 +1,7 @@ <?php /** + * Integration edit container. + * * Magento * * NOTICE OF LICENSE @@ -61,6 +63,40 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container parent::_construct(); $this->_removeButton('reset'); $this->_removeButton('delete'); + + if ($this->_isNewIntegration()) { + $this->removeButton('save')->addButton( + 'save', + [ + 'id' => 'save-split-button', + 'label' => __('Save'), + 'class_name' => 'Magento\Backend\Block\Widget\Button\SplitButton', + 'button_class' => 'PrimarySplitButton', + 'data_attribute' => [ + 'mage-init' => [ + 'button' => ['event' => 'save', 'target' => '#edit_form'], + ], + ], + 'options' => [ + 'save_activate' => [ + 'id' => 'activate', + 'label' => __('Save & Activate'), + 'data_attribute' => [ + 'mage-init' => [ + 'button' => [ + 'event' => 'saveAndActivate', + 'target' => '#edit_form', + ], + 'integration' => [ + 'gridUrl' => $this->getUrl('*/*/'), + ] + ] + ] + ] + ] + ] + ); + } } /** @@ -70,15 +106,15 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container */ public function getHeaderText() { - if (isset($this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)[Info::DATA_ID])) { + if ($this->_isNewIntegration()) { + return __('New Integration'); + } else { return __( "Edit Integration '%1'", $this->escapeHtml( $this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)[Info::DATA_NAME] ) ); - } else { - return __('New Integration'); } } @@ -89,4 +125,14 @@ class Edit extends \Magento\Adminhtml\Block\Widget\Form\Container { return $this->getUrl('*/*/save'); } + + /** + * Determine whether we create new integration or editing an existing one. + * + * @return bool + */ + protected function _isNewIntegration() + { + return !isset($this->_registry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION)[Info::DATA_ID]); + } } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php index 9c0f4ce006e401eb45ce310977141436b444302a..2d38b893f23a6b6c5ae186a3abf1dae13511953d 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create( array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php index 1eccbee1b67f6e3342a7adf8bcf76295e99fbbf2..9755e8ffe589e25862355abeca279481c05374e6 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Edit/Tab/Info.php @@ -26,7 +26,8 @@ namespace Magento\Integration\Block\Adminhtml\Integration\Edit\Tab; -use \Magento\Integration\Controller\Adminhtml\Integration; +use Magento\Integration\Controller\Adminhtml\Integration; +use Magento\Integration\Model\Integration as IntegrationModel; /** * Main Integration info edit form @@ -38,7 +39,7 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { /**#@+ - * edit_form element names. + * Form elements names. */ const HTML_ID_PREFIX = 'integration_properties_'; const DATA_ID = 'integration_id'; @@ -46,6 +47,7 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic const DATA_EMAIL = 'email'; const DATA_ENDPOINT = 'endpoint'; const DATA_SETUP_TYPE = 'setup_type'; + const DATA_CONSUMER_ID = 'consumer_id'; /**#@-*/ /** @@ -59,44 +61,8 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic $form = $this->_formFactory->create(); $form->setHtmlIdPrefix(self::HTML_ID_PREFIX); $integrationData = $this->_coreRegistry->registry(Integration::REGISTRY_KEY_CURRENT_INTEGRATION); - $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General'))); - if (isset($integrationData[self::DATA_ID])) { - $fieldset->addField(self::DATA_ID, 'hidden', array('name' => 'id')); - } - $fieldset->addField( - self::DATA_NAME, - 'text', - array( - 'label' => __('Name'), - 'name' => self::DATA_NAME, - 'required' => true, - 'disabled' => false, - 'maxlength' => '255' - ) - ); - $fieldset->addField( - self::DATA_EMAIL, - 'text', - array( - 'label' => __('Email'), - 'name' => self::DATA_EMAIL, - 'disabled' => false, - 'class' => 'validate-email', - 'maxlength' => '254' - ) - ); - $fieldset->addField( - self::DATA_ENDPOINT, - 'text', - array( - 'label' => __('Callback URL'), - 'name' => self::DATA_ENDPOINT, - 'disabled' => false, - // @codingStandardsIgnoreStart - 'note'=> __('When using Oauth for token exchange, enter URL where Oauth credentials can be POST-ed. We strongly recommend you to use https://') - // @codingStandardsIgnoreEnd - ) - ); + $this->_addGeneralFieldset($form, $integrationData); + $this->_addDetailsFieldset($form, $integrationData); $form->setValues($integrationData); $this->setForm($form); return $this; @@ -141,4 +107,79 @@ class Info extends \Magento\Backend\Block\Widget\Form\Generic { return false; } + + /** + * Add fieldset with general integration information. + * + * @param \Magento\Data\Form $form + * @param array $integrationData + */ + protected function _addGeneralFieldset($form, $integrationData) + { + $fieldset = $form->addFieldset('base_fieldset', array('legend' => __('General'))); + + $disabled = false; + if (isset($integrationData[self::DATA_ID])) { + $fieldset->addField(self::DATA_ID, 'hidden', array('name' => 'id')); + + if ($integrationData[self::DATA_SETUP_TYPE] == IntegrationModel::TYPE_CONFIG) { + $disabled = true; + } + } + + $fieldset->addField( + self::DATA_NAME, + 'text', + array( + 'label' => __('Name'), + 'name' => self::DATA_NAME, + 'required' => true, + 'disabled' => $disabled, + 'maxlength' => '255' + ) + ); + $fieldset->addField( + self::DATA_EMAIL, + 'text', + array( + 'label' => __('Email'), + 'name' => self::DATA_EMAIL, + 'disabled' => $disabled, + 'class' => 'validate-email', + 'maxlength' => '254' + ) + ); + $fieldset->addField( + self::DATA_ENDPOINT, + 'text', + array( + 'label' => __('Callback URL'), + 'name' => self::DATA_ENDPOINT, + 'disabled' => $disabled, + // @codingStandardsIgnoreStart + 'note' => __( + 'Enter URL where Oauth credentials can be sent when using Oauth for token exchange. We strongly recommend using https://.' + ) + // @codingStandardsIgnoreEnd + ) + ); + } + + /** + * Add fieldset with integration details. This fieldset is available for existing integrations only. + * + * @param \Magento\Data\Form $form + * @param array $integrationData + */ + protected function _addDetailsFieldset($form, $integrationData) + { + if (isset($integrationData[self::DATA_ID])) { + $fieldset = $form->addFieldset('details_fieldset', array('legend' => __('Integration Details'))); + /** @var \Magento\Integration\Block\Adminhtml\Integration\Tokens $tokensBlock */ + $tokensBlock = $this->getChildBlock('integration_tokens'); + foreach ($tokensBlock->getFormFields() as $field) { + $fieldset->addField($field['name'], $field['type'], $field['metadata']); + } + } + } } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Token.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Token.php deleted file mode 100644 index e64c122d4235e2c36613c06cd566e662e5716483..0000000000000000000000000000000000000000 --- a/app/code/Magento/Integration/Block/Adminhtml/Integration/Token.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Integration\Block\Adminhtml\Integration; - -/** - * Main Integration properties edit form - * - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Token extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Set form id prefix, declare fields for integration consumer modal - * - * @return \Magento\Integration\Block\Adminhtml\Integration\Token - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(); - $htmlIdPrefix = 'integration_token_'; - $form->setHtmlIdPrefix($htmlIdPrefix); - - $fieldset = $form->addFieldset('base_fieldset', array( - 'legend' => __('Integration Tokens for Extensions'), - 'class' => 'fieldset-wide' - )); - - $fieldset->addField('token', 'text', array( - 'label' => __('Token'), - 'name' => 'token', - 'readonly' => true - )); - - $fieldset->addField('token-secret', 'text', array( - 'label' => __('Token Secret'), - 'name' => 'token-secret', - 'readonly' => true - )); - - $fieldset->addField('client-id', 'text', array( - 'label' => __('Client ID'), - 'name' => 'client-id', - 'readonly' => true - )); - - $fieldset->addField('client-secret', 'text', array( - 'label' => __('Client Secret'), - 'name' => 'client-secret', - 'readonly' => true - )); - - // TODO: retrieve token associated to this integration to populate the form - // $form->setValues($model->getData()); - - $this->setForm($form); - - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php new file mode 100644 index 0000000000000000000000000000000000000000..abfba8ffe0099d9f5a6f4196cf91d5e7d84877aa --- /dev/null +++ b/app/code/Magento/Integration/Block/Adminhtml/Integration/Tokens.php @@ -0,0 +1,123 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Block\Adminhtml\Integration; + +use \Magento\Integration\Controller\Adminhtml\Integration as IntegrationController; + +/** + * Main Integration properties edit form + * + * @SuppressWarnings(PHPMD.DepthOfInheritance) + */ +class Tokens extends \Magento\Backend\Block\Widget\Form\Generic +{ + /**#@+ + * Form elements names. + */ + const DATA_TOKEN = 'token'; + const DATA_TOKEN_SECRET = 'token_secret'; + const DATA_CONSUMER_KEY = 'consumer_key'; + const DATA_CONSUMER_SECRET = 'consumer_secret'; + /**#@-*/ + + /** + * Set form id prefix, declare fields for integration consumer modal + * + * @return \Magento\Backend\Block\Widget\Form + */ + protected function _prepareForm() + { + /** @var \Magento\Data\Form $form */ + $form = $this->_formFactory->create(); + $htmlIdPrefix = 'integration_token_'; + $form->setHtmlIdPrefix($htmlIdPrefix); + + $fieldset = $form->addFieldset( + 'base_fieldset', + array( + 'legend' => __('Integration Tokens for Extensions'), + 'class' => 'fieldset-wide' + ) + ); + + foreach ($this->getFormFields() as $field) { + $fieldset->addField($field['name'], $field['type'], $field['metadata']); + } + + $integrationData = $this->_coreRegistry->registry(IntegrationController::REGISTRY_KEY_CURRENT_INTEGRATION); + if ($integrationData) { + $form->setValues($integrationData); + } + $this->setForm($form); + return parent::_prepareForm(); + } + + /** + * Return a list of form fields with oAuth credentials. + * + * @return array + */ + public function getFormFields() + { + return array( + array( + 'name' => self::DATA_CONSUMER_KEY, + 'type' => 'text', + 'metadata' => array( + 'label' => __('Consumer Key'), + 'name' => self::DATA_CONSUMER_KEY, + 'readonly' => true, + ) + ), + array( + 'name' => self::DATA_CONSUMER_SECRET, + 'type' => 'text', + 'metadata' => array( + 'label' => __('Consumer Secret'), + 'name' => self::DATA_CONSUMER_SECRET, + 'readonly' => true, + ) + ), + array( + 'name' => self::DATA_TOKEN, + 'type' => 'text', + 'metadata' => array( + 'label' => __('Access Token'), + 'name' => self::DATA_TOKEN, + 'readonly' => true, + ) + ), + array( + 'name' => self::DATA_TOKEN_SECRET, + 'type' => 'text', + 'metadata' => array( + 'label' => __('Access Token Secret'), + 'name' => self::DATA_TOKEN_SECRET, + 'readonly' => true, + ) + ), + ); + } +} diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php index 011613dc07c6881aea36adb45a9d9625be10b967..1b1e22eb1cc473e920ff5a03c5dd59fefb74a398 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button.php @@ -25,7 +25,8 @@ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer; use Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer; -use \Magento\Object; +use Magento\Integration\Model\Integration; +use Magento\Object; /** * Render HTML <button> tag. @@ -44,6 +45,18 @@ class Button extends AbstractRenderer return sprintf('<button %s>%s</button>', $this->_getAttributesStr($attributes), $this->_getValue($row)); } + /** + * Determine whether current integration came from config file + * + * @param \Magento\Object $row + * @return bool + */ + protected function _isConfigBasedIntegration(Object $row) + { + return ($row->hasData(Integration::SETUP_TYPE) + && $row->getData(Integration::SETUP_TYPE) == Integration::TYPE_CONFIG); + } + /** * Whether current item is disabled. * diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php index a9364800f3e5a99143cb7a50a3eb4b3b4c35e9b7..f253d21a3ac2463e240b0c4bcf57edc1637c59e7 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Delete.php @@ -26,9 +26,10 @@ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; +use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; use Magento\Object; -class Delete extends IntegrationAbstract +class Delete extends Button { /** * Return 'onclick' action for the button (redirect to the integration edit page). @@ -38,7 +39,7 @@ class Delete extends IntegrationAbstract */ protected function _getOnclickAttribute(Object $row) { - return sprintf("window.location.href='%s'", $this->getUrl('*/*/delete', ['id' => $row->getId()])); + return sprintf("this.setAttribute('data-url', '%s')", $this->getUrl('*/*/delete', ['id' => $row->getId()])); } /** @@ -51,4 +52,15 @@ class Delete extends IntegrationAbstract { return $this->_isDisabled($row) ? __('Uninstall the extension to remove this integration') : __('Remove'); } + + /** + * Determine whether current integration came from config file, thus can not be removed + * + * @param \Magento\Object $row + * @return bool + */ + protected function _isDisabled(Object $row) + { + return $this->_isConfigBasedIntegration($row); + } } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php index 3c1d6e4a57570c840bd8569806557f057cbe9627..30832c1979612b051c9db78f7f9901f139ab497a 100644 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php +++ b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/Edit.php @@ -27,8 +27,9 @@ namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; use Magento\Object; +use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; -class Edit extends IntegrationAbstract +class Edit extends Button { /** * Return 'onclick' action for the button (redirect to the integration edit page). @@ -49,6 +50,20 @@ class Edit extends IntegrationAbstract */ protected function _getTitleAttribute(Object $row) { - return $this->_isDisabled($row) ? '' : __('Edit'); + return $this->_isConfigBasedIntegration($row) ? __('View') : __('Edit'); + } + + /** + * Get the icon on the grid according to the integration type + * + * @param \Magento\Object $row + * return string + */ + public function _getClassAttribute(Object $row) + { + $class = $this->_isConfigBasedIntegration($row) ? 'info' : 'edit'; + + return 'action ' . $class; + } } diff --git a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/IntegrationAbstract.php b/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/IntegrationAbstract.php deleted file mode 100644 index 76db7a82352e7c668810b1e8ae1d991306840c05..0000000000000000000000000000000000000000 --- a/app/code/Magento/Integration/Block/Adminhtml/Widget/Grid/Column/Renderer/Button/IntegrationAbstract.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Functions that shared both by Edit and Delete buttons. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; - -use Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button; -use Magento\Integration\Model\Integration; -use Magento\Object; - -abstract class IntegrationAbstract extends Button -{ - /** - * Determine whether current integration came from config file, thus can not be removed or edited. - * - * @param \Magento\Object $row - * @return bool - */ - protected function _isDisabled(Object $row) - { - return ($row->hasData(Integration::SETUP_TYPE) - && $row->getData(Integration::SETUP_TYPE) == Integration::TYPE_CONFIG); - } -} diff --git a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php index f5e1693d972a169c6b9d532732014d6ee77c301c..63c56ae663bd51cbd83d8701a9bade6dee5a3cca 100644 --- a/app/code/Magento/Integration/Controller/Adminhtml/Integration.php +++ b/app/code/Magento/Integration/Controller/Adminhtml/Integration.php @@ -26,8 +26,9 @@ namespace Magento\Integration\Controller\Adminhtml; use Magento\Backend\App\Action; use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; -use Magento\Integration\Model\Integration as IntegrationKeyConstants; use Magento\Integration\Exception as IntegrationException; +use Magento\Integration\Service\OauthV1Interface as IntegrationOauthService; +use Magento\Integration\Model\Integration as IntegrationModel; /** * Controller for integrations management. @@ -40,16 +41,6 @@ class Integration extends Action /** Keys used for registering data into the registry */ const REGISTRY_KEY_CURRENT_INTEGRATION = 'current_integration'; - /** Request parameter which define the dialog window requested */ - const PARAM_DIALOG_ID = 'popup_dialog'; - - /**#@+ - * Allowed values for PARAM_DIALOG_ID request parameter - */ - const DIALOG_PERMISSIONS = 'permissions'; - const DIALOG_TOKENS = 'tokens'; - /**#@-*/ - /** * Core registry * @@ -63,21 +54,40 @@ class Integration extends Action /** @var \Magento\Integration\Service\IntegrationV1Interface */ private $_integrationService; + /** @var IntegrationOauthService */ + protected $_oauthService; + + /** @var \Magento\Core\Helper\Data */ + protected $_coreHelper; + + /** @var \Magento\Integration\Helper\Data */ + protected $_integrationData; + /** * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService * @param \Magento\Core\Model\Registry $registry * @param \Magento\Logger $logger + * @param IntegrationOauthService $oauthService + * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService + * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Integration\Helper\Data $integrationData */ public function __construct( \Magento\Backend\App\Action\Context $context, - \Magento\Integration\Service\IntegrationV1Interface $integrationService, \Magento\Core\Model\Registry $registry, - \Magento\Logger $logger + \Magento\Logger $logger, + \Magento\Integration\Service\IntegrationV1Interface $integrationService, + IntegrationOauthService $oauthService, + \Magento\Core\Helper\Data $coreHelper, + \Magento\Integration\Helper\Data $integrationData ) { + parent::__construct($context); $this->_registry = $registry; $this->_logger = $logger; $this->_integrationService = $integrationService; + $this->_oauthService = $oauthService; + $this->_coreHelper = $coreHelper; + $this->_integrationData = $integrationData; parent::__construct($context); } @@ -139,30 +149,28 @@ class Integration extends Action $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); if ($integrationId) { try { - $integrationData = $this->_integrationService->get($integrationId); + $integrationData = $this->_integrationService->get($integrationId)->getData(); + $originalName = $integrationData[Info::DATA_NAME]; } catch (IntegrationException $e) { $this->_getSession()->addError($e->getMessage()); $this->_redirect('*/*/'); return; + } catch (\Exception $e) { + $this->_logger->logException($e); + $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->_redirect('*/*'); + return; } $restoredIntegration = $this->_getSession()->getIntegrationData(); if (isset($restoredIntegration[Info::DATA_ID]) && $integrationId == $restoredIntegration[Info::DATA_ID]) { $integrationData = array_merge($integrationData, $restoredIntegration); } - - if (isset($integrationData[Info::DATA_SETUP_TYPE]) - && $integrationData[Info::DATA_SETUP_TYPE] == IntegrationKeyConstants::TYPE_CONFIG - ) { - //Cannot edit Integrations created from Config. No error necessary just redirect to grid - $this->_redirect('*/*/'); - return; - } - $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); } else { $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); $this->_redirect('*/*/'); return; } + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); $this->_view->loadLayout(); $this->_getSession()->setIntegrationData(array()); $this->_setActiveMenu('Magento_Integration::system_integrations'); @@ -170,12 +178,15 @@ class Integration extends Action __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]), __('Edit "%1" Integration', $integrationData[Info::DATA_NAME]) ); - $this->_title->add(__('Edit "%1" Integration', $integrationData[Info::DATA_NAME])); + $this->_title->add(__('Edit "%1" Integration', $originalName)); $this->_view->renderLayout(); } /** * Save integration action. + * + * TODO: Fix cyclomatic complexity. + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function saveAction() { @@ -184,33 +195,47 @@ class Integration extends Action try { $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); if ($integrationId) { - $integrationData = $this->_integrationService->get($integrationId); - if (!$integrationData[Info::DATA_ID]) { - $this->_getSession()->addError(__('This integration no longer exists.')); + try { + $integrationData = $this->_integrationService->get($integrationId)->getData(); + } catch (IntegrationException $e) { + $this->_getSession()->addError($e->getMessage()); $this->_redirect('*/*/'); return; + } catch (\Exception $e) { + $this->_logger->logException($e); + $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->_redirect('*/*'); + return; } } /** @var array $data */ $data = $this->getRequest()->getPost(); if (!empty($data)) { + // TODO: Move out work with API permissions to Web API module if (!isset($data['resource'])) { $integrationData['resource'] = array(); } $integrationData = array_merge($integrationData, $data); - $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); if (!isset($integrationData[Info::DATA_ID])) { - $this->_integrationService->create($integrationData); + $integrationData = $this->_integrationService->create($integrationData); } else { - $this->_integrationService->update($integrationData); + $integrationData = $this->_integrationService->update($integrationData); + } + if (!$this->getRequest()->isXmlHttpRequest()) { + $this->_getSession() + ->addSuccess(__('The integration \'%1\' has been saved.', $integrationData[Info::DATA_NAME])); } - $this->_getSession() - ->addSuccess(__('The integration \'%1\' has been saved.', $integrationData[Info::DATA_NAME])); } else { $this->_getSession()->addError(__('The integration was not saved.')); } - $this->_redirect('*/*/'); - } catch (\Magento\Integration\Exception $e) { + if ($this->getRequest()->isXmlHttpRequest()) { + $this->getResponse()->setBody( + $this->_coreHelper->jsonEncode(['integrationId' => $integrationData[Info::DATA_ID]]) + ); + } else { + $this->_redirect('*/*/'); + } + } catch (IntegrationException $e) { $this->_getSession()->addError($e->getMessage())->setIntegrationData($integrationData); $this->_redirectOnSaveError(); } catch (\Magento\Core\Exception $e) { @@ -224,57 +249,109 @@ class Integration extends Action } /** - * Activates the integration. Also contains intermediate steps (permissions confirmation and tokens). + * Show permissions popup. */ - public function activateAction() + public function permissionsDialogAction() { $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); if ($integrationId) { - $integrationData = $this->_integrationService->get($integrationId); - if (!$integrationData[Info::DATA_ID]) { - $this->_getSession()->addError(__('This integration no longer exists.')); + try { + $integrationData = $this->_integrationService->get($integrationId)->getData(); + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); + } catch (IntegrationException $e) { + $this->_getSession()->addError($e->getMessage()); $this->_redirect('*/*/'); return; + } catch (\Exception $e) { + $this->_logger->logException($e); + $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->_redirect('*/*'); + return; } - $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); } else { $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); $this->_redirect('*/*/'); return; } - $dialogName = $this->getRequest()->getParam(self::PARAM_DIALOG_ID); - - if (in_array($dialogName, [self::DIALOG_PERMISSIONS, self::DIALOG_TOKENS])) { - $this->_view->loadLayout($this->_getPopupHandleNames($dialogName)); - } else { - $this->_view->loadLayout(); + /** Add handles of the tabs which are defined in other modules */ + $handleNodes = $this->_view->getLayout()->getUpdate()->getFileLayoutUpdatesXml() + ->xpath('//referenceBlock[@name="integration.activate.permissions.tabs"]/../@id'); + $handles = array(); + if (is_array($handleNodes)) { + foreach ($handleNodes as $node) { + $handles[] = (string)$node; + } } - + $this->_view->loadLayout($handles); $this->_view->renderLayout(); } /** - * @param string $dialogName - * @return array + * Delete the integration. */ - protected function _getPopupHandleNames($dialogName) + public function deleteAction() { - $handles = [sprintf('%s_%s_popup', $this->_view->getDefaultLayoutHandle(), $dialogName)]; - - if ($dialogName === self::DIALOG_PERMISSIONS) { - $handleNodes = $this->_view->getLayout()->getUpdate()->getFileLayoutUpdatesXml() - ->xpath('//referenceBlock[@name="integration.activate.permissions.tabs"]/../@id'); - - if (is_array($handleNodes)) { - foreach ($handleNodes as $node) { - $handles[] = (string)$node; + $integrationId = (int)$this->getRequest()->getParam(self::PARAM_INTEGRATION_ID); + try { + if ($integrationId) { + $integrationData = $this->_integrationService->get($integrationId); + if ($this->_integrationData->isConfigType($integrationData)) { + $this->_getSession()->addError( + __("Uninstall the extension to remove integration '%1'.", $integrationData[Info::DATA_NAME]) + ); + $this->_redirect('*/*/'); + return; } + $integrationData = $this->_integrationService->delete($integrationId); + if (!$integrationData[Info::DATA_ID]) { + $this->_getSession()->addError(__('This integration no longer exists.')); + } else { + //Integration deleted successfully, now safe to delete the associated consumer data + if (isset($integrationData[Info::DATA_CONSUMER_ID])) { + $this->_oauthService->deleteConsumer($integrationData[Info::DATA_CONSUMER_ID]); + } + $this->_registry->register(self::REGISTRY_KEY_CURRENT_INTEGRATION, $integrationData); + $this->_getSession() + ->addSuccess(__("The integration '%1' has been deleted.", $integrationData[Info::DATA_NAME])); + } + } else { + $this->_getSession()->addError(__('Integration ID is not specified or is invalid.')); } + } catch (\Magento\Integration\Exception $e) { + $this->_getSession()->addError($e->getMessage()); + } catch (\Exception $e) { + $this->_logger->logException($e); } + $this->_redirect('*/*/'); + } - return $handles; + /** + * Show tokens popup. + */ + public function tokensDialogAction() + { + try { + $integrationId = $this->getRequest()->getParam('id'); + $integration = $this->_integrationService->get($integrationId); + $this->_oauthService->createAccessToken($integration->getConsumerId()); + $this->_registry->register( + self::REGISTRY_KEY_CURRENT_INTEGRATION, + $this->_integrationService->get($integrationId)->getData() + ); + } catch (\Magento\Core\Exception $e) { + $this->_getSession()->addError($e->getMessage()); + $this->_redirect('*/*'); + return; + } catch (\Exception $e) { + $this->_logger->logException($e); + $this->_getSession()->addError(__('Internal error. Check exception log for details.')); + $this->_redirect('*/*'); + return; + } + $this->_view->loadLayout(false); + $this->_view->renderLayout(); } /** @@ -289,4 +366,23 @@ class Integration extends Action $this->_redirect('*/*/new'); } } + + /** + * Don't actually redirect if we've got AJAX request - return redirect URL instead. + * + * @param string $path + * @param array $arguments + * @return $this|\Magento\Backend\App\AbstractAction + */ + protected function _redirect($path, $arguments = array()) + { + if ($this->getRequest()->isXmlHttpRequest()) { + $this->getResponse()->setBody( + $this->_coreHelper->jsonEncode(['_redirect' => $this->getUrl($path, $arguments)]) + ); + return $this; + } else { + return parent::_redirect($path, $arguments); + } + } } diff --git a/app/code/Magento/Integration/Helper/Data.php b/app/code/Magento/Integration/Helper/Data.php index 7becc725d7d0f350d68cf5f02498874b7f33748e..891756d4af4113ca230ccf3c2edcf08388cdff3b 100644 --- a/app/code/Magento/Integration/Helper/Data.php +++ b/app/code/Magento/Integration/Helper/Data.php @@ -24,6 +24,8 @@ namespace Magento\Integration\Helper; +use Magento\Integration\Model\Integration as IntegrationModel; + class Data extends \Magento\App\Helper\AbstractHelper { /** @@ -48,4 +50,16 @@ class Data extends \Magento\App\Helper\AbstractHelper } return $output; } + + /** + * Check if integration is created using config file + * + * @param $integrationData + * @return bool true if integration is created using Config file + */ + public function isConfigType($integrationData) + { + return isset($integrationData[IntegrationModel::SETUP_TYPE]) + && $integrationData[IntegrationModel::SETUP_TYPE] == IntegrationModel::TYPE_CONFIG; + } } diff --git a/app/code/Magento/Integration/Helper/Oauth/Consumer.php b/app/code/Magento/Integration/Helper/Oauth/Consumer.php deleted file mode 100644 index 70cd70b5516cc99841612ab5dd01315104376c1a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Integration/Helper/Oauth/Consumer.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Integration\Helper\Oauth; - -use \Magento\Oauth\OauthInterface; - -class Consumer -{ - /** @var \Magento\Core\Model\StoreManagerInterface */ - protected $_storeManager; - - /** @var \Magento\Integration\Model\Oauth\Consumer\Factory */ - protected $_consumerFactory; - - /** @var \Magento\Integration\Model\Oauth\Token\Factory */ - protected $_tokenFactory; - - /** @var \Magento\Integration\Helper\Oauth\Data */ - protected $_dataHelper; - - /** @var \Magento\HTTP\ZendClient */ - protected $_httpClient; - - /** @var \Magento\Logger */ - protected $_logger; - - /** - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory - * @param \Magento\Integration\Model\Oauth\Token\Factory $tokenFactory - * @param \Magento\Integration\Helper\Oauth\Data $dataHelper - * @param \Magento\HTTP\ZendClient $httpClient - * @param \Magento\Logger $logger - */ - public function __construct( - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory, - \Magento\Integration\Model\Oauth\Token\Factory $tokenFactory, - \Magento\Integration\Helper\Oauth\Data $dataHelper, - \Magento\HTTP\ZendClient $httpClient, - \Magento\Logger $logger - ) { - $this->_storeManager = $storeManager; - $this->_consumerFactory = $consumerFactory; - $this->_tokenFactory = $tokenFactory; - $this->_dataHelper = $dataHelper; - $this->_httpClient = $httpClient; - $this->_logger = $logger; - } - - /** - * Create a new consumer account when an integration is installed. - * - * @param array $consumerData - Information provided by an integration when the integration is installed. - * <pre> - * array( - * 'name' => 'Integration Name', - * 'key' => 'a6aa81cc3e65e2960a4879392445e718', - * 'secret' => 'b7bb92dd4f76f3a71b598a4a3556f829' - * ) - * </pre> - * @return array - The integration (consumer) data. - * @throws \Magento\Core\Exception - * @throws \Magento\Oauth\Exception - */ - public function createConsumer($consumerData) - { - try { - $consumer = $this->_consumerFactory->create($consumerData); - $consumer->save(); - return $consumer->getData(); - } catch (\Magento\Core\Exception $exception) { - throw $exception; - } catch (\Exception $exception) { - throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to create OAuth Consumer account.')); - } - } - - /** - * Execute post to integration (consumer) HTTP Post URL. Generate and return oauth_verifier. - * - * @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\Oauth\Exception - */ - public function postToConsumer($consumerId, $endpointUrl) - { - try { - $consumer = $this->_consumerFactory->create()->load($consumerId); - if (!$consumer->getId()) { - throw new \Magento\Oauth\Exception( - __('A consumer with ID %1 does not exist', $consumerId), OauthInterface::ERR_PARAMETER_REJECTED); - } - $consumerData = $consumer->getData(); - $verifier = $this->_tokenFactory->create()->createVerifierToken($consumerId); - $storeBaseUrl = $this->_storeManager->getStore()->getBaseUrl(); - $this->_httpClient->setUri($endpointUrl); - $this->_httpClient->setParameterPost( - array( - 'oauth_consumer_key' => $consumerData['key'], - 'oauth_consumer_secret' => $consumerData['secret'], - 'store_base_url' => $storeBaseUrl, - 'oauth_verifier' => $verifier->getVerifier() - ) - ); - $maxredirects = $this->_dataHelper->getConsumerPostMaxRedirects(); - $timeout = $this->_dataHelper->getConsumerPostTimeout(); - $this->_httpClient->setConfig(array('maxredirects' => $maxredirects, 'timeout' => $timeout)); - $this->_httpClient->request(\Magento\HTTP\ZendClient::POST); - return $verifier->getVerifier(); - } catch (\Magento\Core\Exception $exception) { - throw $exception; - } catch (\Magento\Oauth\Exception $exception) { - throw $exception; - } catch (\Exception $exception) { - $this->_logger->logException($exception); - throw new \Magento\Oauth\Exception(__('Unable to post data to consumer due to an unexpected error')); - } - } -} diff --git a/app/code/Magento/Integration/Model/Config/Reader.php b/app/code/Magento/Integration/Model/Config/Reader.php index 4fd412169b732a671f5edae68d0447b5f9ddb3c4..fd252136de43f8ac19a1a7e05173a19131920450 100644 --- a/app/code/Magento/Integration/Model/Config/Reader.php +++ b/app/code/Magento/Integration/Model/Config/Reader.php @@ -39,18 +39,33 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Integration\Model\Config\Converter $converter - * @param \Magento\Integration\Model\Config\SchemaLocator $schemeLocator + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Integration\Model\Config\Converter $converter, - \Magento\Integration\Model\Config\SchemaLocator $schemeLocator, + \Magento\Integration\Model\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - $fileName = 'integration\config.xml' + $fileName = 'integration\config.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - parent::__construct($fileResolver, $converter, $schemeLocator, $validationState, $fileName); + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope + ); } } diff --git a/app/code/Magento/Integration/Model/Integration.php b/app/code/Magento/Integration/Model/Integration.php index 1822d2e11ef35929e8000c94be2b9197fa837810..0659bb4679586b9b01f09083d286e4795592e99c 100644 --- a/app/code/Magento/Integration/Model/Integration.php +++ b/app/code/Magento/Integration/Model/Integration.php @@ -36,6 +36,8 @@ namespace Magento\Integration\Model; * @method \int getType() * @method Integration setType(\int $value) * @method \string getEndpoint() + * @method Integration setConsumerId(\string $consumerId) + * @method \string getConsumerId() * @method Integration setEndpoint(\string $endpoint) * @method \string getCreatedAt() * @method Integration setCreatedAt(\string $createdAt) @@ -66,6 +68,7 @@ class Integration extends \Magento\Core\Model\AbstractModel const EMAIL = 'email'; const ENDPOINT = 'endpoint'; const SETUP_TYPE = 'setup_type'; + const CONSUMER_ID = 'consumer_id'; /**#@-*/ /** @@ -107,7 +110,7 @@ class Integration extends \Magento\Core\Model\AbstractModel /** * Prepare data to be saved to database * - * @return \Magento\Integration\Model\Integration + * @return Integration */ protected function _beforeSave() { @@ -118,4 +121,15 @@ class Integration extends \Magento\Core\Model\AbstractModel $this->setUpdatedAt($this->_dateTime->formatDate(true)); return $this; } + + /** + * Load integration by oAuth consumer ID. + * + * @param int $consumerId + * @return Integration + */ + public function loadByConsumerId($consumerId) + { + return $this->load($consumerId, self::CONSUMER_ID); + } } diff --git a/app/code/Magento/Integration/Model/Manager.php b/app/code/Magento/Integration/Model/Manager.php index b19c32335d48502e202b63630a59200255738258..50f3e9152524b991af2fafb2874d2a43370c1dd2 100644 --- a/app/code/Magento/Integration/Model/Manager.php +++ b/app/code/Magento/Integration/Model/Manager.php @@ -84,11 +84,11 @@ class Manager } $integrationData[Integration::SETUP_TYPE] = Integration::TYPE_CONFIG; // If it already exists, update it - $data = $this->_integrationService->findByName($name); - if (isset($data[Integration::ID])) { + $integration = $this->_integrationService->findByName($name); + if ($integration->getId()) { //If Integration already exists, update it. //For now we will just overwrite the integration with same name but we will need a long term solution - $integrationData[Integration::ID] = $data[Integration::ID]; + $integrationData[Integration::ID] = $integration->getId(); $this->_integrationService->update($integrationData); } else { $this->_integrationService->create($integrationData); @@ -97,4 +97,4 @@ class Manager } return $integrationNames; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Integration/Model/Oauth/Token.php b/app/code/Magento/Integration/Model/Oauth/Token.php index f5bf1f69515590b6b01dbef6b917102977666785..22117849efb7a7dd8f3b09fa5a9e6a883e37101d 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token.php +++ b/app/code/Magento/Integration/Model/Oauth/Token.php @@ -24,34 +24,38 @@ namespace Magento\Integration\Model\Oauth; +use Magento\Oauth\Helper\Oauth as OauthHelper; +use Magento\Integration\Model\Resource\Oauth\Token\Collection as TokenCollection; +use Magento\Oauth\Exception as OauthException; + /** * oAuth token model * * @method string getName() Consumer name (joined from consumer table) - * @method \Magento\Integration\Model\Resource\Oauth\Token\Collection getCollection() - * @method \Magento\Integration\Model\Resource\Oauth\Token\Collection getResourceCollection() + * @method TokenCollection getCollection() + * @method TokenCollection getResourceCollection() * @method \Magento\Integration\Model\Resource\Oauth\Token getResource() * @method \Magento\Integration\Model\Resource\Oauth\Token _getResource() * @method int getConsumerId() - * @method \Magento\Integration\Model\Oauth\Token setConsumerId() setConsumerId(int $consumerId) + * @method Token setConsumerId() setConsumerId(int $consumerId) * @method int getAdminId() - * @method \Magento\Integration\Model\Oauth\Token setAdminId() setAdminId(int $adminId) + * @method Token setAdminId() setAdminId(int $adminId) * @method int getCustomerId() - * @method \Magento\Integration\Model\Oauth\Token setCustomerId() setCustomerId(int $customerId) + * @method Token setCustomerId() setCustomerId(int $customerId) * @method string getType() - * @method \Magento\Integration\Model\Oauth\Token setType() setType(string $type) + * @method Token setType() setType(string $type) * @method string getCallbackUrl() - * @method \Magento\Integration\Model\Oauth\Token setCallbackUrl() setCallbackUrl(string $callbackUrl) + * @method Token setCallbackUrl() setCallbackUrl(string $callbackUrl) * @method string getCreatedAt() - * @method \Magento\Integration\Model\Oauth\Token setCreatedAt() setCreatedAt(string $createdAt) + * @method Token setCreatedAt() setCreatedAt(string $createdAt) * @method string getToken() - * @method \Magento\Integration\Model\Oauth\Token setToken() setToken(string $token) + * @method Token setToken() setToken(string $token) * @method string getSecret() - * @method \Magento\Integration\Model\Oauth\Token setSecret() setSecret(string $tokenSecret) + * @method Token setSecret() setSecret(string $tokenSecret) * @method int getRevoked() - * @method \Magento\Integration\Model\Oauth\Token setRevoked() setRevoked(int $revoked) + * @method Token setRevoked() setRevoked(int $revoked) * @method int getAuthorized() - * @method \Magento\Integration\Model\Oauth\Token setAuthorized() setAuthorized(int $authorized) + * @method Token setAuthorized() setAuthorized(int $authorized) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Token extends \Magento\Core\Model\AbstractModel @@ -71,7 +75,7 @@ class Token extends \Magento\Core\Model\AbstractModel const USER_TYPE_CUSTOMER = 'customer'; /**#@- */ - /** @var \Magento\Oauth\Helper\Oauth */ + /** @var OauthHelper */ protected $_oauthHelper; /** @var \Magento\Integration\Helper\Oauth\Data */ @@ -97,7 +101,7 @@ class Token extends \Magento\Core\Model\AbstractModel * @param \Magento\Stdlib\DateTime $dateTime * @param \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory * @param \Magento\Integration\Helper\Oauth\Data $oauthData - * @param \Magento\Oauth\Helper\Oauth $oauthHelper + * @param OauthHelper $oauthHelper * @param \Magento\Core\Model\Resource\AbstractResource $resource * @param \Magento\Data\Collection\Db $resourceCollection * @param array $data @@ -112,7 +116,7 @@ class Token extends \Magento\Core\Model\AbstractModel \Magento\Stdlib\DateTime $dateTime, \Magento\Integration\Model\Oauth\Consumer\Factory $consumerFactory, \Magento\Integration\Helper\Oauth\Data $oauthData, - \Magento\Oauth\Helper\Oauth $oauthHelper, + OauthHelper $oauthHelper, \Magento\Core\Model\Resource\AbstractResource $resource = null, \Magento\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -139,7 +143,7 @@ class Token extends \Magento\Core\Model\AbstractModel /** * "After save" actions * - * @return \Magento\Integration\Model\Oauth\Token + * @return Token */ protected function _afterSave() { @@ -156,7 +160,7 @@ class Token extends \Magento\Core\Model\AbstractModel * Generate an oauth_verifier for a consumer, if the consumer doesn't already have one. * * @param int $consumerId - The id of the consumer associated with the verifier to be generated. - * @return \Magento\Integration\Model\Oauth\Token + * @return Token */ public function createVerifierToken($consumerId) { @@ -169,7 +173,7 @@ class Token extends \Magento\Core\Model\AbstractModel 'token' => $this->_oauthHelper->generateToken(), 'secret' => $this->_oauthHelper->generateTokenSecret(), 'verifier' => $this->_oauthHelper->generateVerifier(), - 'callback_url' => \Magento\Oauth\Helper\Oauth::CALLBACK_ESTABLISHED + 'callback_url' => OauthHelper::CALLBACK_ESTABLISHED )); $this->save(); } @@ -181,23 +185,23 @@ class Token extends \Magento\Core\Model\AbstractModel * * @param int $userId Authorization user identifier * @param string $userType Authorization user type - * @return \Magento\Integration\Model\Oauth\Token - * @throws \Magento\Oauth\Exception + * @return Token + * @throws OauthException */ public function authorize($userId, $userType) { if (!$this->getId() || !$this->getConsumerId()) { - throw new \Magento\Oauth\Exception(__('Token is not ready to be authorized')); + throw new OauthException(__('Token is not ready to be authorized')); } if ($this->getAuthorized()) { - throw new \Magento\Oauth\Exception(__('Token is already authorized')); + throw new OauthException(__('Token is already authorized')); } if (self::USER_TYPE_ADMIN == $userType) { $this->setAdminId($userId); } elseif (self::USER_TYPE_CUSTOMER == $userType) { $this->setCustomerId($userId); } else { - throw new \Magento\Oauth\Exception(__('User type is unknown')); + throw new OauthException(__('User type is unknown')); } $this->setVerifier($this->_oauthHelper->generateVerifier()); @@ -212,13 +216,13 @@ class Token extends \Magento\Core\Model\AbstractModel /** * Convert token to access type * - * @return \Magento\Integration\Model\Oauth\Token - * @throws \Magento\Oauth\Exception + * @return Token + * @throws OauthException */ public function convertToAccess() { if (self::TYPE_REQUEST != $this->getType()) { - throw new \Magento\Oauth\Exception(__('Cannot convert to access token due to token is not request type')); + throw new OauthException(__('Cannot convert to access token due to token is not request type')); } $this->setType(self::TYPE_ACCESS); @@ -234,10 +238,11 @@ class Token extends \Magento\Core\Model\AbstractModel * * @param int $entityId Token identifier * @param string $callbackUrl Callback URL - * @return \Magento\Integration\Model\Oauth\Token + * @return Token */ public function createRequestToken($entityId, $callbackUrl) { + $callbackUrl = !empty($callbackUrl) ? $callbackUrl : OauthHelper::CALLBACK_ESTABLISHED; $this->setData(array( 'entity_id' => $entityId, 'type' => self::TYPE_REQUEST, @@ -254,7 +259,7 @@ class Token extends \Magento\Core\Model\AbstractModel * Get OAuth user type * * @return string - * @throws \Magento\Oauth\Exception + * @throws OauthException */ public function getUserType() { @@ -263,7 +268,7 @@ class Token extends \Magento\Core\Model\AbstractModel } elseif ($this->getCustomerId()) { return self::USER_TYPE_CUSTOMER; } else { - throw new \Magento\Oauth\Exception(__('User type is unknown')); + throw new OauthException(__('User type is unknown')); } } @@ -299,39 +304,39 @@ class Token extends \Magento\Core\Model\AbstractModel * Validate data * * @return array|bool - * @throws \Magento\Oauth\Exception Throw exception on fail validation + * @throws OauthException Throw exception on fail validation */ public function validate() { - if (\Magento\Oauth\Helper\Oauth::CALLBACK_ESTABLISHED != $this->getCallbackUrl() + if (OauthHelper::CALLBACK_ESTABLISHED != $this->getCallbackUrl() && !$this->_urlValidator->isValid($this->getCallbackUrl()) ) { $messages = $this->_urlValidator->getMessages(); - throw new \Magento\Oauth\Exception(array_shift($messages)); + throw new OauthException(array_shift($messages)); } /** @var $validatorLength \Magento\Integration\Model\Oauth\Consumer\Validator\KeyLength */ $validatorLength = $this->_keyLengthFactory->create(); - $validatorLength->setLength(\Magento\Oauth\Helper\Oauth::LENGTH_TOKEN_SECRET); + $validatorLength->setLength(OauthHelper::LENGTH_TOKEN_SECRET); $validatorLength->setName('Token Secret Key'); if (!$validatorLength->isValid($this->getSecret())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Oauth\Exception(array_shift($messages)); + throw new OauthException(array_shift($messages)); } - $validatorLength->setLength(\Magento\Oauth\Helper\Oauth::LENGTH_TOKEN); + $validatorLength->setLength(OauthHelper::LENGTH_TOKEN); $validatorLength->setName('Token Key'); if (!$validatorLength->isValid($this->getToken())) { $messages = $validatorLength->getMessages(); - throw new \Magento\Oauth\Exception(array_shift($messages)); + throw new OauthException(array_shift($messages)); } if (null !== ($verifier = $this->getVerifier())) { - $validatorLength->setLength(\Magento\Oauth\Helper\Oauth::LENGTH_TOKEN_VERIFIER); + $validatorLength->setLength(OauthHelper::LENGTH_TOKEN_VERIFIER); $validatorLength->setName('Verifier Key'); if (!$validatorLength->isValid($verifier)) { $messages = $validatorLength->getMessages(); - throw new \Magento\Oauth\Exception(array_shift($messages)); + throw new OauthException(array_shift($messages)); } } return true; @@ -366,7 +371,7 @@ class Token extends \Magento\Core\Model\AbstractModel * Set the token's verifier. * * @param string $verifier - * @return \Magento\Integration\Model\Oauth\Token + * @return Token */ public function setVerifier($verifier) { diff --git a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php index c493b8542177bb874f9e4f99696fd0efbbe304d6..cb4aa771276c40bf17a6f6ed8db2bf25ff545ffc 100644 --- a/app/code/Magento/Integration/Model/Oauth/Token/Provider.php +++ b/app/code/Magento/Integration/Model/Oauth/Token/Provider.php @@ -79,7 +79,7 @@ class Provider implements TokenProviderInterface */ public function createRequestToken($consumer) { - $token = $this->_getTokenByConsumer($consumer->getId()); + $token = $this->getTokenByConsumerId($consumer->getId()); if ($token->getType() != \Magento\Integration\Model\Oauth\Token::TYPE_VERIFIER) { throw new \Magento\Oauth\Exception( __('Cannot create request token because consumer token is not a verifier token'), @@ -119,7 +119,7 @@ class Provider implements TokenProviderInterface public function getAccessToken($consumer) { /** TODO: log the request token in dev mode since its not persisted. */ - $token = $this->_getTokenByConsumer($consumer->getId()); + $token = $this->getTokenByConsumerId($consumer->getId()); if (\Magento\Integration\Model\Oauth\Token::TYPE_REQUEST != $token->getType()) { throw new \Magento\Oauth\Exception( __('Cannot get access token because consumer token is not a request token')); @@ -168,7 +168,7 @@ class Provider implements TokenProviderInterface __('Access token has been revoked'), OauthInterface::ERR_TOKEN_REVOKED); } - return true; + return $token->getConsumerId(); } /** @@ -271,7 +271,7 @@ class Provider implements TokenProviderInterface * @return \Magento\Integration\Model\Oauth\Token * @throws \Magento\Oauth\Exception */ - protected function _getTokenByConsumer($consumerId) + public function getTokenByConsumerId($consumerId) { $token = $this->_tokenFactory->create()->load($consumerId, 'consumer_id'); diff --git a/app/code/Magento/Integration/Service/IntegrationV1.php b/app/code/Magento/Integration/Service/IntegrationV1.php index 49d3f16b533c6b8f12bbaf65020a0000115cc1ff..91a8b838b8e88932cc9d7b2d254e43b5118ec8d0 100644 --- a/app/code/Magento/Integration/Service/IntegrationV1.php +++ b/app/code/Magento/Integration/Service/IntegrationV1.php @@ -21,13 +21,12 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Service; -use Magento\Authz\Model\UserIdentifier; -use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationInterface; use Magento\Integration\Model\Integration\Factory as IntegrationFactory; -use Magento\Authz\Model\UserIdentifier\Factory as UserIdentifierFactory; use Magento\Integration\Model\Integration as IntegrationModel; +use Magento\Integration\Service\OauthV1Interface as IntegrationOauthService; /** * Integration Service. @@ -39,27 +38,21 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa /** @var IntegrationFactory */ protected $_integrationFactory; - /** @var AuthorizationInterface */ - protected $_authzService; - - /** @var UserIdentifierFactory */ - protected $_userIdentifierFactory; + /** @var IntegrationOauthService */ + protected $_oauthService; /** * Construct and initialize Integration Factory * * @param IntegrationFactory $integrationFactory - * @param AuthorizationInterface $authzService - * @param UserIdentifierFactory $userIdentifierFactory + * @param IntegrationOauthService $oauthService */ public function __construct( IntegrationFactory $integrationFactory, - AuthorizationInterface $authzService, - UserIdentifierFactory $userIdentifierFactory + IntegrationOauthService $oauthService ) { $this->_integrationFactory = $integrationFactory; - $this->_authzService = $authzService; - $this->_userIdentifierFactory = $userIdentifierFactory; + $this->_oauthService = $oauthService; } /** @@ -69,9 +62,13 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa { $this->_checkIntegrationByName($integrationData['name']); $integration = $this->_integrationFactory->create($integrationData); + // TODO: Think about double save issue $integration->save(); - $this->_saveApiPermissions($integration); - return $integration->getData(); + $consumerName = 'Integration' . $integration->getId(); + $consumer = $this->_oauthService->createConsumer(array('name' => $consumerName)); + $integration->setConsumerId($consumer->getId()); + $integration->save(); + return $integration; } /** @@ -86,8 +83,18 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa } $integration->addData($integrationData); $integration->save(); - $this->_saveApiPermissions($integration); - return $integration->getData(); + return $integration; + } + + /** + * {@inheritdoc} + */ + public function delete($integrationId) + { + $integration = $this->_loadIntegrationById($integrationId); + $data = $integration->getData(); + $integration->delete(); + return $data; } /** @@ -96,8 +103,9 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa public function get($integrationId) { $integration = $this->_loadIntegrationById($integrationId); - $this->_addAllowedResources($integration); - return $integration->getData(); + $this->_addOauthConsumerData($integration); + $this->_addOauthTokenData($integration); + return $integration; } /** @@ -105,14 +113,10 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa */ public function findByName($name) { - if (!isset($name) || trim($name) === '') { - return null; - } $integration = $this->_integrationFactory->create()->load($name, 'name'); - return $integration->getData(); + return $integration; } - /** * Check if an integration exists by the name * @@ -138,58 +142,38 @@ class IntegrationV1 implements \Magento\Integration\Service\IntegrationV1Interfa { $integration = $this->_integrationFactory->create()->load($integrationId); if (!$integration->getId()) { - throw new \Magento\Integration\Exception(__("Integration with ID '%1' doesn't exist.", $integrationId)); + throw new \Magento\Integration\Exception(__("Integration with ID '%1' does not exist.", $integrationId)); } return $integration; } /** - * Persist API permissions. - * - * Permissions are expected to be set to integration object by 'resource' key. - * If 'all_resources' is set and is evaluated to true, permissions to all resources will be granted. + * Add oAuth consumer key and secret. * * @param IntegrationModel $integration */ - protected function _saveApiPermissions(IntegrationModel $integration) + protected function _addOauthConsumerData(IntegrationModel $integration) { if ($integration->getId()) { - $userIdentifier = $this->_createUserIdentifier($integration->getId()); - if ($integration->getData('all_resources')) { - $this->_authzService->grantAllPermissions($userIdentifier); - } else if (is_array($integration->getData('resource'))) { - $this->_authzService->grantPermissions($userIdentifier, $integration->getData('resource')); - } else { - $this->_authzService->grantPermissions($userIdentifier, array()); - } + $consumer = $this->_oauthService->loadConsumer($integration->getConsumerId()); + $integration->setData('consumer_key', $consumer->getKey()); + $integration->setData('consumer_secret', $consumer->getSecret()); } } /** - * Add the list of allowed resources to the integration object data by 'resource' key. + * Add oAuth token and token secret. * * @param IntegrationModel $integration */ - protected function _addAllowedResources(IntegrationModel $integration) + protected function _addOauthTokenData(IntegrationModel $integration) { if ($integration->getId()) { - $userIdentifier = $this->_createUserIdentifier($integration->getId()); - $integration->setData('resource', $this->_authzService->getAllowedResources($userIdentifier)); + $accessToken = $this->_oauthService->getAccessToken($integration->getConsumerId()); + if ($accessToken) { + $integration->setData('token', $accessToken->getToken()); + $integration->setData('token_secret', $accessToken->getSecret()); + } } } - - /** - * Instantiate new user identifier for an integration. - * - * @param int $integrationId - * @return UserIdentifier - */ - protected function _createUserIdentifier($integrationId) - { - $userIdentifier = $this->_userIdentifierFactory->create( - UserIdentifier::USER_TYPE_INTEGRATION, - (int)$integrationId - ); - return $userIdentifier; - } } diff --git a/app/code/Magento/Integration/Service/IntegrationV1Interface.php b/app/code/Magento/Integration/Service/IntegrationV1Interface.php index 75a8b4e6bd56e8fbbbcec66aa2bcaf5a14eac94b..d5c47a0d47a65cb2674588d27145d2ea251b7669 100644 --- a/app/code/Magento/Integration/Service/IntegrationV1Interface.php +++ b/app/code/Magento/Integration/Service/IntegrationV1Interface.php @@ -21,19 +21,21 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Service; +use \Magento\Integration\Model\Integration as IntegrationModel; + /** * Integration Service Interface */ interface IntegrationV1Interface { - /** * Create a new Integration * * @param array $integrationData - * @return array Integration data + * @return IntegrationModel * @throws \Magento\Integration\Exception */ public function create(array $integrationData); @@ -42,7 +44,7 @@ interface IntegrationV1Interface * Get the details of a specific Integration. * * @param int $integrationId - * @return array Integration data + * @return IntegrationModel * @throws \Magento\Integration\Exception */ public function get($integrationId); @@ -50,20 +52,26 @@ interface IntegrationV1Interface /** * Find Integration by name. * - * @param int $integrationName + * @param string $integrationName * @return array|null Integration data or null if not found - * @throws \Magento\Integration\Exception */ public function findByName($integrationName); - /** - * Update a Integration. + * Update an Integration. * * @param array $integrationData - * @return array Integration data + * @return IntegrationModel * @throws \Magento\Integration\Exception */ public function update(array $integrationData); + /** + * Delete an Integration. + * + * @param int $integrationId + * @return array Integration data + * @throws \Magento\Integration\Exception if the integration does not exist or cannot be deleted + */ + public function delete($integrationId); } diff --git a/app/code/Magento/Integration/Service/OauthV1.php b/app/code/Magento/Integration/Service/OauthV1.php new file mode 100644 index 0000000000000000000000000000000000000000..a4e8d7ec2db8d6ba541dfd2ba38b31f3d1ec0e29 --- /dev/null +++ b/app/code/Magento/Integration/Service/OauthV1.php @@ -0,0 +1,234 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Service; + +use Magento\Oauth\OauthInterface; +use Magento\Integration\Model\Oauth\Token\Provider as TokenProvider; +use Magento\Integration\Model\Oauth\Token as Token; +use Magento\Integration\Model\Oauth\Token\Factory as TokenFactory; +use Magento\Integration\Helper\Oauth\Data as IntegrationOauthHelper; +use Magento\Oauth\Helper\Oauth as OauthHelper; +use Magento\Integration\Model\Oauth\Consumer\Factory as ConsumerFactory; +use Magento\Integration\Model\Oauth\Consumer as ConsumerModel; + +/** + * Integration oAuth service. + * + * TODO: Fix coupling between objects + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ +class OauthV1 implements OauthV1Interface +{ + /** @var \Magento\Core\Model\StoreManagerInterface */ + protected $_storeManager; + + /** @var ConsumerFactory */ + protected $_consumerFactory; + + /** @var TokenFactory */ + protected $_tokenFactory; + + /** @var IntegrationOauthHelper */ + protected $_dataHelper; + + /** @var \Magento\HTTP\ZendClient */ + protected $_httpClient; + + /** @var \Magento\Logger */ + protected $_logger; + + /** @var OauthHelper */ + protected $_oauthHelper; + + /** @var TokenProvider */ + protected $_tokenProvider; + + /** + * Initialize dependencies. + * + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param ConsumerFactory $consumerFactory + * @param TokenFactory $tokenFactory + * @param IntegrationOauthHelper $dataHelper + * @param \Magento\HTTP\ZendClient $httpClient + * @param \Magento\Logger $logger + * @param OauthHelper $oauthHelper + * @param TokenProvider $tokenProvider + */ + public function __construct( + \Magento\Core\Model\StoreManagerInterface $storeManager, + ConsumerFactory $consumerFactory, + TokenFactory $tokenFactory, + IntegrationOauthHelper $dataHelper, + \Magento\HTTP\ZendClient $httpClient, + \Magento\Logger $logger, + OauthHelper $oauthHelper, + TokenProvider $tokenProvider + ) { + $this->_storeManager = $storeManager; + $this->_consumerFactory = $consumerFactory; + $this->_tokenFactory = $tokenFactory; + $this->_dataHelper = $dataHelper; + $this->_httpClient = $httpClient; + $this->_logger = $logger; + $this->_oauthHelper = $oauthHelper; + $this->_tokenProvider = $tokenProvider; + } + + /** + * {@inheritdoc} + */ + public function createConsumer($consumerData) + { + try { + $consumerData['key'] = $this->_oauthHelper->generateConsumerKey(); + $consumerData['secret'] = $this->_oauthHelper->generateConsumerSecret(); + $consumer = $this->_consumerFactory->create($consumerData); + $consumer->save(); + return $consumer; + } catch (\Magento\Core\Exception $exception) { + throw $exception; + } catch (\Exception $exception) { + throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to create oAuth consumer account.')); + } + } + + /** + * {@inheritdoc} + */ + public function createAccessToken($consumerId) + { + // TODO: This implementation is temporary and should be changed after requirements clarification + try { + $consumer = $this->_consumerFactory->create()->load($consumerId); + $existingToken = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + } catch (\Exception $e) { + } + if (!isset($existingToken)) { + $consumer = $this->_consumerFactory->create()->load($consumerId); + $this->_tokenFactory->create()->createVerifierToken($consumerId); + $this->_tokenProvider->createRequestToken($consumer); + $this->_tokenProvider->getAccessToken($consumer); + return true; + } + return false; + } + + /** + * {@inheritdoc} + */ + public function getAccessToken($consumerId) + { + try { + $consumer = $this->_consumerFactory->create()->load($consumerId); + $token = $this->_tokenProvider->getTokenByConsumerId($consumer->getId()); + if ($token->getType() != Token::TYPE_ACCESS) { + return false; + } + } catch (\Exception $e) { + return false; + } + return $token; + } + + /** + * {@inheritdoc} + */ + public function loadConsumer($consumerId) + { + try { + return $this->_consumerFactory->create()->load($consumerId); + } catch (\Magento\Core\Exception $exception) { + throw $exception; + } catch (\Exception $exception) { + throw new \Magento\Oauth\Exception(__('Unexpected error. Unable to load oAuth consumer account.')); + } + } + + /** + * {@inheritdoc} + */ + public function postToConsumer($consumerId, $endpointUrl) + { + try { + $consumer = $this->_consumerFactory->create()->load($consumerId); + if (!$consumer->getId()) { + throw new \Magento\Oauth\Exception( + __('A consumer with ID %1 does not exist', $consumerId), OauthInterface::ERR_PARAMETER_REJECTED); + } + $consumerData = $consumer->getData(); + $verifier = $this->_tokenFactory->create()->createVerifierToken($consumerId); + $storeBaseUrl = $this->_storeManager->getStore()->getBaseUrl(); + $this->_httpClient->setUri($endpointUrl); + $this->_httpClient->setParameterPost( + array( + 'oauth_consumer_key' => $consumerData['key'], + 'oauth_consumer_secret' => $consumerData['secret'], + 'store_base_url' => $storeBaseUrl, + 'oauth_verifier' => $verifier->getVerifier() + ) + ); + $maxredirects = $this->_dataHelper->getConsumerPostMaxRedirects(); + $timeout = $this->_dataHelper->getConsumerPostTimeout(); + $this->_httpClient->setConfig(array('maxredirects' => $maxredirects, 'timeout' => $timeout)); + $this->_httpClient->request(\Magento\HTTP\ZendClient::POST); + return $verifier->getVerifier(); + } catch (\Magento\Core\Exception $exception) { + throw $exception; + } catch (\Magento\Oauth\Exception $exception) { + throw $exception; + } catch (\Exception $exception) { + $this->_logger->logException($exception); + throw new \Magento\Oauth\Exception(__('Unable to post data to consumer due to an unexpected error')); + } + } + + /** + * {@inheritdoc} + */ + public function deleteConsumer($consumerId) + { + $consumer = $this->_loadConsumerById($consumerId); + $data = $consumer->getData(); + $consumer->delete(); + return $data; + } + + /** + * Load consumer by id. + * + * @param int $consumerId + * @return ConsumerModel + * @throws \Magento\Integration\Exception + */ + protected function _loadConsumerById($consumerId) + { + $consumer = $this->_consumerFactory->create()->load($consumerId); + if (!$consumer->getId()) { + throw new \Magento\Integration\Exception(__("Consumer with ID '%1' does not exist.", $consumerId)); + } + return $consumer; + } +} diff --git a/app/code/Magento/Integration/Service/OauthV1Interface.php b/app/code/Magento/Integration/Service/OauthV1Interface.php new file mode 100644 index 0000000000000000000000000000000000000000..4f1593d2d1d617de24156b53628518381193c8f6 --- /dev/null +++ b/app/code/Magento/Integration/Service/OauthV1Interface.php @@ -0,0 +1,94 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Service; + +use \Magento\Integration\Model\Oauth\Token as Token; + +/** + * Integration oAuth Service Interface + */ +interface OauthV1Interface +{ + /** + * Create a new consumer account. + * + * @param array $consumerData - Information provided by an integration when the integration is installed. + * <pre> + * array( + * 'name' => 'Integration Name', + * '...' => '...', // Other consumer data can be passed as well + * ) + * </pre> + * @return \Magento\Integration\Model\Oauth\Consumer + * @throws \Magento\Core\Exception + * @throws \Magento\Oauth\Exception + */ + public function createConsumer($consumerData); + + /** + * Create access token for provided consumer. + * + * @param int $consumerId + * @return bool If token was created + */ + public function createAccessToken($consumerId); + + /** + * Retrieve access token assigned to the consumer. + * + * @param int $consumerId + * @return Token|bool Return false if no access token is available. + */ + public function getAccessToken($consumerId); + + /** + * Load consumer by its ID. + * + * @param int $consumerId + * @return \Magento\Integration\Model\Oauth\Consumer + * @throws \Magento\Oauth\Exception + * @throws \Magento\Core\Exception + */ + public function loadConsumer($consumerId); + + /** + * Execute post to integration (consumer) HTTP Post URL. Generate and return oauth_verifier. + * + * @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\Oauth\Exception + */ + public function postToConsumer($consumerId, $endpointUrl); + + /** + * Delete the consumer data associated with the integration including its token and nonce + * + * @param int $consumerId + * @return array Consumer data array + */ + public function deleteConsumer($consumerId); +} diff --git a/app/code/Magento/Integration/etc/cache.xml b/app/code/Magento/Integration/etc/cache.xml index a2d8b29b6a6130836c8d959bda31f473cf0810e1..40469997ae8a08279dd6f556c5bdcec509b675a5 100644 --- a/app/code/Magento/Integration/etc/cache.xml +++ b/app/code/Magento/Integration/etc/cache.xml @@ -24,7 +24,7 @@ */ --> <config> - <type name="config_integration" translate="label,description" instance="Magento\Webapi\Model\Cache\Type"> + <type name="config_integration" translate="label,description" instance="Magento\Integration\Model\Cache\Type"> <label>Integrations Configuration</label> <description>Integration configuration file.</description> </type> diff --git a/app/code/Magento/Integration/etc/di.xml b/app/code/Magento/Integration/etc/di.xml index 15c3df5d0ffc507701a707f804a979a1ac81842c..88e74ce49e8d1b2f685ec590ebfe19cce09a1a85 100644 --- a/app/code/Magento/Integration/etc/di.xml +++ b/app/code/Magento/Integration/etc/di.xml @@ -25,6 +25,7 @@ --> <config> <preference for="Magento\Integration\Service\IntegrationV1Interface" type="Magento\Integration\Service\IntegrationV1" /> + <preference for="Magento\Integration\Service\OauthV1Interface" type="Magento\Integration\Service\OauthV1" /> <preference for="Magento\Oauth\ConsumerInterface" type="Magento\Integration\Model\Oauth\Consumer"/> <preference for="Magento\Oauth\NonceGeneratorInterface" type="Magento\Integration\Model\Oauth\Nonce\Generator"/> <preference for="Magento\Oauth\TokenProviderInterface" type="Magento\Integration\Model\Oauth\Token\Provider"/> diff --git a/app/code/Magento/Integration/view/adminhtml/integration.css b/app/code/Magento/Integration/view/adminhtml/integration.css index f303d5503fb1c7bf844168dc1db2ed186bb6b230..bd8e90ef861a680f9bd9a774f7502553c8fbf2ab 100644 --- a/app/code/Magento/Integration/view/adminhtml/integration.css +++ b/app/code/Magento/Integration/view/adminhtml/integration.css @@ -68,6 +68,10 @@ content: '\e05b'; } +#integrationGrid_table .action.info:before { + content: '\e07e'; /* TOFIX: Need to get the proper character code */ +} + #integrationGrid_table .action.delete:before { content: '\e07f'; } @@ -86,6 +90,10 @@ text-align: right; } +.no-close .ui-dialog-titlebar-close { + display: none; +} + #integration_token_base_fieldset input[readonly] { cursor: copy; } diff --git a/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml b/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml index 59fc19b33e69057bb903020af5b58ef4389e41bc..d4696852e62eba9bde04256e2a928230210d51d6 100644 --- a/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml +++ b/app/code/Magento/Integration/view/adminhtml/integration/popup_container.phtml @@ -28,10 +28,13 @@ ?> <script type="text/javascript"> window.integration = new Integration( - '<?php echo $this->getUrl('*/*/activate', ['id' => ':id', '_query' => 'popup_dialog=permissions']); ?>', - '<?php echo $this->getUrl('*/*/activate', ['id' => ':id', '_query' => 'popup_dialog=tokens']); ?>', + '<?php echo $this->getUrl('*/*/permissionsDialog', ['id' => ':id']); ?>', + '<?php echo $this->getUrl('*/*/tokensDialog', ['id' => ':id']); ?>', '', // Not implemented '' // Not implemented ); </script> <div id="integration-popup-container" style="display:none;"></div> +<div id="integration-delete-container" style="display:none;" title="<?php echo __('Are you sure ?'); ?>"> + <p><?php echo __("Are you sure you want to delete this integration? You can't undo this action."); ?></p> +</div> diff --git a/app/code/Magento/Integration/view/adminhtml/js/integration.js b/app/code/Magento/Integration/view/adminhtml/js/integration.js index 6e4e805e34f28e23f68372f7d9df3d47e032211c..e67ff6f9db41a8b7435b61312afc7ced5a3fe029 100644 --- a/app/code/Magento/Integration/view/adminhtml/js/integration.js +++ b/app/code/Magento/Integration/view/adminhtml/js/integration.js @@ -24,6 +24,80 @@ /*global FORM_KEY*/ /*global integration*/ (function($, window) { + "use strict"; + $.widget('mage.integration', { + /** + * Options common to all instances of this widget. + * @type {Object} + */ + options: { + /** + * URL of the integration grid. + * @type {String} + */ + gridUrl: '' + }, + + /** + * Bind event handler for the action when admin clicks "Save & Activate" button. + * @private + */ + _create: function () { + if ($('#save-split-button-activate').length) { + // We're on the "New integration" page - bind related handler + this._form = $('#edit_form'); + this._form.on('saveAndActivate', $.proxy(this._saveAndActivate, this)); + } + }, + + /** + * Save new integration, then kick off the activate dialog. + * @private + */ + _saveAndActivate: function () { + if (this._form.validation && !this._form.validation('isValid')) { + return false; + } + + $.ajax({ + url: this._form.prop('action'), + type: 'post', + data: this._form.serialize(), + dataType: 'json', + context: this, + beforeSend: function () { + $('body').trigger('processStart'); + }, + success: function (data) { + if (data['_redirect']) { + window.location.href = data['_redirect']; + } else if (data['integrationId']) { + window.integration.popup.show($('<span>').attr({ + 'data-row-dialog': 'permissions', + 'data-row-id': data['integrationId'], + 'data-row-name': $('#integration_properties_name').val() + })); + var that = this; + $('#integration-popup-container').on('dialogclose', function () { + $('body').trigger('processStart'); + window.location.href = that.options.gridUrl; + return false; + }); + } + }, + error: function (jqXHR, status, error) { + alert($.mage.__('Sorry, something went wrong. Please try again later.')); + console && console.log(status + ': ' + error + "\nResponse text:\n" + jqXHR.responseText); + }, + complete: function () { + jQuery('body').trigger('processStop'); + } + }); + + return true; + } + }); + window.Integration = function (permissionsDialogUrl, tokensDialogUrl, deactivateDialogUrl, reauthorizeDialogUrl) { var url = { permissions: permissionsDialogUrl, @@ -33,8 +107,6 @@ }; var _showPopup = function (dialog, title, okButton, url) { - var that = this; - $.ajax({ url: url, cache: false, @@ -53,7 +125,7 @@ var buttons = [{ text: $.mage.__('Cancel'), click: function() { - $(this).dialog('destroy'); + $(this).dialog('close'); } }]; @@ -135,4 +207,32 @@ } }; }; + + /** + * Confirm dialog for delete integration action + */ + $(function() { + $('#integrationGrid_table').on('click', 'button#delete', function(e){ + $('#integration-delete-container').dialog({ + modal: true, + autoOpen: true, + resizable: false, + minHeight: 200, + minWidth: 300, + dialogClass: "no-close", + position: {at: 'top'}, + buttons: { + Cancel: function() { + $(this).dialog( "close" ); + }, + Delete: function() { + $(this).dialog( "close" ); + window.location.href = $(e.target).data('url'); + } + } + }); + e.stopPropagation(); + }); + }); + })(jQuery, window); diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml index 65c4a9627390296e1af4b3860d16b329b70d0afa..d5b1ef54043d3748150a28b0198341f1165bc417 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_edit.xml @@ -27,7 +27,9 @@ <update handle="editor"/> <referenceContainer name="left"> <block class="Magento\Integration\Block\Adminhtml\Integration\Edit\Tabs" name="integration_edit_tabs"> - <block class="Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info" name="integration_edit_tab_info"/> + <block class="Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info" name="integration_edit_tab_info"> + <block class="Magento\Integration\Block\Adminhtml\Integration\Tokens" name="integration_tokens"/> + </block> <action method="addTab"> <argument name="name" xsi:type="string">info_section</argument> <argument name="block" xsi:type="string">integration_edit_tab_info</argument> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml index bc2a4f7d68ec5bfadf7d9ff375ecaa81e0f74d41..eb8d6917d6b277f9dd79af8375d35ddfcb50ba98 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_grid_block.xml @@ -30,7 +30,7 @@ <block class="Magento\Integration\Block\Adminhtml\Integration\Grid" name="integration.grid" as="grid"> <arguments> <argument name="id" xsi:type="string">integrationGrid</argument> - <argument name="dataSource" xsi:type="object">\Magento\Integration\Model\Resource\Integration\Collection</argument> + <argument name="dataSource" xsi:type="object">Magento\Integration\Model\Resource\Integration\Collection</argument> <argument name="use_ajax" xsi:type="string">1</argument> <argument name="default_sort" xsi:type="string">integration_id</argument> <argument name="default_dir" xsi:type="string">asc</argument> @@ -83,7 +83,6 @@ <block class="Magento\Backend\Block\Widget\Grid\Column" as="edit"> <arguments> <argument name="renderer" xsi:type="string">Magento\Integration\Block\Adminhtml\Widget\Grid\Column\Renderer\Button\Edit</argument> - <argument name="class" xsi:type="string">action edit</argument> <argument name="index" xsi:type="string">edit</argument> <argument name="id" xsi:type="string">edit</argument> <argument name="sortable" xsi:type="string">0</argument> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml index 718ae1d6e803ddcbabaa3e6efa45e9316806134a..16d10cc498bbe51859935f41523ff963479affe7 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_index.xml @@ -38,11 +38,9 @@ </arguments> </block> </referenceBlock> + <update handle="adminhtml_integration_grid_block"/> <referenceBlock name="content"> <block class="Magento\Backend\Block\Template" name="integration.popup.container" template="Magento_Integration::integration/popup_container.phtml" before="-"/> - </referenceBlock> - <update handle="adminhtml_integration_grid_block"/> - <referenceContainer name="content"> <block class="Magento\Integration\Block\Adminhtml\Integration" name="integration.grid.container"/> - </referenceContainer> + </referenceBlock> </layout> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml index dadd55f1a451a690ad91c1073c933a8002ab22ad..2329a5b3cde4432b080acaa5559957d57dc4169a 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_new.xml @@ -24,5 +24,20 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="head"> + <block class="Magento\Theme\Block\Html\Head\Css" name="magento-integration-styles-css"> + <arguments> + <argument name="file" xsi:type="string">Magento_Integration::integration.css</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="integration-js"> + <arguments> + <argument name="file" xsi:type="string">Magento_Integration::js/integration.js</argument> + </arguments> + </block> + </referenceBlock> <update handle="adminhtml_integration_edit"/> + <referenceBlock name="content"> + <block class="Magento\Backend\Block\Template" name="integration.popup.container" template="Magento_Integration::integration/popup_container.phtml" before="-"/> + </referenceBlock> </layout> diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_activate_permissions_popup.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_permissionsdialog.xml similarity index 100% rename from app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_activate_permissions_popup.xml rename to app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_permissionsdialog.xml diff --git a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_activate_tokens_popup.xml b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensdialog.xml similarity index 95% rename from app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_activate_tokens_popup.xml rename to app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensdialog.xml index e06c57704e8b938eb59a0b3bba3725d1820b81a7..e10db94acdfd925ab628fa1ee6ef53edddd891b5 100644 --- a/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_activate_tokens_popup.xml +++ b/app/code/Magento/Integration/view/adminhtml/layout/adminhtml_integration_tokensdialog.xml @@ -25,5 +25,5 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Integration\Block\Adminhtml\Integration\Token" name="integration_token_popup" output="1"/> + <block class="Magento\Integration\Block\Adminhtml\Integration\Tokens" name="integration_token_popup" output="1"/> </layout> diff --git a/app/code/Magento/Log/Model/Shell.php b/app/code/Magento/Log/Model/Shell.php index 8172d9c5d1c157c7c4485e9c0d65245a96f40c86..c3e4b8c75e9ea1382185d8772c1f08ee4ca42c6a 100644 --- a/app/code/Magento/Log/Model/Shell.php +++ b/app/code/Magento/Log/Model/Shell.php @@ -41,16 +41,16 @@ class Shell extends \Magento\Core\Model\AbstractShell protected $_commandFactory; /** - * @param \Magento\Log\Model\Shell\Command\Factory $commandFactory * @param \Magento\Filesystem $filesystem - * @param \Magento\App\Dir $entryPoint + * @param string $entryPoint * @param \Magento\App\Dir $dir + * @param \Magento\Log\Model\Shell\Command\Factory $commandFactory */ public function __construct( - \Magento\Log\Model\Shell\Command\Factory $commandFactory, \Magento\Filesystem $filesystem, $entryPoint, - \Magento\App\Dir $dir + \Magento\App\Dir $dir, + \Magento\Log\Model\Shell\Command\Factory $commandFactory ) { parent::__construct($filesystem, $entryPoint, $dir); $this->_commandFactory = $commandFactory; diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php index 3933ff50c68ad42ba1b406afe78684d22ad77731..13b54900a8c6f9c57112e64c9110ff71e883d97e 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Queue/Preview/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'preview_form', 'action' => $this->getUrl('*/*/drop', array('_current' => true)), 'method' => 'post', @@ -56,7 +56,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $mapper = array('preview_store_id' => 'store_id'); foreach ($data as $key => $value) { - if(array_key_exists($key, $mapper)) { + if (array_key_exists($key, $mapper)) { $name = $mapper[$key]; } else { $name = $key; diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php index a5ec8f0576c4bde5498b719c624d26e2276aae2d..15e20aaa19290adc7df0d888ab9dd75a988447e4 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Edit/Form.php @@ -85,7 +85,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php index 77d8a9abe3799b89b7a6e0222f2f6c59b8391dd8..2b6963970d75e9d726f0c70f9ea59910fa889026 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Template/Preview/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'preview_form', 'action' => $this->getUrl('*/*/drop', array('_current' => true)), 'method' => 'post', diff --git a/app/code/Magento/Newsletter/Model/Session.php b/app/code/Magento/Newsletter/Model/Session.php index fc51c6bed0a0da44dd59da6d8bb7763bd2dd43e7..a8f1eff995183de49f68d29c298eb8e7aa2cc9da 100644 --- a/app/code/Magento/Newsletter/Model/Session.php +++ b/app/code/Magento/Newsletter/Model/Session.php @@ -40,15 +40,15 @@ class Session extends \Magento\Core\Model\Session\AbstractSession * @param \Magento\Core\Model\Session\Context $context * @param \Magento\Session\SidResolverInterface $sidResolver * @param \Magento\Session\Config\ConfigInterface $sessionConfig - * @param array $data * @param null $sessionName + * @param array $data */ public function __construct( \Magento\Core\Model\Session\Context $context, \Magento\Session\SidResolverInterface $sidResolver, - \Magento\Session\Config\ConfigInterface $sessionConfig, - array $data = array(), - $sessionName = null + \Magento\Session\Config\ConfigInterface $sessionConfig, + $sessionName = null, + array $data = array() ) { parent::__construct($context, $sidResolver, $sessionConfig, $data); $this->start('newsletter', $sessionName); diff --git a/app/code/Magento/Newsletter/view/frontend/subscribe.phtml b/app/code/Magento/Newsletter/view/frontend/subscribe.phtml index c33c07b7907daec0ebf9d612a5e8e7d384704f60..6aea243e96ffc93d6f1f0677c480e6c907b4fd81 100644 --- a/app/code/Magento/Newsletter/view/frontend/subscribe.phtml +++ b/app/code/Magento/Newsletter/view/frontend/subscribe.phtml @@ -30,7 +30,7 @@ <div class="field newsletter"> <label class="label" for="newsletter"><span><?php echo __('Sign Up for Our Newsletter:') ?></span></label> <div class="control"> - <input name="email" type="text" id="newsletter" + <input name="email" type="email" id="newsletter" placeholder="<?php echo __('Enter your email address') ?>" data-validate="{required:true, 'validate-email':true}"/> </div> diff --git a/app/code/Magento/Ogone/Model/Api.php b/app/code/Magento/Ogone/Model/Api.php index 3c4b524c0e43eadda9a7176b488e9c51d138b196..cdaf64fe4fa0e7a52342d226d3f2beacbb8903a0 100644 --- a/app/code/Magento/Ogone/Model/Api.php +++ b/app/code/Magento/Ogone/Model/Api.php @@ -202,29 +202,27 @@ class Api extends \Magento\Payment\Model\Method\AbstractMethod protected $_locale; /** - * Construct - * * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Stdlib\String $string * @param \Magento\Ogone\Model\Config $config - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param array $data */ public function __construct( \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Core\Model\LocaleInterface $locale, \Magento\UrlInterface $urlBuilder, \Magento\Stdlib\String $string, \Magento\Ogone\Model\Config $config, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, array $data = array() ) { $this->_storeManager = $storeManager; diff --git a/app/code/Magento/Ogone/Model/Config.php b/app/code/Magento/Ogone/Model/Config.php index b9f33c660f2f21affcf88b0219fc57ff3132d12d..af4ef700888dbca42ed97fe36257f81a541745d1 100644 --- a/app/code/Magento/Ogone/Model/Config.php +++ b/app/code/Magento/Ogone/Model/Config.php @@ -44,22 +44,22 @@ class Config extends \Magento\Payment\Model\Config protected $_encryptor; /** - * @param \Magento\UrlInterface $urlBuilder - * @param \Magento\Encryption\EncryptorInterface $encryptor * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Config $coreConfig * @param \Magento\Payment\Model\Method\Factory $paymentMethodFactory * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Config\DataInterface $dataStorage + * @param \Magento\UrlInterface $urlBuilder + * @param \Magento\Encryption\EncryptorInterface $encryptor */ public function __construct( - \Magento\UrlInterface $urlBuilder, - \Magento\Encryption\EncryptorInterface $encryptor, \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Config $coreConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Core\Model\LocaleInterface $locale, - \Magento\Config\DataInterface $dataStorage + \Magento\Config\DataInterface $dataStorage, + \Magento\UrlInterface $urlBuilder, + \Magento\Encryption\EncryptorInterface $encryptor ) { parent::__construct($coreStoreConfig, $coreConfig, $paymentMethodFactory, $locale, $dataStorage); $this->_urlBuilder = $urlBuilder; diff --git a/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml b/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml index 129c5e9fa625613d0b2f7d232cd7ac1f25f94b45..ed7c798360ae3f4ae47ad2e5226ad2ccd904332b 100644 --- a/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml +++ b/app/code/Magento/PageCache/view/frontend/layout/catalog_product_view.xml @@ -24,7 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceContainer name="content"> + <referenceContainer name="page.bottom"> <block class="Magento\View\Element\Template" name="external.pagecache.cookie" template="Magento_PageCache::cookie.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Paygate/Model/Authorizenet.php b/app/code/Magento/Paygate/Model/Authorizenet.php index 6ff983a39663beca414533555bba368669289cbd..222411806c7ed21846b72a2e72fe09527e5eddce 100644 --- a/app/code/Magento/Paygate/Model/Authorizenet.php +++ b/app/code/Magento/Paygate/Model/Authorizenet.php @@ -231,39 +231,39 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc protected $_cardsFactory; /** - * Construct - * + * @param \Magento\Event\ManagerInterface $eventManager + * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList + * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory * @param \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory * @param \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Core\Model\Session\AbstractSession $session - * @param \Magento\Logger $logger - * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Paygate\Helper\Data $paygateData - * @param \Magento\Module\ModuleListInterface $moduleList - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Payment\Helper\Data $paymentData - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory - * @param \Magento\Core\Model\LocaleInterface $locale - * @param \Magento\Centinel\Model\Service $centinelService * @param array $data + * + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( + \Magento\Event\ManagerInterface $eventManager, + \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, + \Magento\Core\Model\LocaleInterface $locale, + \Magento\Centinel\Model\Service $centinelService, \Magento\Paygate\Model\Authorizenet\CardsFactory $cardsFactory, \Magento\Paygate\Model\Authorizenet\RequestFactory $requestFactory, \Magento\Paygate\Model\Authorizenet\ResultFactory $resultFactory, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Core\Model\Session\AbstractSession $session, - \Magento\Logger $logger, - \Magento\Event\ManagerInterface $eventManager, \Magento\Paygate\Helper\Data $paygateData, - \Magento\Module\ModuleListInterface $moduleList, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Payment\Helper\Data $paymentData, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, - \Magento\Core\Model\LocaleInterface $locale, - \Magento\Centinel\Model\Service $centinelService, array $data = array() ) { $this->_cardsFactory = $cardsFactory; @@ -272,8 +272,17 @@ class Authorizenet extends \Magento\Payment\Model\Method\Cc $this->_orderFactory = $orderFactory; $this->_session = $session; $this->_paygateData = $paygateData; - parent::__construct($logger, $eventManager, $coreStoreConfig, $moduleList, $paymentData, $logAdapterFactory, - $locale, $centinelService, $data); + parent::__construct( + $eventManager, + $paymentData, + $coreStoreConfig, + $logAdapterFactory, + $logger, + $moduleList, + $locale, + $centinelService, + $data + ); } /** diff --git a/app/code/Magento/Payment/Model/Method/Cc.php b/app/code/Magento/Payment/Model/Method/Cc.php index 368c36a8ef2067080a5094541e52d05ad87299a3..0fa0d022a2da552b79af80ae40202f53ae90abfa 100644 --- a/app/code/Magento/Payment/Model/Method/Cc.php +++ b/app/code/Magento/Payment/Model/Method/Cc.php @@ -59,25 +59,23 @@ class Cc extends \Magento\Payment\Model\Method\AbstractMethod protected $_logger; /** - * Construct - * - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService * @param array $data */ public function __construct( - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, array $data = array() diff --git a/app/code/Magento/Paypal/Block/Standard/Redirect.php b/app/code/Magento/Paypal/Block/Standard/Redirect.php index 4a4f077c901bcfcd8d89f2ac19e1e969a921f42e..fb61ee2deb8ffedfee7f21664acbc6d9aa0e97e0 100644 --- a/app/code/Magento/Paypal/Block/Standard/Redirect.php +++ b/app/code/Magento/Paypal/Block/Standard/Redirect.php @@ -87,7 +87,7 @@ class Redirect extends \Magento\View\Element\AbstractBlock $form->addField($field, 'hidden', array('name' => $field, 'value' => $value)); } $idSuffix = $this->mathRandom->getUniqueHash(); - $submitButton = $this->_elementFactory->create('submit', array('attributes' => array( + $submitButton = $this->_elementFactory->create('submit', array('data' => array( 'value' => __('Click here if you are not redirected within 10 seconds.'), ))); $id = "submit_to_paypal_button_{$idSuffix}"; diff --git a/app/code/Magento/Paypal/Model/Direct.php b/app/code/Magento/Paypal/Model/Direct.php index 7e0e8f0aa57feefde43cb56422fb89b624a54abd..d53e84498d338faf1e62fb022788c56958ced828 100644 --- a/app/code/Magento/Paypal/Model/Direct.php +++ b/app/code/Magento/Paypal/Model/Direct.php @@ -99,12 +99,12 @@ class Direct extends \Magento\Payment\Model\Method\Cc protected $_cartFactory; /** - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory @@ -113,16 +113,16 @@ class Direct extends \Magento\Payment\Model\Method\Cc * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\Paypal\Model\CartFactory $cartFactory * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, @@ -133,12 +133,12 @@ class Direct extends \Magento\Payment\Model\Method\Cc array $data = array() ) { parent::__construct( - $logger, $eventManager, - $coreStoreConfig, - $moduleList, $paymentData, + $coreStoreConfig, $logAdapterFactory, + $logger, + $moduleList, $locale, $centinelService, $data diff --git a/app/code/Magento/Paypal/Model/Hostedpro.php b/app/code/Magento/Paypal/Model/Hostedpro.php index 0791831edffe00201d04a69a0985b0a519c0b989..db842cd35020d750a1f944e6691b647e66b1524f 100644 --- a/app/code/Magento/Paypal/Model/Hostedpro.php +++ b/app/code/Magento/Paypal/Model/Hostedpro.php @@ -78,12 +78,12 @@ class Hostedpro extends \Magento\Paypal\Model\Direct protected $_hostedproRequestFactory; /** - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory @@ -93,16 +93,16 @@ class Hostedpro extends \Magento\Paypal\Model\Direct * @param \Magento\Paypal\Model\CartFactory $cartFactory * @param \Magento\Paypal\Model\Hostedpro\RequestFactory $hostedproRequestFactory * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, \Magento\Paypal\Model\Method\ProTypeFactory $proTypeFactory, @@ -115,12 +115,12 @@ class Hostedpro extends \Magento\Paypal\Model\Direct ) { $this->_hostedproRequestFactory = $hostedproRequestFactory; parent::__construct( - $logger, $eventManager, - $coreStoreConfig, - $moduleList, $paymentData, + $coreStoreConfig, $logAdapterFactory, + $logger, + $moduleList, $locale, $centinelService, $proTypeFactory, diff --git a/app/code/Magento/Paypal/Model/Info.php b/app/code/Magento/Paypal/Model/Info.php index efe61c86d44c9b869bed9da245588d3a802c2f14..ae504be4b6eae7dd04e9c7b458ec3530c70a537d 100644 --- a/app/code/Magento/Paypal/Model/Info.php +++ b/app/code/Magento/Paypal/Model/Info.php @@ -522,6 +522,7 @@ class Info break; case self::BUYER_TAX_ID_TYPE : $value = $this->_getBuyerIdTypeValue($value); + // fall-through intentional default: return $value; } diff --git a/app/code/Magento/Paypal/Model/Payflowlink.php b/app/code/Magento/Paypal/Model/Payflowlink.php index e54f6d13b8af24e771a5d2997d1fdd2a2f27a58f..70818a56be229c62696a0d44fb77f63ff47111fd 100644 --- a/app/code/Magento/Paypal/Model/Payflowlink.php +++ b/app/code/Magento/Paypal/Model/Payflowlink.php @@ -140,12 +140,12 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro protected $_websiteFactory; /** - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Core\Model\StoreManagerInterface $storeManager @@ -157,16 +157,16 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro * @param \Magento\App\RequestInterface $requestHttp * @param \Magento\Core\Model\WebsiteFactory $websiteFactory * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -185,12 +185,12 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro $this->_requestHttp = $requestHttp; $this->_websiteFactory = $websiteFactory; parent::__construct( - $logger, $eventManager, - $coreStoreConfig, - $moduleList, $paymentData, + $coreStoreConfig, $logAdapterFactory, + $logger, + $moduleList, $locale, $centinelService, $storeManager, diff --git a/app/code/Magento/Paypal/Model/Payflowpro.php b/app/code/Magento/Paypal/Model/Payflowpro.php index c393c14471c3562be63e0ae294b46e8c04117eb1..7515da6b351e80fdd197c70c69b7a30d797ff557 100644 --- a/app/code/Magento/Paypal/Model/Payflowpro.php +++ b/app/code/Magento/Paypal/Model/Payflowpro.php @@ -128,28 +128,28 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc protected $mathRandom; /** - * @param \Magento\Logger $logger * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Payment\Helper\Data $paymentData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Module\ModuleListInterface $moduleList * @param \Magento\Core\Model\LocaleInterface $locale * @param \Magento\Centinel\Model\Service $centinelService * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param ConfigFactory $configFactory + * @param \Magento\Paypal\Model\ConfigFactory $configFactory * @param \Magento\Math\Random $mathRandom * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, \Magento\Event\ManagerInterface $eventManager, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Module\ModuleListInterface $moduleList, \Magento\Payment\Helper\Data $paymentData, + \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Module\ModuleListInterface $moduleList, \Magento\Core\Model\LocaleInterface $locale, \Magento\Centinel\Model\Service $centinelService, \Magento\Core\Model\StoreManagerInterface $storeManager, @@ -161,12 +161,12 @@ class Payflowpro extends \Magento\Payment\Model\Method\Cc $this->_configFactory = $configFactory; $this->mathRandom = $mathRandom; parent::__construct( - $logger, $eventManager, - $coreStoreConfig, - $moduleList, $paymentData, + $coreStoreConfig, $logAdapterFactory, + $logger, + $moduleList, $locale, $centinelService, $data diff --git a/app/code/Magento/Paypal/view/frontend/express/review.phtml b/app/code/Magento/Paypal/view/frontend/express/review.phtml index 25417eff4424f9ed31ec7416c6a25642a473a568..5e75fcf68135b1273bea383237834736bed6bc9b 100644 --- a/app/code/Magento/Paypal/view/frontend/express/review.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/review.phtml @@ -45,7 +45,7 @@ $shippingAddress = $this->getShippingAddress(); <label for="customer:email" class="label"><?php echo __('Email Address') ?></label> <div class="control"> - <input type="text" name="customer-email" id="customer:email" + <input type="email" name="customer-email" id="customer:email" value="<?php echo $this->escapeHtml($billingBlock->getAddress()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text"/> </div> diff --git a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml index e6e944ceaf049ecb77ff23fc3e66b3bf9ef59667..c60da1b9a7695938e82bfbb64abe805a59b5f9ba 100644 --- a/app/code/Magento/Paypal/view/frontend/express/review/address.phtml +++ b/app/code/Magento/Paypal/view/frontend/express/review/address.phtml @@ -44,7 +44,7 @@ <label for="<?php echo $prefix ?>:email" class="label"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" name="<?php echo $prefix ?>[email]" id="<?php echo $prefix ?>:email" + <input type="email" name="<?php echo $prefix ?>[email]" id="<?php echo $prefix ?>:email" value="<?php echo $this->escapeHtml($this->getAddress()->getEmail()) ?>" title="<?php echo __('Email Address') ?>" class="input-text validate-email required-entry"/> </div> diff --git a/app/code/Magento/Paypal/view/frontend/hss/review/button.phtml b/app/code/Magento/Paypal/view/frontend/hss/review/button.phtml index d946216ec2bf25c153307d6fb17ff47a78234f7e..c7745aed2d2acb829420b2a6db6a10b65ef67651 100644 --- a/app/code/Magento/Paypal/view/frontend/hss/review/button.phtml +++ b/app/code/Magento/Paypal/view/frontend/hss/review/button.phtml @@ -23,5 +23,5 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ ?> -<button type="submit" data-role="review-save" title="<?php echo __('Continue') ?>" class="action checkout"> +<button type="submit" data-role="review-save" title="<?php echo __('Continue') ?>" class="button action checkout"> <span><?php echo __('Continue') ?></span></button> diff --git a/app/code/Magento/PaypalUk/Model/Api/Nvp.php b/app/code/Magento/PaypalUk/Model/Api/Nvp.php index 2ff463316c202436eb43c52877cbac5940c50150..480a2552c6bf39cb2ec77413b0e160c0b4831081 100644 --- a/app/code/Magento/PaypalUk/Model/Api/Nvp.php +++ b/app/code/Magento/PaypalUk/Model/Api/Nvp.php @@ -339,11 +339,6 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp protected $mathRandom; /** - * Constructor - * - * By default is looking for first argument as array and assigns it as object - * attributes This behavior may change in child classes - * * @param \Magento\Customer\Helper\Address $customerAddress * @param \Magento\Logger $logger * @param \Magento\Core\Model\LocaleInterface $locale @@ -351,6 +346,7 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Math\Random $mathRandom + * @param array $data */ public function __construct( \Magento\Customer\Helper\Address $customerAddress, @@ -359,10 +355,19 @@ class Nvp extends \Magento\Paypal\Model\Api\Nvp \Magento\Directory\Model\RegionFactory $regionFactory, \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Directory\Model\CountryFactory $countryFactory, - \Magento\Math\Random $mathRandom + \Magento\Math\Random $mathRandom, + array $data = array() ) { $this->mathRandom = $mathRandom; - parent::__construct($customerAddress, $logger, $locale, $regionFactory, $logAdapterFactory, $countryFactory); + parent::__construct( + $customerAddress, + $logger, + $locale, + $regionFactory, + $logAdapterFactory, + $countryFactory, + $data + ); } /** diff --git a/app/code/Magento/PaypalUk/Model/Express.php b/app/code/Magento/PaypalUk/Model/Express.php index 155b82aa0e47ee103bb635b874d9113d04be5e2d..d29f192cdbbe7a2c806f043ac92c4fc238f6bbce 100644 --- a/app/code/Magento/PaypalUk/Model/Express.php +++ b/app/code/Magento/PaypalUk/Model/Express.php @@ -56,7 +56,6 @@ class Express extends \Magento\Paypal\Model\Express protected $_paypalInfoFactory; /** - * @param \Magento\Paypal\Model\InfoFactory $paypalInfoFactory * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Payment\Helper\Data $paymentData * @param \Magento\Core\Model\Store\Config $coreStoreConfig @@ -65,10 +64,10 @@ class Express extends \Magento\Paypal\Model\Express * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\UrlInterface $urlBuilder * @param \Magento\Paypal\Model\CartFactory $cartFactory + * @param \Magento\Paypal\Model\InfoFactory $paypalInfoFactory * @param array $data */ public function __construct( - \Magento\Paypal\Model\InfoFactory $paypalInfoFactory, \Magento\Event\ManagerInterface $eventManager, \Magento\Payment\Helper\Data $paymentData, \Magento\Core\Model\Store\Config $coreStoreConfig, @@ -77,10 +76,20 @@ class Express extends \Magento\Paypal\Model\Express \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\UrlInterface $urlBuilder, \Magento\Paypal\Model\CartFactory $cartFactory, + \Magento\Paypal\Model\InfoFactory $paypalInfoFactory, array $data = array() ) { - parent::__construct($eventManager, $paymentData, $coreStoreConfig, $logAdapterFactory, $proTypeFactory, - $storeManager, $urlBuilder, $cartFactory, $data); + parent::__construct( + $eventManager, + $paymentData, + $coreStoreConfig, + $logAdapterFactory, + $proTypeFactory, + $storeManager, + $urlBuilder, + $cartFactory, + $data + ); $this->_paypalInfoFactory = $paypalInfoFactory; } diff --git a/app/code/Magento/Persistent/view/frontend/remember-me-popup.js b/app/code/Magento/Persistent/view/frontend/remember-me-popup.js index f4c0050bc231ed6ad0074afe978dd2b3d4045fb0..a12c839857f0b424a20664d9870d00f2205e84fb 100644 --- a/app/code/Magento/Persistent/view/frontend/remember-me-popup.js +++ b/app/code/Magento/Persistent/view/frontend/remember-me-popup.js @@ -28,10 +28,10 @@ options: { closeBtn: '.action.close', windowOverlayTemplate: '<div class="window overlay"></div>', - popupBlockTemplate: '<div class="popup block remember tip active">' + + popupBlockTemplate: '<div class="popup block remember tip active">' + + '<span class="action close"></span>' + '<div class="title">' + - '<strong>${title}</strong>' + - '<div class="action close"></div>' + + '<strong>${title}</strong>'+ '</div>' + '<div class="content">' + '<p>${content}</p>' + diff --git a/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml b/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml index 955184f57ef8fe6381be2fb255353c3a3ecbc1d5..1c01eca7879f406d5555de497dcd2c1f58d2ffdb 100644 --- a/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml +++ b/app/code/Magento/Persistent/view/frontend/remember_me_tooltip.phtml @@ -38,6 +38,7 @@ function() { $('#remember-me-box').rememberMePopup({ title: '<?php echo __('What is this?');?>', + close: '<?php echo __('Close');?>', content: '<?php echo __('Check "Remember Me" to access your shopping cart on this computer when you are logged out')?>' }); }); diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php index c2fc01181326c1dd45bd078e934348fe008fd654..e8c4b194b550423e2d10fe728eec16a05dc15948 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Form.php @@ -40,7 +40,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('rating/*/save', array('id' => $this->getRequest()->getParam('id'))), 'method' => 'post', diff --git a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php index 7cb0c24c52bde8b288259ad71fb23852c83c9e94..cff671b8eb739bd1fcbdd6cb6a912169ddb9b831 100644 --- a/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php +++ b/app/code/Magento/Rating/Block/Adminhtml/Edit/Tab/Form.php @@ -57,7 +57,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic * @param \Magento\Rating\Model\Rating\OptionFactory $optionFactory * @param \Magento\Core\Model\Session\AbstractSession $session * @param \Magento\Core\Model\System\Store $systemStore - * @param \Magento\Core\Model\Registry $coreRegistry * @param array $data */ public function __construct( @@ -67,7 +66,6 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic \Magento\Rating\Model\Rating\OptionFactory $optionFactory, \Magento\Core\Model\Session\AbstractSession $session, \Magento\Core\Model\System\Store $systemStore, - \Magento\Core\Model\Registry $coreRegistry, array $data = array() ) { $this->_optionFactory = $optionFactory; diff --git a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php index 3447aa2f82ffc91f95399f479da826622238e45b..002e73f823da25d59da54309b63e53142fbf8dd1 100644 --- a/app/code/Magento/Rating/Model/Resource/Rating/Collection.php +++ b/app/code/Magento/Rating/Model/Resource/Rating/Collection.php @@ -45,6 +45,12 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl */ protected $_ratingCollectionF; + /** + * Add store data flag + * @var bool + */ + protected $_addStoreDataFlag = false; + /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Logger $logger @@ -112,7 +118,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl } /** - * set order by position field + * Set order by position field * * @param string $dir * @return \Magento\Rating\Model\Resource\Rating\Collection @@ -126,7 +132,7 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl /** * Set store filter * - * @param int_type $storeId + * @param int $storeId * @return \Magento\Rating\Model\Resource\Rating\Collection */ public function setStoreFilter($storeId) @@ -152,11 +158,11 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl ; $this->_isStoreJoined = true; } - $inCond = $adapter->prepareSqlCondition('store.store_id', array( + $inCondition = $adapter->prepareSqlCondition('store.store_id', array( 'in' => $storeId )); $this->getSelect() - ->where($inCond); + ->where($inCondition); $this->setPositionOrder(); return $this; } @@ -266,19 +272,52 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl return $this; } + /** - * Add stores to collection + * Add stores data to collection * * @return \Magento\Rating\Model\Resource\Rating\Collection */ - public function addStoresToCollection() + public function addStoreData() { - if ($this->_storeManager->isSingleStoreMode()) { - return $this; + if (!$this->_storeManager->isSingleStoreMode()) { + if (!$this->_isCollectionLoaded) { + $this->_addStoreDataFlag = true; + } elseif (!$this->_addStoreDataFlag) { + $this->_addStoreData(); + } } - if (!$this->_isCollectionLoaded) { + + return $this; + } + + /** + * Load data + * + * @param bool $printQuery + * @param bool $logQuery + * @return \Magento\Rating\Model\Resource\Rating\Collection + */ + public function load($printQuery = false, $logQuery = false) + { + if ($this->isLoaded()) { return $this; } + $this->_eventManager->dispatch('rating_rating_collection_load_before', array('collection' => $this)); + parent::load($printQuery, $logQuery); + if ($this->_addStoreDataFlag) { + $this->_addStoreData(); + } + return $this; + } + + /** + * Add store data + * + * @return \Magento\Rating\Model\Resource\Rating\Collection + */ + protected function _addStoreData() + { $ratingIds = array(); foreach ($this as $item) { $ratingIds[] = $item->getId(); @@ -289,14 +328,14 @@ class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractColl } $adapter = $this->getConnection(); - $inCond = $adapter->prepareSqlCondition('rating_id', array( + $inCondition = $adapter->prepareSqlCondition('rating_id', array( 'in' => $ratingIds )); $this->_select = $adapter ->select() ->from($this->getTable('rating_store')) - ->where($inCond); + ->where($inCondition); $data = $adapter->fetchAll($this->_select); if (is_array($data) && count($data) > 0) { diff --git a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php index 5ac73eae5a1fb674ae4d8d2c2e1de0eeffd125fb..892763652bfabd72591f5b83670501c142ddabc2 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Filter/Form.php @@ -122,7 +122,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'filter_form', 'action' => $actionUrl, 'method' => 'get', diff --git a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php index b9e2a64d1647d2f1f2806b36083359a6898b264b..83149d63335a198245d291984d2570c6c340e930 100644 --- a/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Review/Block/Adminhtml/Edit/Form.php @@ -88,7 +88,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('catalog/*/save', array( 'id' => $this->getRequest()->getParam('id'), diff --git a/app/code/Magento/Review/etc/module.xml b/app/code/Magento/Review/etc/module.xml index 3f8ee5e70341e1307d4d9677c79ecd109b9dca83..56957d5399f760691c1967f66eb2b5e89475878b 100755 --- a/app/code/Magento/Review/etc/module.xml +++ b/app/code/Magento/Review/etc/module.xml @@ -37,7 +37,6 @@ <module name="Magento_Rating"/> <module name="Magento_Theme"/> <module name="Magento_Backend"/> - <module name="Magento_Paypal"/> <module name="Magento_Tax"/> <module name="Magento_Newsletter"/> </depends> diff --git a/app/code/Magento/Review/view/frontend/customer/list.phtml b/app/code/Magento/Review/view/frontend/customer/list.phtml index 2aec52fe7bdf7be77044a443a538a6e5025e73e5..da49143ec62008810a2e5721610545b40fb50e60 100644 --- a/app/code/Magento/Review/view/frontend/customer/list.phtml +++ b/app/code/Magento/Review/view/frontend/customer/list.phtml @@ -69,7 +69,7 @@ <?php echo $this->getToolbarHtml() ?> </div> <?php else: ?> - <p class="empty"><?php echo __('You have submitted no reviews.') ?></p> + <div class="message info empty"><span><?php echo __('You have submitted no reviews.') ?></span></div> <?php endif; ?> <div class="actions"> <div class="secondary"> diff --git a/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml b/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml index 8ed5d67e712fa7672649bd528433991f00e64843..d365394506478a5d00f8a0942652d41565900baf 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_customer_index.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Review\Block\Customer\ListCustomer" name="review_customer_list" template="customer/list.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml b/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml index dfbf58c9e7afc022b80a88f6ac7e40b5c1bff644..d10c1bd1758e97b07232ce6641159ad6ba383018 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_customer_view.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Review\Block\Customer\View" name="customers_review"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml index fac7ed741f374fec6b8bcc866ca9c88faf4d170d..646ec6a9b6bec9eb655aa56fb2eef6641267b4b2 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_list.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_list.xml @@ -24,41 +24,18 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">2columns-right.phtml</argument> - </action> - </referenceBlock> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-catalog-zoom-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Catalog::zoom.css</argument> - </arguments> - </block> - </referenceBlock> + <update handle="page_one_column"/> + <update handle="catalog_product_view"/> + <referenceContainer name="product.info.main"> + <block class="Magento\Review\Block\Product\View\Other" name="product.info.other" as="other" template="Magento_Review::product/view/other.phtml" before="product.info.addto"/> + </referenceContainer> <referenceContainer name="content"> - <block class="Magento\Review\Block\Product\View" name="product.info" template="Magento_Catalog::product/view.phtml"> - <block class="Magento\Catalog\Block\Product\View\BaseImage" name="product-info-base-image" as="base-image" template="product/view/base-image.phtml"/> - <block class="Magento\Catalog\Block\Product\View" name="product.info.addto" as="addto" template="product/view/addto.phtml"/> - <block class="Magento\Catalog\Block\Product\View" name="product.info.addtocart" as="addtocart" template="product/view/addtocart.phtml"> - <!-- workaround: a better place for this code is in paypal.xml --> - <container name="review.product.info.addtocart.paypal.wrapper" label="PayPal Express Checkout Shortcut Wrapper" htmlTag="div"> - <block class="Magento\Paypal\Block\Express\Shortcut" name="review.product.info.addtocart.paypal" template="express/shortcut.phtml"> - <action method="setIsInCatalogProduct"> - <argument name="value" xsi:type="string">1</argument> - </action> - </block> - </container> + <container name="product.info.details" label="invisible" htmlTag="div" htmlClass="product info detailed" after="product.info.media"> + <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> + <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before" htmlTag="div" htmlClass="rewards"/> </block> - <block class="Magento\Catalog\Block\Product\View" name="product.tierprices" as="tierprices" template="product/view/tierprices.phtml"/> - <block class="Magento\Review\Block\Product\View\Other" name="product.info.other" as="other" template="Magento_Review::product/view/other.phtml"/> + <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="product/view/list.phtml"/> <block class="Magento\Theme\Block\Html\Pager" name="product_review_list.toolbar"/> - <block class="Magento\View\Element\Template" name="product_review_list.count" template="Magento_Review::product/view/count.phtml"/> - <block class="Magento\Review\Block\Product\View\ListView" name="product.info.product_additional_data" as="product_additional_data" template="product/view/list.phtml"> - <block class="Magento\Review\Block\Form" name="product.review.form" as="review_form"> - <container name="product.review.form.fields.before" as="form_fields_before" label="Review Form Fields Before"/> - </block> - </block> - </block> + </container> </referenceContainer> </layout> diff --git a/app/code/Magento/Review/view/frontend/layout/review_product_view.xml b/app/code/Magento/Review/view/frontend/layout/review_product_view.xml index c41c7ffd4adc0f54e4f48f2c942cf8055279fc5e..2d516aff3b67cffd145802322dcec95e61d0dac9 100644 --- a/app/code/Magento/Review/view/frontend/layout/review_product_view.xml +++ b/app/code/Magento/Review/view/frontend/layout/review_product_view.xml @@ -24,11 +24,7 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">1column.phtml</argument> - </action> - </referenceBlock> + <update handle="page_one_column"/> <referenceContainer name="content"> <block class="Magento\Review\Block\View" name="review_view"/> </referenceContainer> diff --git a/app/code/Magento/Review/view/frontend/product/view/other.phtml b/app/code/Magento/Review/view/frontend/product/view/other.phtml index 8eb4d2639c61df1c1f3b6ff12a493187498b17e4..ce6cd0d58c30c5ff02f7249b9da5176d73004e31 100644 --- a/app/code/Magento/Review/view/frontend/product/view/other.phtml +++ b/app/code/Magento/Review/view/frontend/product/view/other.phtml @@ -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 design - * @package base_default * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -27,6 +25,6 @@ <?php /** @var $this \Magento\Review\Block\Product\View\Other */ ?> <?php $_product = $this->getProduct(); ?> -<div class="buttons-set"> - <p class="back-link"><a href="<?php echo $_product->getProductUrl() ?>"><small>« </small><?php echo __('Back to Main Product Info') ?></a></p> +<div class="actions"> + <a href="<?php echo $_product->getProductUrl() ?>" class="action back"><span><?php echo __('Back to Main Product Info') ?></span></a> </div> diff --git a/app/code/Magento/Rule/Model/Action/Collection.php b/app/code/Magento/Rule/Model/Action/Collection.php index abdb49f38e5af05c4a5550aeca5a745cb4279d19..f3d03c04dedaa453f55347e037e99ec59fb5d7a7 100644 --- a/app/code/Magento/Rule/Model/Action/Collection.php +++ b/app/code/Magento/Rule/Model/Action/Collection.php @@ -36,14 +36,14 @@ class Collection extends \Magento\Rule\Model\Action\AbstractAction /** * @param \Magento\View\Url $viewUrl - * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param array $data */ public function __construct( \Magento\View\Url $viewUrl, - \Magento\Rule\Model\ActionFactory $actionFactory, \Magento\View\LayoutInterface $layout, + \Magento\Rule\Model\ActionFactory $actionFactory, array $data = array() ) { $this->_actionFactory = $actionFactory; diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php index 92aa28aaead5cdfdc9a6dcf0a1031e2dc274d451..518f08f369193aa040297fad76ae91c1193d9862 100644 --- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php +++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php @@ -88,8 +88,8 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon protected $_attrSetCollection; /** - * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Rule\Model\Condition\Context $context + * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Eav\Model\Config $config * @param \Magento\Catalog\Model\Product $product * @param \Magento\Catalog\Model\Resource\Product $productResource @@ -97,8 +97,8 @@ abstract class AbstractProduct extends \Magento\Rule\Model\Condition\AbstractCon * @param array $data */ public function __construct( - \Magento\Backend\Helper\Data $backendData, \Magento\Rule\Model\Condition\Context $context, + \Magento\Backend\Helper\Data $backendData, \Magento\Eav\Model\Config $config, \Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Resource\Product $productResource, diff --git a/app/code/Magento/Rule/Model/Resource/AbstractResource.php b/app/code/Magento/Rule/Model/Resource/AbstractResource.php index 8dc446d4de5ae6de8a33e6bb917de9e5bf1e2f0a..64d3f63dd4963c5033dd0ad1f409db9e31377221 100644 --- a/app/code/Magento/Rule/Model/Resource/AbstractResource.php +++ b/app/code/Magento/Rule/Model/Resource/AbstractResource.php @@ -163,7 +163,7 @@ abstract class AbstractResource extends \Magento\Core\Model\Resource\Db\Abstract * * @return \Magento\Rule\Model\Resource\AbstractResource */ - public function unbindRuleFromEntity($ruleIds = array(), $entityIds = array(), $entityType) + public function unbindRuleFromEntity($ruleIds, $entityIds, $entityType) { $writeAdapter = $this->_getWriteAdapter(); $entityInfo = $this->_getAssociatedEntityInfo($entityType); diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php index ee7ec5b6a931ca8aa7f43ed0fda57e77dfcfaa90..24b78e5bd7447ae2e246561e803cc5b00030e4c4 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/Assign/Form.php @@ -77,7 +77,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'method' => 'post', )) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php index c4c588b11fbc3965c1f38299ec0b102cfc9442cb..c6b71e5ac120cb4c081141f10ce64a284263215f 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/Status/NewStatus/Form.php @@ -48,7 +48,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Sales/Model/Config/Reader.php b/app/code/Magento/Sales/Model/Config/Reader.php index a3654e7feaa03fe60307cab8d745e09cd6df43ab..8f21f4c58c84d559cbe45b063f28eef30b2647b0 100644 --- a/app/code/Magento/Sales/Model/Config/Reader.php +++ b/app/code/Magento/Sales/Model/Config/Reader.php @@ -48,11 +48,12 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver * @param \Magento\Sales\Model\Config\Converter $converter - * @param \Magento\Config\ValidationStateInterface $validationState * @param \Magento\Sales\Model\Config\SchemaLocator $schemaLocator + * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -61,10 +62,18 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'sales.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } 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 348c48029df21802ef688b07c5af8f59ddb66601..d2ada583e87974b231fdb6a51dad9b47b8ecbc05 100644 --- a/app/code/Magento/Sales/Model/Order/Total/Config/Base.php +++ b/app/code/Magento/Sales/Model/Order/Total/Config/Base.php @@ -60,15 +60,15 @@ class Base extends \Magento\Sales\Model\Config\Ordered /** * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Logger $logger + * @param \Magento\Sales\Model\Config $salesConfig * @param \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory - * @param \Magento\Sales\Model\Config $salesConfig, - * @param null $sourceData + * @param mixed $sourceData */ public function __construct( \Magento\App\Cache\Type\Config $configCacheType, \Magento\Logger $logger, - \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory, \Magento\Sales\Model\Config $salesConfig, + \Magento\Sales\Model\Order\TotalFactory $orderTotalFactory, $sourceData = null ) { parent::__construct($configCacheType, $logger, $salesConfig, $sourceData); diff --git a/app/code/Magento/Sales/Model/Quote.php b/app/code/Magento/Sales/Model/Quote.php index febdab2346c933c221d6741010b837d7197cc3e6..89090bea6bd9611de673e23808853f7e17374ebb 100644 --- a/app/code/Magento/Sales/Model/Quote.php +++ b/app/code/Magento/Sales/Model/Quote.php @@ -1769,7 +1769,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param array $params * @return \Magento\Sales\Model\Quote */ - public function removeErrorInfosByParams($type = 'error', $params) + public function removeErrorInfosByParams($type, $params) { if ($type && !isset($this->_errorInfoGroups[$type])) { return $this; @@ -1812,7 +1812,7 @@ class Quote extends \Magento\Core\Model\AbstractModel * @param string $text * @return \Magento\Sales\Model\Quote */ - public function removeMessageByText($type = 'error', $text) + public function removeMessageByText($type, $text) { $messages = $this->getData('messages'); if (null === $messages) { 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 e2bd1b296517db342f5072ad727a80066d810ea3..c379574557268045573abafe95be6beff4cd5735 100644 --- a/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php +++ b/app/code/Magento/Sales/Model/Quote/Address/Total/Collector.php @@ -82,26 +82,24 @@ class Collector extends \Magento\Sales\Model\Config\Ordered protected $_totalFactory; /** - * Init corresponding total models - * * @param \Magento\App\Cache\Type\Config $configCacheType * @param \Magento\Logger $logger - * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Sales\Model\Config $salesConfig + * @param \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Sales\Model\Quote\Address\TotalFactory $totalFactory - * @param \Magento\Core\Model\Store|null $store - * @param \Magento\Simplexml\Element|null $sourceData + * @param mixed $sourceData + * @param mixed $store */ public function __construct( \Magento\App\Cache\Type\Config $configCacheType, \Magento\Logger $logger, - \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Sales\Model\Config $salesConfig, + \Magento\Core\Model\Store\ConfigInterface $coreStoreConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Sales\Model\Quote\Address\TotalFactory $totalFactory, - $store = null, - $sourceData = null + $sourceData = null, + $store = null ) { $this->_coreStoreConfig = $coreStoreConfig; $this->_totalFactory = $totalFactory; diff --git a/app/code/Magento/Sales/view/frontend/billing/agreements.phtml b/app/code/Magento/Sales/view/frontend/billing/agreements.phtml index e5415ba17fcb19fed3f749919b65bdde09cecf24..e2efcb4217b2d16b540a4efaf330fd425b79d026 100644 --- a/app/code/Magento/Sales/view/frontend/billing/agreements.phtml +++ b/app/code/Magento/Sales/view/frontend/billing/agreements.phtml @@ -18,7 +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 design * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ @@ -55,7 +54,7 @@ </tbody> </table> <?php else: ?> - <p class="no agreements"><?php echo __('There are no billing agreements yet.') ?></p> + <div class="message info empty"><span><?php echo __('There are no billing agreements yet.') ?></span></div> <?php endif; ?> <?php $paymentMethods = $this->getWizardPaymentMethodOptions() ?> diff --git a/app/code/Magento/Sales/view/frontend/guest/form.phtml b/app/code/Magento/Sales/view/frontend/guest/form.phtml index 2e405f45fbe393295abbabcdec25746634f8abed..b050c7af62149972c7dd6681d41331cb3376a3c9 100644 --- a/app/code/Magento/Sales/view/frontend/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/guest/form.phtml @@ -59,7 +59,7 @@ <label class="label" for="oar_email"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" class="input-text" id="oar_email" name="oar_email" + <input type="email" class="input-text" id="oar_email" name="oar_email" data-validate="{required:true, 'validate-email':true}"/> </div> </div> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_index.xml b/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_index.xml index 086f470878203344fa6adc213305bea7ef02949d..d1bce6460ddc2f0c77389e73a568c0e5bb15fce2 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_index.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_index.xml @@ -25,12 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">2columns-left.phtml</argument> - </action> - </referenceBlock> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Billing\Agreements" name="customer.account.billing.agreement" template="billing/agreements.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_view.xml b/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_view.xml index 0b65274f462afb2c74ad1c6c758c6117961ea0c1..ca62e1ed1e965103d62641586020f228d8afb6e3 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_view.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_billing_agreement_view.xml @@ -25,12 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">2columns-left.phtml</argument> - </action> - </referenceBlock> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Billing\Agreement\View" name="customer.account.billing.agreement" template="billing/agreement/view.phtml"/> </referenceContainer> </layout> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml index 58f57546682b0dd29c0d39f613805035eda233a3..bedc305e616f00acb2a62c4c02b4627956a2084d 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_creditmemo.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_history.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_history.xml index 7cef22b6c457f6e78d480a0270be89b8b875f38c..c5bd4510b05d9f6e7a4946f8b695ef2ad3adb131 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_history.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_history.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\History" name="sales.order.history"> <container name="sales.order.history.info" as="info" label="Order History Info"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml index c978a28a119861b0cdf0b94b104f763739ed16e0..8898b890bd31380bc07e80859dd888edce73af75 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_invoice.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml index 685401022774f2ef0f636d2746ed0a28b3b300df..039943acd3de307ed81f5117d31a837a1e019ac4 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_shipment.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml b/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml index 8f0fbd3ba3bb257150db89f6dbf9e4d3e83d4b9a..f9d000358d771f21bd771b4c044d6325c3857dfb 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_order_view.xml @@ -25,7 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Order\Info" as="info" name="sales.order.info"> <block class="Magento\Sales\Block\Order\Info\Buttons" as="buttons" name="sales.order.info.buttons"/> </block> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_index.xml b/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_index.xml index fa41d0ee6117062f1a8a849a4032b264fc3698c2..a96c199a0d1c54205dfafe39e97cccbece895045 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_index.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_index.xml @@ -25,12 +25,7 @@ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <update handle="customer_account"/> - <referenceBlock name="root"> - <action method="setTemplate"> - <argument name="template" xsi:type="string">2columns-left.phtml</argument> - </action> - </referenceBlock> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Recurring\Profiles" name="sales.recurring.profiles" template="recurring/profiles.phtml"> <block class="Magento\Sales\Block\Recurring\Profile\Grid" name="sales.recurring.profiles.grid" as="grid" template="recurring/grid.phtml"> <action method="setEmptyGridMessage"> diff --git a/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_view__tabs.xml b/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_view__tabs.xml index 8b7d7054a411962c0940c081f3056636429b9bff..6bd552a0f43ac86e05072515e3e9ae0202a1c208 100644 --- a/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_view__tabs.xml +++ b/app/code/Magento/Sales/view/frontend/layout/sales_recurring_profile_view__tabs.xml @@ -29,7 +29,7 @@ <argument name="template" xsi:type="string">2columns-left.phtml</argument> </action> </referenceBlock> - <referenceContainer name="my.account.wrapper"> + <referenceContainer name="content"> <block class="Magento\Sales\Block\Recurring\Profile\View\Data" name="sales.recurring.profile.view" template="recurring/profile/view.phtml"> <action method="setShouldPrepareInfoTabs"> <argument name="value" xsi:type="string">1</argument> diff --git a/app/code/Magento/Sales/view/frontend/order/history.phtml b/app/code/Magento/Sales/view/frontend/order/history.phtml index e5bc8f2590c8f31b81e92a2ef99223c4041c53ca..86ea2fcf963a314e8d42b271a01fc2c6ef59839f 100644 --- a/app/code/Magento/Sales/view/frontend/order/history.phtml +++ b/app/code/Magento/Sales/view/frontend/order/history.phtml @@ -62,5 +62,5 @@ </table> <div class="order toolbar bottom"><?php echo $this->getPagerHtml(); ?></div> <?php else: ?> - <p><?php echo __('You have placed no orders.'); ?></p> + <div class="message info empty"><span><?php echo __('You have placed no orders.'); ?></span></div> <?php endif ?> diff --git a/app/code/Magento/Sales/view/frontend/order/print/shipment.phtml b/app/code/Magento/Sales/view/frontend/order/print/shipment.phtml index 6053d40cf7dc3dc1541c4b8143ebde2249a9640e..d1942ab1cb39df547d78a04099e17074d33ea938 100644 --- a/app/code/Magento/Sales/view/frontend/order/print/shipment.phtml +++ b/app/code/Magento/Sales/view/frontend/order/print/shipment.phtml @@ -111,9 +111,6 @@ <?php endforeach; ?> </table> </div> - <script type="text/javascript">(function ($) { - $('#my-shipment-table-<?php echo $this->getObjectData($shipment, 'id')?>').decorate('table', {'tbody':['odd', 'even'], 'tbody tr':['first', 'last']}) - })(jQuery)</script> <?php endforeach; ?> <?php endif; ?> <script type="text/javascript">window.print();</script> diff --git a/app/code/Magento/Sales/view/frontend/order/recent.phtml b/app/code/Magento/Sales/view/frontend/order/recent.phtml index 35af465a6a1e3894fb68e7a956b83caee0a28338..d6ddd2d8484d175979d9ceae726146be6f8b6e0e 100644 --- a/app/code/Magento/Sales/view/frontend/order/recent.phtml +++ b/app/code/Magento/Sales/view/frontend/order/recent.phtml @@ -70,7 +70,7 @@ </tbody> </table> <?php else: ?> - <p class="empty"><?php echo __('You have placed no orders.'); ?></p> + <div class="message info empty"><span><?php echo __('You have placed no orders.'); ?></span></div> <?php endif; ?> </div> </div> diff --git a/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml b/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml index e9c1c29b50cb0586eb3b122b5569e1e9e85b0dba..f720e92eb03fa08b8697f0e31199f00eaf02bfeb 100644 --- a/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml +++ b/app/code/Magento/Sales/view/frontend/widget/guest/form.phtml @@ -64,7 +64,7 @@ <label for="oar_email" class="label"><span><?php echo __('Email Address') ?></span></label> <div class="control"> - <input type="text" class="input-text" id="oar_email" name="oar_email" autocomplete="off" + <input type="email" class="input-text" id="oar_email" name="oar_email" autocomplete="off" data-validate="{required:true, 'validate-email':true}"> </div> </div> diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php index c0e6d88504e7571a114e30cce1aceec616802e29..dfd70020644234c6d2b02128ddcc161b12ccba7e 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Form.php @@ -47,7 +47,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('sales_rule/promo_quote/save'), 'method' => 'post', diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php index 7fb5048757ba20dbecc158ffb020c3083e04820c..86bc50393af8269f1531a22ae0e1a2bd85f688c7 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Labels.php @@ -30,23 +30,6 @@ class Labels extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Registry $coreRegistry - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Registry $coreRegistry, - array $data = array() - ) { - parent::__construct($context, $registry, $formFactory, $data); - } - /** * Prepare content for tab * diff --git a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php index 0d989ff35c64f780a46b67563dd69362f084e95d..dd0b9f22258f31d70df4e0a7eaf0ddc212bd0676 100644 --- a/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php +++ b/app/code/Magento/SalesRule/Block/Adminhtml/Promo/Quote/Edit/Tab/Main/Renderer/Checkbox.php @@ -42,16 +42,16 @@ class Checkbox */ protected $_elementFactory; - /** - * @param \Magento\Backend\Block\Context $context - * @param \Magento\Data\Form\Element\Factory $elementFactory - * @param array $data + /** + * @param \Magento\Backend\Block\Context $context + * @param \Magento\Data\Form\Element\Factory $elementFactory + * @param array $data */ - public function __construct( - \Magento\Backend\Block\Context $context, - \Magento\Data\Form\Element\Factory $elementFactory, - array $data = array() - ) { + public function __construct( + \Magento\Backend\Block\Context $context, + \Magento\Data\Form\Element\Factory $elementFactory, + array $data = array() + ) { $this->_elementFactory = $elementFactory; parent::__construct($context, $data); } @@ -65,7 +65,7 @@ class Checkbox public function render(\Magento\Data\Form\Element\AbstractElement $element) { /** @var \Magento\Data\Form\Element\Checkbox $checkbox */ - $checkbox = $this->_elementFactory->create('checkbox', array('attributes' => $element->getData())); + $checkbox = $this->_elementFactory->create('checkbox', array('data' => $element->getData())); $checkbox->setForm($element->getForm()); $elementHtml = sprintf( diff --git a/app/code/Magento/SalesRule/Model/Rule/Action/Collection.php b/app/code/Magento/SalesRule/Model/Rule/Action/Collection.php index 4cec475d06e6d1588b25148de7b656d7c6e7cead..5c85784555b8e7cc6ab815912dd0d2a537ad8ba6 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Action/Collection.php +++ b/app/code/Magento/SalesRule/Model/Rule/Action/Collection.php @@ -31,17 +31,17 @@ class Collection extends \Magento\Rule\Model\Action\Collection { /** * @param \Magento\View\Url $viewUrl - * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param \Magento\View\LayoutInterface $layout + * @param \Magento\Rule\Model\ActionFactory $actionFactory * @param array $data */ public function __construct( \Magento\View\Url $viewUrl, - \Magento\Rule\Model\ActionFactory $actionFactory, \Magento\View\LayoutInterface $layout, + \Magento\Rule\Model\ActionFactory $actionFactory, array $data = array() ) { - parent::__construct($viewUrl, $actionFactory, $layout, $data); + parent::__construct($viewUrl, $layout, $actionFactory, $data); $this->setType('Magento\SalesRule\Model\Rule\Action\Collection'); } diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php index ad3d052bac01b93309d5ff5fcf721fbb58937cb9..66a67bf819fccd4861fb4b835165fca6f7e01bf5 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Combine.php @@ -42,14 +42,14 @@ class Combine extends \Magento\Rule\Model\Condition\Combine protected $_conditionAddress; /** - * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\Rule\Model\Condition\Context $context + * @param \Magento\Event\ManagerInterface $eventManager * @param \Magento\SalesRule\Model\Rule\Condition\Address $conditionAddress * @param array $data */ public function __construct( - \Magento\Event\ManagerInterface $eventManager, \Magento\Rule\Model\Condition\Context $context, + \Magento\Event\ManagerInterface $eventManager, \Magento\SalesRule\Model\Rule\Condition\Address $conditionAddress, array $data = array() ) { diff --git a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php index e70c827826eca9d0909286570429e1ace03cbc16..7638d0798f551391ea7f4003d80512fca56e89b0 100644 --- a/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php +++ b/app/code/Magento/SalesRule/Model/Rule/Condition/Product.php @@ -42,8 +42,8 @@ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct protected $_productFactory; /** - * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Rule\Model\Condition\Context $context + * @param \Magento\Backend\Helper\Data $backendData * @param \Magento\Eav\Model\Config $config * @param \Magento\Catalog\Model\Product $product * @param \Magento\Catalog\Model\Resource\Product $productResource @@ -52,8 +52,8 @@ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct * @param array $data */ public function __construct( - \Magento\Backend\Helper\Data $backendData, \Magento\Rule\Model\Condition\Context $context, + \Magento\Backend\Helper\Data $backendData, \Magento\Eav\Model\Config $config, \Magento\Catalog\Model\Product $product, \Magento\Catalog\Model\Resource\Product $productResource, @@ -61,7 +61,7 @@ class Product extends \Magento\Rule\Model\Condition\Product\AbstractProduct \Magento\Catalog\Model\ProductFactory $productFactory, array $data = array() ) { - parent::__construct($backendData, $context, $config, $product, $productResource, $attrSetCollection, $data); + parent::__construct($context, $backendData, $config, $product, $productResource, $attrSetCollection, $data); $this->_productFactory = $productFactory; } diff --git a/app/code/Magento/Sendfriend/view/frontend/send.phtml b/app/code/Magento/Sendfriend/view/frontend/send.phtml index c581b33bd4111ddeea65eb6afdd05e35c7223f02..8b8d2af96f99ca360e230f1466feaff94619fea6 100644 --- a/app/code/Magento/Sendfriend/view/frontend/send.phtml +++ b/app/code/Magento/Sendfriend/view/frontend/send.phtml @@ -43,7 +43,7 @@ <label for="recipients-email${_index_}" class="label"><span><?php echo __('Email Address:') ?></span></label> <div class="control"> <input name="recipients[email][${_index_}]" title="<?php echo __('Email Address:') ?>" - id="recipients-email${_index_}" type="text" class="input-text" + id="recipients-email${_index_}" type="email" class="input-text" data-validate="{required:true, 'validate-email':true}"/> </div> </div> diff --git a/app/code/Magento/Shipping/Model/Shipping/Labels.php b/app/code/Magento/Shipping/Model/Shipping/Labels.php index 61f6c4e97283a6cab367bba9fbc7e4db28efdf23..dbfdb0d62c7cf35a2df9d1f853a44455f7ccb631 100644 --- a/app/code/Magento/Shipping/Model/Shipping/Labels.php +++ b/app/code/Magento/Shipping/Model/Shipping/Labels.php @@ -41,23 +41,23 @@ class Labels extends \Magento\Shipping\Model\Shipping * @param \Magento\Core\Model\Store\Config $coreStoreConfig * @param \Magento\Shipping\Model\Config $shippingConfig * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Backend\Model\Auth\Session $authSession * @param \Magento\Shipping\Model\Carrier\Factory $carrierFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory * @param \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory * @param \Magento\Directory\Model\RegionFactory $regionFactory * @param \Magento\Math\Division $mathDivision + * @param \Magento\Backend\Model\Auth\Session $authSession */ public function __construct( \Magento\Core\Model\Store\Config $coreStoreConfig, \Magento\Shipping\Model\Config $shippingConfig, \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Backend\Model\Auth\Session $authSession, \Magento\Shipping\Model\Carrier\Factory $carrierFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateResultFactory, \Magento\Shipping\Model\Rate\RequestFactory $rateRequestFactory, \Magento\Directory\Model\RegionFactory $regionFactory, - \Magento\Math\Division $mathDivision + \Magento\Math\Division $mathDivision, + \Magento\Backend\Model\Auth\Session $authSession ) { $this->_authSession = $authSession; parent::__construct( diff --git a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php index 6e212c8d2eeb08445ce9af0a68c09cb8ff023a3a..d53b5f9313f0484e598dd376c996b918ffec4294 100644 --- a/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php +++ b/app/code/Magento/Sitemap/Block/Adminhtml/Edit/Form.php @@ -75,7 +75,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php index e567043788844da6175c32f7d8695cd268bda397..a7606aacbf5c41b44c55b9691da3ce6c59d028cb 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Title/Fieldset.php @@ -40,21 +40,21 @@ class Fieldset extends \Magento\Data\Form\Element\Fieldset protected $_title; /** - * @param \Magento\Tax\Block\Adminhtml\Rate\Title $title - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param \Magento\Tax\Block\Adminhtml\Rate\Title $title + * @param array $data */ public function __construct( - \Magento\Tax\Block\Adminhtml\Rate\Title $title, - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + \Magento\Tax\Block\Adminhtml\Rate\Title $title, + $data = array() ) { $this->_title = $title; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); } public function getBasicChildrenHtml() diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php index 1c8123db9a962e75ff1775722b7c2dc10aaf63ec..4b12e0d03d5f4ac5309254aca1876b6a462a7544 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rule/Edit/Form.php @@ -80,7 +80,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic $model = $this->_coreRegistry->registry('tax_rule'); /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Tax/Model/Sales/Pdf/Grandtotal.php b/app/code/Magento/Tax/Model/Sales/Pdf/Grandtotal.php index 661343417a31db21a6aeb20b67477844dad83547..b14be6d406a97c0ae25abb0294c50b4e3f8493ce 100644 --- a/app/code/Magento/Tax/Model/Sales/Pdf/Grandtotal.php +++ b/app/code/Magento/Tax/Model/Sales/Pdf/Grandtotal.php @@ -36,15 +36,15 @@ class Grandtotal extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal /** * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation - * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory + * @param \Magento\Tax\Model\Config $taxConfig * @param array $data */ public function __construct( \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, - \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory, + \Magento\Tax\Model\Config $taxConfig, array $data = array() ) { $this->_taxConfig = $taxConfig; diff --git a/app/code/Magento/Tax/Model/Sales/Pdf/Shipping.php b/app/code/Magento/Tax/Model/Sales/Pdf/Shipping.php index 20bb2cce621b3e8723e1245260cf369e8a76bc39..e8e194aa5780a7de651408d56906cf198fab3c80 100644 --- a/app/code/Magento/Tax/Model/Sales/Pdf/Shipping.php +++ b/app/code/Magento/Tax/Model/Sales/Pdf/Shipping.php @@ -36,15 +36,15 @@ class Shipping extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal /** * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation - * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory + * @param \Magento\Tax\Model\Config $taxConfig * @param array $data */ public function __construct( \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, - \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory, + \Magento\Tax\Model\Config $taxConfig, array $data = array() ) { $this->_taxConfig = $taxConfig; diff --git a/app/code/Magento/Tax/Model/Sales/Pdf/Tax.php b/app/code/Magento/Tax/Model/Sales/Pdf/Tax.php index 312bb933203b27b0ba090ad38b7d5fbeb1c09bbd..80c9236e051aa293e26922670f6fd51bb1cd7691 100644 --- a/app/code/Magento/Tax/Model/Sales/Pdf/Tax.php +++ b/app/code/Magento/Tax/Model/Sales/Pdf/Tax.php @@ -36,15 +36,15 @@ class Tax extends \Magento\Sales\Model\Order\Pdf\Total\DefaultTotal /** * @param \Magento\Tax\Helper\Data $taxHelper * @param \Magento\Tax\Model\Calculation $taxCalculation - * @param \Magento\Tax\Model\Config $taxConfig * @param \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory + * @param \Magento\Tax\Model\Config $taxConfig * @param array $data */ public function __construct( \Magento\Tax\Helper\Data $taxHelper, \Magento\Tax\Model\Calculation $taxCalculation, - \Magento\Tax\Model\Config $taxConfig, \Magento\Tax\Model\Resource\Sales\Order\Tax\CollectionFactory $ordersFactory, + \Magento\Tax\Model\Config $taxConfig, array $data = array() ) { $this->_taxConfig = $taxConfig; diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form.php index 707ac75b23919f0c5d47eca5431bef3966f4fe37..f7a8ef145bce763319a33920ddec7fe1aaa574be 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form.php @@ -42,7 +42,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getUrl('adminhtml/*/save'), 'enctype' => 'multipart/form-data', diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php index 8329c8fef99e78ac89c1521d0bbc6a0d44bea20a..b4afdb98794e0ac3244a14845a43ea2340ee5fa8 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Image.php @@ -37,23 +37,23 @@ class Image extends \Magento\Data\Form\Element\Image protected $_imagePath; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\UrlInterface $urlBuilder * @param \Magento\View\Design\Theme\Image\PathInterface $imagePath - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\UrlInterface $urlBuilder, \Magento\View\Design\Theme\Image\PathInterface $imagePath, - $attributes = array() + $data = array() ) { $this->_imagePath = $imagePath; - parent::__construct($escaper, $factoryElement, $factoryCollection, $urlBuilder, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $urlBuilder, $data); } /** diff --git a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php index 713751ad80ef1fe80011bed0ac2a4964a8624392..536f8c4bc495ab57a4ec2a0888c2ed15520f5245 100644 --- a/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php +++ b/app/code/Magento/Theme/Block/Adminhtml/System/Design/Theme/Edit/Form/Element/Links.php @@ -35,18 +35,18 @@ class Links extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('links'); } diff --git a/app/code/Magento/Theme/Model/Config.php b/app/code/Magento/Theme/Model/Config.php index 171aa7b00dda7d9efb5a3fb33379c79283f46c78..1d23ca2bd66511a3b0b614810b56dfa592f76f1e 100644 --- a/app/code/Magento/Theme/Model/Config.php +++ b/app/code/Magento/Theme/Model/Config.php @@ -150,7 +150,7 @@ class Config */ protected function _unassignThemeFromStores($themeId, $stores, $scope, &$isReassigned) { - $configPath = \Magento\Core\Model\View\Design::XML_PATH_THEME_ID; + $configPath = \Magento\View\DesignInterface::XML_PATH_THEME_ID; foreach ($this->_getAssignedScopesCollection($scope, $configPath) as $config) { if ($config->getValue() == $themeId && !in_array($config->getScopeId(), $stores)) { $this->_configWriter->delete($configPath, $scope, $config->getScopeId()); @@ -171,7 +171,7 @@ class Config */ protected function _assignThemeToStores($themeId, $stores, $scope, &$isReassigned) { - $configPath = \Magento\Core\Model\View\Design::XML_PATH_THEME_ID; + $configPath = \Magento\View\DesignInterface::XML_PATH_THEME_ID; if (count($stores) > 0) { foreach ($stores as $storeId) { $this->_configWriter->save($configPath, $themeId, $scope, $storeId); @@ -190,7 +190,7 @@ class Config */ protected function _assignThemeToDefaultScope($themeId, &$isReassigned) { - $configPath = \Magento\Core\Model\View\Design::XML_PATH_THEME_ID; + $configPath = \Magento\View\DesignInterface::XML_PATH_THEME_ID; $this->_configWriter->save($configPath, $themeId, \Magento\Core\Model\Config::SCOPE_DEFAULT); $isReassigned = true; return $this; diff --git a/app/code/Magento/Core/Model/Theme/CopyService.php b/app/code/Magento/Theme/Model/CopyService.php similarity index 99% rename from app/code/Magento/Core/Model/Theme/CopyService.php rename to app/code/Magento/Theme/Model/CopyService.php index 8f09b2ed3dcfdc8ccb34c6df44350d406dd8d53a..7e02081280acc6a0f635c0c761caddbe134a79d8 100644 --- a/app/code/Magento/Core/Model/Theme/CopyService.php +++ b/app/code/Magento/Theme/Model/CopyService.php @@ -19,7 +19,7 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Theme * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +27,7 @@ /** * Service of copying customizations from one theme to another */ -namespace Magento\Core\Model\Theme; +namespace Magento\Theme\Model; class CopyService { diff --git a/app/code/Magento/Theme/view/frontend/1column.phtml b/app/code/Magento/Theme/view/frontend/1column.phtml index 59049a497192702fe4509556703d6aa57c046e8e..ef57baf178a64dcffa67a19f4ad06937638cc325 100644 --- a/app/code/Magento/Theme/view/frontend/1column.phtml +++ b/app/code/Magento/Theme/view/frontend/1column.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="col1-layout<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/2columns-left.phtml b/app/code/Magento/Theme/view/frontend/2columns-left.phtml index eb2c28279c9230a3abd67c8849b36d6b2c031552..73ba3766e1bac1315681165d9781c0586caf8ad6 100644 --- a/app/code/Magento/Theme/view/frontend/2columns-left.phtml +++ b/app/code/Magento/Theme/view/frontend/2columns-left.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="col2-left-layout<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/2columns-right.phtml b/app/code/Magento/Theme/view/frontend/2columns-right.phtml index e15b815a18a94add09171068b8ae22856d2bd8fb..5cd99b2db6babaf24cc29db0e138e07bca4c7fdc 100644 --- a/app/code/Magento/Theme/view/frontend/2columns-right.phtml +++ b/app/code/Magento/Theme/view/frontend/2columns-right.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="col2-right-layout<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/3columns.phtml b/app/code/Magento/Theme/view/frontend/3columns.phtml index 1af951676bd2c901832690ca52431f09000ff374..7380d544a8547312a7ba8bca21c6f5b988ca415b 100644 --- a/app/code/Magento/Theme/view/frontend/3columns.phtml +++ b/app/code/Magento/Theme/view/frontend/3columns.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="col3-layout<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/empty.phtml b/app/code/Magento/Theme/view/frontend/empty.phtml index cdf95a051c5eddd97cc26ffbbaefa2daac2c37ad..487905921efc8ee4e0216dbdb4c8260a6fe203c7 100644 --- a/app/code/Magento/Theme/view/frontend/empty.phtml +++ b/app/code/Magento/Theme/view/frontend/empty.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="page-empty<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/layout/default.xml b/app/code/Magento/Theme/view/frontend/layout/default.xml index 351dc08899e1c010ef19f3d69dddf535f47afb59..916209e43ed7049e91e9191e8e2dc89900e1ee29 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default.xml @@ -87,83 +87,5 @@ <block class="Magento\Theme\Block\Html\Notices" name="global_notices" template="html/notices.phtml"/> </container> </block> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Css" name="mage-calendar-css"> - <arguments> - <argument name="file" xsi:type="string">mage/calendar.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-jquery-no-conflict-js"> - <arguments> - <argument name="file" xsi:type="string">mage/jquery-no-conflict.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="head-load-min-js"> - <arguments> - <argument name="file" xsi:type="string">head.load.min.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-mage-js"> - <arguments> - <argument name="file" xsi:type="string">mage/mage.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-decorate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/decorate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-translate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/translate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-cookies-js"> - <arguments> - <argument name="file" xsi:type="string">mage/cookies.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-ui-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery-ui.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-tmpl-min-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.tmpl.min.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-bootstrap-js"> - <arguments> - <argument name="file" xsi:type="string">mage/bootstrap.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-page-js-truncate-js"> - <arguments> - <argument name="file" xsi:type="string">Magento_Theme::js/truncate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-common-js"> - <arguments> - <argument name="file" xsi:type="string">mage/common.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-toggle-js"> - <arguments> - <argument name="file" xsi:type="string">mage/toggle.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="mage-popup-window-js"> - <arguments> - <argument name="file" xsi:type="string">mage/popup-window.js</argument> - </arguments> - </block> - <block class="Magento\View\Element\Template" name="head.components" as="components" template="Magento_Theme::js/components.phtml"/> - </referenceBlock> <update handle="default_head_blocks"/> </layout> diff --git a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml index 256b3256ab040df412ed33fe3ceb0e8041b6e0b2..b1c2031d5a6bfd6519d63daddd613c7627c08bd1 100644 --- a/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml +++ b/app/code/Magento/Theme/view/frontend/layout/default_head_blocks.xml @@ -103,14 +103,6 @@ <argument name="file" xsi:type="string">mage/popup-window.js</argument> </arguments> </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-page-css-tabs-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Theme::css/tabs.css</argument> - <argument name="properties" xsi:type="array"> - <item name="attributes" xsi:type="string"/> - </argument> - </arguments> - </block> <block class="Magento\Theme\Block\Html\Head\Script" name="magento-loader-js"> <arguments> <argument name="file" xsi:type="string">mage/loader.js</argument> diff --git a/app/code/Magento/Theme/view/frontend/link.phtml b/app/code/Magento/Theme/view/frontend/link.phtml index 793bb875c7e642f2cf7cd7d837181163669f0102..2f02a13e381d08115623bc8d2ed49af4f80ac775 100644 --- a/app/code/Magento/Theme/view/frontend/link.phtml +++ b/app/code/Magento/Theme/view/frontend/link.phtml @@ -25,10 +25,11 @@ * @var $this \Magento\View\Element\Html\Link */ ?> +<?php if(!$this->getIsDisabled()): ?> <li> <a href="<?php echo $this->escapeHtml($this->getHref())?>" - <?php if ($title = $this->getTitle()):?> title="<?php echo $this->escapeHtml(__($title))?>"<?php endif;?> - > + <?php if ($title = $this->getTitle()):?> title="<?php echo $this->escapeHtml(__($title))?>"<?php endif;?>> <?php echo $this->escapeHtml(__($this->getLabel()))?> </a> </li> +<?php endif; ?> diff --git a/app/code/Magento/Theme/view/frontend/page.phtml b/app/code/Magento/Theme/view/frontend/page.phtml index 031b34fbbdef03e3b79eafacf6ee5e9e6957f129..914a512e0abc252781be46befbcd241f5d5f22b8 100644 --- a/app/code/Magento/Theme/view/frontend/page.phtml +++ b/app/code/Magento/Theme/view/frontend/page.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Theme/view/frontend/popup.phtml b/app/code/Magento/Theme/view/frontend/popup.phtml index 04702e6856d9a1cc335e8d7b7bbae9a03e747d9e..ae88299f6daa6b7d4da871562450c88d16cbe740 100644 --- a/app/code/Magento/Theme/view/frontend/popup.phtml +++ b/app/code/Magento/Theme/view/frontend/popup.phtml @@ -34,7 +34,7 @@ $bodyCss = $this->getBodyClass() ? $this->getBodyClass() : ''; <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/> - <meta name="viewport" content="width=device-width, initial-scale=1"/> + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/> <?php echo $this->getChildHtml('head') ?> </head> <body class="page popup<?php echo $bodyCss ?>" diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php index a102e3a1cfabdad299012bd774797998908c5337..15aa7ad44b0021a6f319b3e446aa7a69972f3f06 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/AbstractCarrier.php @@ -100,9 +100,9 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC protected $_currencyFactory; /** - * By default is looking for first argument as array and assigns it as object - * attributes This behavior may change in child classes - * + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -113,13 +113,14 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param array $data + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -130,9 +131,6 @@ abstract class AbstractCarrier extends \Magento\Shipping\Model\Carrier\AbstractC \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, array $data = array() ) { $this->_xmlElFactory = $xmlElFactory; diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php index 192ef5a1199030bcf6417e0d5a19a4fef993db5d..ee182bdc33204e18efa43fb3f553d32f38f131d7 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl.php @@ -126,9 +126,9 @@ class Dhl protected $string; /** - * Dhl constructor - * - * @param \Magento\Usa\Helper\Data $usaData + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -139,16 +139,16 @@ class Dhl * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Usa\Helper\Data $usaData * @param \Magento\Stdlib\String $string * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Usa\Helper\Data $usaData, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -159,18 +159,27 @@ class Dhl \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Usa\Helper\Data $usaData, \Magento\Stdlib\String $string, array $data = array() ) { $this->string = $string; $this->_usaData = $usaData; parent::__construct( - $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, - $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, - $logAdapterFactory, $data + $coreStoreConfig, + $rateErrorFactory, + $logAdapterFactory, + $xmlElFactory, + $rateFactory, + $rateMethodFactory, + $trackFactory, + $trackErrorFactory, + $trackStatusFactory, + $regionFactory, + $countryFactory, + $currencyFactory, + $directoryData, + $data ); } diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php index fd811e79562ba0cf7c63962055fccaab9dda7678..6cab061aa38a0a99f6b0691a3152410580cb412b 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Dhl/International.php @@ -196,15 +196,9 @@ class International protected $dateTime; /** - * Dhl International Class constructor - * - * Sets necessary data - * - * @param \Magento\Usa\Helper\Data $usaData - * @param \Magento\Core\Model\Date $coreDate - * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory - * @param \Magento\Module\Dir\Reader $configReader - * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -215,21 +209,22 @@ class International * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Usa\Helper\Data $usaData + * @param \Magento\Core\Model\Date $coreDate + * @param \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory + * @param \Magento\Module\Dir\Reader $configReader + * @param \Magento\Core\Model\StoreManagerInterface $storeManager * @param \Magento\Stdlib\String $string * @param \Magento\Math\Division $mathDivision * @param \Magento\Stdlib\DateTime $dateTime * @param array $data + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Usa\Helper\Data $usaData, - \Magento\Core\Model\Date $coreDate, - \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory, - \Magento\Module\Dir\Reader $configReader, - \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -240,9 +235,11 @@ class International \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Usa\Helper\Data $usaData, + \Magento\Core\Model\Date $coreDate, + \Magento\Usa\Model\Shipping\Carrier\Dhl\Label\PdfFactory $pdfFactory, + \Magento\Module\Dir\Reader $configReader, + \Magento\Core\Model\StoreManagerInterface $storeManager, \Magento\Stdlib\String $string, \Magento\Math\Division $mathDivision, \Magento\Stdlib\DateTime $dateTime, @@ -257,9 +254,20 @@ class International $this->mathDivision = $mathDivision; $this->dateTime = $dateTime; parent::__construct( - $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, - $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, - $logAdapterFactory, $data + $coreStoreConfig, + $rateErrorFactory, + $logAdapterFactory, + $xmlElFactory, + $rateFactory, + $rateMethodFactory, + $trackFactory, + $trackErrorFactory, + $trackStatusFactory, + $regionFactory, + $countryFactory, + $currencyFactory, + $directoryData, + $data ); if ($this->getConfigData('content_type') == self::DHL_CONTENT_TYPE_DOC) { $this->_freeMethod = 'free_method_doc'; diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php index 29135f27d94e511a3adf8c5e34802b94e03b595e..40288288bd63952c6a8fc3a9a8c883f4f3536def 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Fedex.php @@ -131,10 +131,9 @@ class Fedex protected $_productCollFactory; /** - * @param \Magento\Logger $logger - * @param \Magento\Core\Model\StoreManagerInterface $storeManager - * @param \Magento\Module\Dir\Reader $configReader - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -145,17 +144,18 @@ class Fedex * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Module\Dir\Reader $configReader + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param array $data + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, - \Magento\Core\Model\StoreManagerInterface $storeManager, - \Magento\Module\Dir\Reader $configReader, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -166,17 +166,29 @@ class Fedex \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Module\Dir\Reader $configReader, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, array $data = array() ) { $this->_storeManager = $storeManager; $this->_productCollFactory = $productCollFactory; parent::__construct( - $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, - $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, - $logAdapterFactory, $data + $coreStoreConfig, + $rateErrorFactory, + $logAdapterFactory, + $xmlElFactory, + $rateFactory, + $rateMethodFactory, + $trackFactory, + $trackErrorFactory, + $trackStatusFactory, + $regionFactory, + $countryFactory, + $currencyFactory, + $directoryData, + $data ); $wsdlBasePath = $configReader->getModuleDir('etc', 'Magento_Usa') . DS . 'wsdl' . DS . 'FedEx' . DS; $this->_shipServiceWsdl = $wsdlBasePath . 'ShipService_v10.wsdl'; diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php index d9ddc32b262d901e562d93a9e3636dbe95f7e757..013bd558b7e099aba6f5c31eb80a81f1ddbc7972 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Ups.php @@ -135,9 +135,9 @@ class Ups protected $_logger; /** - * @param \Magento\Logger $logger - * @param \Magento\Usa\Model\Simplexml\ElementFactory $simpleXmlElementFactory - * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -148,16 +148,16 @@ class Ups * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Logger $logger + * @param \Magento\Core\Model\LocaleInterface $locale * @param array $data - * + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Logger $logger, - \Magento\Core\Model\LocaleInterface $locale, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -168,17 +168,27 @@ class Ups \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Logger $logger, + \Magento\Core\Model\LocaleInterface $locale, array $data = array() ) { $this->_logger = $logger; $this->_locale = $locale; parent::__construct( - $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, - $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, - $logAdapterFactory, $data + $coreStoreConfig, + $rateErrorFactory, + $logAdapterFactory, + $xmlElFactory, + $rateFactory, + $rateMethodFactory, + $trackFactory, + $trackErrorFactory, + $trackStatusFactory, + $regionFactory, + $countryFactory, + $currencyFactory, + $directoryData, + $data ); } diff --git a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php index 0afc2ecacad9d52ead033613f2512a261e0dc29f..7ee88457929e6c2871b6e51e5f99ee97a8054a6b 100644 --- a/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php +++ b/app/code/Magento/Usa/Model/Shipping/Carrier/Usps.php @@ -136,10 +136,9 @@ class Usps protected $_productCollFactory; /** - * Usps constructor - * - * @param \Magento\Usa\Helper\Data $usaData - * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory + * @param \Magento\Core\Model\Store\Config $coreStoreConfig + * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory + * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory * @param \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory * @param \Magento\Shipping\Model\Rate\ResultFactory $rateFactory * @param \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory @@ -150,15 +149,16 @@ class Usps * @param \Magento\Directory\Model\CountryFactory $countryFactory * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Directory\Helper\Data $directoryData - * @param \Magento\Core\Model\Store\Config $coreStoreConfig - * @param \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory - * @param \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory + * @param \Magento\Usa\Helper\Data $usaData + * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory * @param array $data + * * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Usa\Helper\Data $usaData, - \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, + \Magento\Core\Model\Store\Config $coreStoreConfig, + \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, + \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, \Magento\Usa\Model\Simplexml\ElementFactory $xmlElFactory, \Magento\Shipping\Model\Rate\ResultFactory $rateFactory, \Magento\Shipping\Model\Rate\Result\MethodFactory $rateMethodFactory, @@ -169,18 +169,28 @@ class Usps \Magento\Directory\Model\CountryFactory $countryFactory, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Directory\Helper\Data $directoryData, - \Magento\Core\Model\Store\Config $coreStoreConfig, - \Magento\Shipping\Model\Rate\Result\ErrorFactory $rateErrorFactory, - \Magento\Core\Model\Log\AdapterFactory $logAdapterFactory, + \Magento\Usa\Helper\Data $usaData, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollFactory, array $data = array() ) { $this->_usaData = $usaData; $this->_productCollFactory = $productCollFactory; $this->_xmlElFactory = $xmlElFactory; parent::__construct( - $xmlElFactory, $rateFactory, $rateMethodFactory, $trackFactory, $trackErrorFactory, $trackStatusFactory, - $regionFactory, $countryFactory, $currencyFactory, $directoryData, $coreStoreConfig, $rateErrorFactory, - $logAdapterFactory, $data + $coreStoreConfig, + $rateErrorFactory, + $logAdapterFactory, + $xmlElFactory, + $rateFactory, + $rateMethodFactory, + $trackFactory, + $trackErrorFactory, + $trackStatusFactory, + $regionFactory, + $countryFactory, + $currencyFactory, + $directoryData, + $data ); } diff --git a/app/code/Magento/User/Block/User/Edit/Form.php b/app/code/Magento/User/Block/User/Edit/Form.php index 34233d7db7880bc9b2c7b0a3ea4426dc354d88c0..514353f23a141ac8c98e882d703fd01f2ef13df6 100644 --- a/app/code/Magento/User/Block/User/Edit/Form.php +++ b/app/code/Magento/User/Block/User/Edit/Form.php @@ -43,7 +43,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php index 8db34a694650c854875a7045d3e315a8d0a5837f..39c0b328e955622570c6b0db74f0a6c2de017753 100644 --- a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php +++ b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webapi.php @@ -24,58 +24,68 @@ namespace Magento\Webapi\Block\Adminhtml\Integration\Activate\Permissions\Tab; -use Magento\Backend\Block\Widget\Tab\TabInterface; -use Magento\View\Element\Template; -use Magento\Acl\Resource\ProviderInterface; -use Magento\Core\Helper\Data as CoreHelper; -use Magento\Core\Model\Acl\RootResource; -use Magento\View\Element\Template\Context; -use Magento\Integration\Helper\Data as IntegrationHelper; +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +use Magento\Integration\Controller\Adminhtml\Integration as IntegrationController; +use Magento\Integration\Model\Integration as IntegrationModel; use Magento\Webapi\Helper\Data as WebapiHelper; /** * API permissions tab for integration activation dialog. + * + * TODO: Fix warnings suppression + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Webapi extends Template implements TabInterface +class Webapi extends \Magento\Backend\Block\Widget\Form\Generic + implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** @var string[] */ protected $_selectedResources; - /** @var RootResource */ + /** @var \Magento\Core\Model\Acl\RootResource */ protected $_rootResource; - /** @var ProviderInterface */ + /** @var \Magento\Acl\Resource\ProviderInterface */ protected $_resourceProvider; - /** @var IntegrationHelper */ + /** @var \Magento\Integration\Helper\Data */ protected $_integrationData; /** @var WebapiHelper */ protected $_webapiHelper; + /** @var \Magento\Core\Helper\Data */ + protected $_coreHelper; + /** * Initialize dependencies. * - * @param Context $context - * @param RootResource $rootResource - * @param ProviderInterface $resourceProvider - * @param IntegrationHelper $integrationData - * @param WebapiHelper $webapiData + * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Data\FormFactory $formFactory + * @param \Magento\Core\Helper\Data $coreHelper + * @param \Magento\Core\Model\Acl\RootResource $rootResource + * @param \Magento\Acl\Resource\ProviderInterface $resourceProvider + * @param \Magento\Integration\Helper\Data $integrationData + * @param \Magento\Webapi\Helper\Data $webapiData * @param array $data */ public function __construct( - Context $context, - RootResource $rootResource, - ProviderInterface $resourceProvider, - IntegrationHelper $integrationData, - WebapiHelper $webapiData, + \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Data\FormFactory $formFactory, + \Magento\Core\Helper\Data $coreHelper, + \Magento\Core\Model\Acl\RootResource $rootResource, + \Magento\Acl\Resource\ProviderInterface $resourceProvider, + \Magento\Integration\Helper\Data $integrationData, + \Magento\Webapi\Helper\Data $webapiData, array $data = array() ) { $this->_rootResource = $rootResource; - $this->_webapiHelper = $webapiData; $this->_resourceProvider = $resourceProvider; $this->_integrationData = $integrationData; - parent::__construct($context, $data); + $this->_webapiHelper = $webapiData; + $this->_coreHelper = $coreHelper; + parent::__construct($context, $registry, $formFactory, $data); } /** @@ -93,7 +103,9 @@ class Webapi extends Template implements TabInterface */ public function canShowTab() { - return true; + $integrationData = $this->_coreRegistry->registry(IntegrationController::REGISTRY_KEY_CURRENT_INTEGRATION); + return isset($integrationData[Info::DATA_SETUP_TYPE]) + && ($integrationData[Info::DATA_SETUP_TYPE] == IntegrationModel::TYPE_CONFIG); } /** @@ -140,7 +152,7 @@ class Webapi extends Template implements TabInterface $resources = $this->_resourceProvider->getAclResources(); $aclResourcesTree = $this->_integrationData->mapResources($resources[1]['children']); - return $this->_coreData->jsonEncode($aclResourcesTree); + return $this->_coreHelper->jsonEncode($aclResourcesTree); } /** @@ -157,7 +169,17 @@ class Webapi extends Template implements TabInterface $resources = $this->_resourceProvider->getAclResources(); $selectedResources = $this->_getAllResourceIds($resources[1]['children']); } - return $this->_coreData->jsonEncode($selectedResources); + return $this->_coreHelper->jsonEncode($selectedResources); + } + + /** + * Whether tree has any resources. + * + * @return bool + */ + public function isTreeEmpty() + { + return $this->_selectedResources === []; } /** diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php index 41c41975ca46bba0fae1de5a5e1034771e6d2437..65c695e4f2c47e842ca1ebad0d3db2c763dc6a22 100644 --- a/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php +++ b/app/code/Magento/Webapi/Block/Adminhtml/Integration/Edit/Tab/Webapi.php @@ -24,12 +24,14 @@ namespace Magento\Webapi\Block\Adminhtml\Integration\Edit\Tab; +use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; use Magento\Integration\Controller\Adminhtml\Integration as IntegrationController; +use Magento\Integration\Model\Integration as IntegrationModel; /** * Class for handling API section within integration. */ -class Webapi extends \Magento\Backend\Block\Widget\Form +class Webapi extends \Magento\Backend\Block\Widget\Form\Generic implements \Magento\Backend\Block\Widget\Tab\TabInterface { /** @@ -60,9 +62,14 @@ class Webapi extends \Magento\Backend\Block\Widget\Form protected $_webapiData; /** - * Construct + * Initialize dependencies. + * + * TODO: Fix excessive number of arguments + * @SuppressWarnings(PHPMD.ExcessiveParameterList) * * @param \Magento\Backend\Block\Template\Context $context + * @param \Magento\Core\Model\Registry $registry + * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\Acl\RootResource $rootResource * @param \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollFactory * @param \Magento\Acl\Resource\ProviderInterface $aclResourceProvider @@ -72,6 +79,8 @@ class Webapi extends \Magento\Backend\Block\Widget\Form */ public function __construct( \Magento\Backend\Block\Template\Context $context, + \Magento\Core\Model\Registry $registry, + \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\Acl\RootResource $rootResource, \Magento\User\Model\Resource\Rules\CollectionFactory $rulesCollFactory, \Magento\Acl\Resource\ProviderInterface $aclResourceProvider, @@ -84,7 +93,7 @@ class Webapi extends \Magento\Backend\Block\Widget\Form $this->_aclResourceProvider = $aclResourceProvider; $this->_webapiData = $webapiData; $this->_integrationData = $integrationData; - parent::__construct($context, $data); + parent::__construct($context, $registry, $formFactory, $data); } /** @@ -114,7 +123,9 @@ class Webapi extends \Magento\Backend\Block\Widget\Form */ public function canShowTab() { - return true; + $integrationData = $this->_coreRegistry->registry(IntegrationController::REGISTRY_KEY_CURRENT_INTEGRATION); + return !isset($integrationData[Info::DATA_SETUP_TYPE]) + || ($integrationData[Info::DATA_SETUP_TYPE] != IntegrationModel::TYPE_CONFIG); } /** diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role.php b/app/code/Magento/Webapi/Block/Adminhtml/Role.php deleted file mode 100644 index 9621b888e43bc581b73249ad066df96e1bdcab37..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * Web API Adminhtml role block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml; - -class Role extends \Magento\Backend\Block\Widget\Grid\Container -{ - /** - * @var string - */ - protected $_blockGroup = 'Magento_Webapi'; - - /** - * @var string - */ - protected $_controller = 'adminhtml_role'; - - /** - * Internal constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->_headerText = __('API Roles'); - $this->_updateButton('add', 'label', __('Add New API Role')); - } - - /** - * Get create URL. - * - * @return string - */ - public function getCreateUrl() - { - return $this->getUrl('adminhtml/*/edit'); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit.php b/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit.php deleted file mode 100644 index fd2d4756cdb4cf55198cf9ce1f8adb56f1c260c0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit.php +++ /dev/null @@ -1,92 +0,0 @@ -<?php -/** - * Web API role edit page. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Webapi\Block\Adminhtml\Role\Edit setApiRole() setApiRole(\Magento\Webapi\Model\Acl\Role $role) - * @method \Magento\Webapi\Model\Acl\Role getApiRole() getApiRole() - */ -namespace Magento\Webapi\Block\Adminhtml\Role; - -class Edit extends \Magento\Backend\Block\Widget\Form\Container -{ - /** - * @var string - */ - protected $_blockGroup = 'Magento_Webapi'; - - /** - * @var string - */ - protected $_controller = 'adminhtml_role'; - - /** - * @var string - */ - protected $_objectId = 'role_id'; - - /** - * Internal Constructor. - */ - protected function _construct() - { - parent::_construct(); - - // TODO: Avoid varienForm usage, it is deprecated - $this->_formScripts[] = "function saveAndContinueEdit(url)" . - "{var tagForm = new varienForm('edit_form'); tagForm.submit(url);}"; - - $this->_addButton('save_and_continue', array( - 'label' => __('Save and Continue Edit'), - 'onclick' => "saveAndContinueEdit('" . $this->getSaveAndContinueUrl() . "')", - 'class' => 'save' - ), 100); - - $this->_updateButton('save', 'label', __('Save API Role')); - $this->_updateButton('delete', 'label', __('Delete API Role')); - } - - /** - * Retrieve role SaveAndContinue URL. - * - * @return string - */ - public function getSaveAndContinueUrl() - { - return $this->getUrl('adminhtml/*/save', array('_current' => true, 'continue' => true)); - } - - /** - * Get header text. - * - * @return string - */ - public function getHeaderText() - { - if ($this->getApiRole()->getId()) { - return __("Edit API Role '%1'", $this->escapeHtml($this->getApiRole()->getRoleName())); - } else { - return __('New API Role'); - } - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Form.php b/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Form.php deleted file mode 100644 index 64d5dc215b2763ee3f2b2d3ad2ddfe9e4598651a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Form.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Web API Role edit form. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit; - -class Form extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Prepare form container. - * - * @return \Magento\Webapi\Block\Adminhtml\Role\Edit\Form - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(array( - 'attributes' => array( - 'action' => $this->getUrl('adminhtml/*/save'), - 'id' => 'edit_form', - 'method' => 'post', - )) - ); - $form->setUseContainer(true); - $this->setForm($form); - - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Main.php b/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Main.php deleted file mode 100644 index 118f4b91538accb37385dad86d548ae038619360..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Main.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Web API Role tab with main information. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main setApiRole(\Magento\Webapi\Model\Acl\Role $role) - * @method \Magento\Webapi\Model\Acl\Role getApiRole() - * - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit\Tab; - -/** - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Main extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Prepare Form. - * - * @return \Magento\Backend\Block\Widget\Form - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(); - - $fieldset = $form->addFieldset('base_fieldset', array( - 'legend' => __('Role Information')) - ); - - $role = $this->getApiRole(); - if ($role && $role->getId()) { - $fieldset->addField('role_id', 'hidden', array( - 'name' => 'role_id', - 'value' => $role->getId() - )); - } - - $fieldset->addField('role_name', 'text', array( - 'name' => 'role_name', - 'id' => 'role_name', - 'class' => 'required-entry', - 'required' => true, - 'label' => __('Role Name'), - 'title' => __('Role Name'), - )); - - $fieldset->addField('in_role_user', 'hidden', - array( - 'name' => 'in_role_user', - 'id' => 'in_role_user', - ) - ); - - $fieldset->addField('in_role_user_old', 'hidden', - array( - 'name' => 'in_role_user_old' - ) - ); - - if ($role) { - $form->setValues($role->getData()); - } - $this->setForm($form); - - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Resource.php b/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Resource.php deleted file mode 100644 index 21ba797846a72d51fe332095e3b3938cfb8e0039..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/Resource.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/** - * Web API role resource tab. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource setApiRole(\Magento\Webapi\Model\Acl\Role $role) - * @method \Magento\Webapi\Model\Acl\Role getApiRole() getApiRole() - * @method \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource setSelectedResources(array $srIds) - * @method array getSelectedResources() getSelectedResources() - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit\Tab; - -class Resource extends \Magento\Backend\Block\Widget\Form -{ - /** - * Web API ACL resources tree root ID. - */ - const RESOURCES_TREE_ROOT_ID = '__root__'; - - /** - * @var \Magento\Acl\Resource\ProviderInterface - */ - protected $_resourceProvider; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule - */ - protected $_ruleResource; - - /** - * @var array - */ - protected $_aclResourcesTree; - - /** - * @var array - */ - protected $_selResourcesIds; - - /** - * Root ACL Resource - * - * @var \Magento\Core\Model\Acl\RootResource - */ - protected $_rootResource; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Acl\Resource\ProviderInterface $resourceProvider - * @param \Magento\Webapi\Model\Resource\Acl\Rule $ruleResource - * @param \Magento\Core\Model\Acl\RootResource $rootResource - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Acl\Resource\ProviderInterface $resourceProvider, - \Magento\Webapi\Model\Resource\Acl\Rule $ruleResource, - \Magento\Core\Model\Acl\RootResource $rootResource, - array $data = array() - ) { - parent::__construct($context, $data); - $this->_resourceProvider = $resourceProvider; - $this->_ruleResource = $ruleResource; - $this->_rootResource = $rootResource; - } - - /** - * Prepare Form. - * - * @return \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource - */ - protected function _prepareForm() - { - $resources = $this->_resourceProvider->getAclResources(); - $this->_aclResourcesTree = $this->_mapResources($resources[1]['children']); - return parent::_prepareForm(); - } - - /** - * Map resources - * - * @param array $resources - * @return array - */ - protected function _mapResources(array $resources) - { - $output = array(); - foreach ($resources as $resource) { - $item = array(); - $item['id'] = $resource['id']; - $item['text'] = __($resource['title']); - if (in_array($item['id'], $this->_getSelectedResourcesIds())) { - $item['checked'] = true; - } - $item['children'] = array(); - if (isset($resource['children'])) { - $item['children'] = $this->_mapResources($resource['children']); - } - $output[] = $item; - } - return $output; - } - - /** - * Check whether resource access is set to "All". - * - * @return bool - */ - public function isEverythingAllowed() - { - return in_array($this->_rootResource->getId(), $this->_getSelectedResourcesIds()); - } - - /** - * Get ACL resources tree. - * - * @return string - */ - public function getResourcesTree() - { - return $this->_aclResourcesTree; - } - - /** - * Get selected ACL resources of given API role. - * - * @return array - */ - protected function _getSelectedResourcesIds() - { - $apiRole = $this->getApiRole(); - if (null === $this->_selResourcesIds && $apiRole && $apiRole->getId()) { - $this->_selResourcesIds = $this->_ruleResource->getResourceIdsByRole($apiRole->getRoleId()); - } - return (array)$this->_selResourcesIds; - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tabs.php b/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tabs.php deleted file mode 100644 index 3751f76b55cf7aba7d4ff9dad16d5f9b48da8eb4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/Role/Edit/Tabs.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** - * Web API Role edit page tabs. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs setApiRole() setApiRole(\Magento\Webapi\Model\Acl\Role $role) - * @method \Magento\Webapi\Model\Acl\Role getApiRole() getApiRole() - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit; - -class Tabs extends \Magento\Backend\Block\Widget\Tabs -{ - /** - * Internal Constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->setId('page_tabs'); - $this->setDestElementId('edit_form'); - $this->setTitle(__('Role Information')); - } - - /** - * Prepare child blocks. - * - * @return \Magento\View\Element\AbstractBlock - */ - protected function _beforeToHtml() - { - /** @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main $mainBlock */ - $mainBlock = $this->getLayout()->getBlock('webapi.role.edit.tab.main'); - $mainBlock->setApiRole($this->getApiRole()); - $this->addTab('main_section', array( - 'label' => __('Role Info'), - 'title' => __('Role Info'), - 'content' => $mainBlock->toHtml(), - 'active' => true - )); - - /** @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource $resourceBlock */ - $resourceBlock = $this->getLayout()->getBlock('webapi.role.edit.tab.resource'); - $resourceBlock->setApiRole($this->getApiRole()); - $this->addTab('resource_section', array( - 'label' => __('Resources'), - 'title' => __('Resources'), - 'content' => $resourceBlock->toHtml() - )); - - if ($this->getApiRole() && $this->getApiRole()->getRoleId() > 0) { - $usersGrid = $this->getLayout()->getBlock('webapi.role.edit.tab.users.grid'); - $this->addTab('user_section', array( - 'label' => __('Users'), - 'title' => __('Users'), - 'content' => $usersGrid->toHtml() - )); - } - - return parent::_beforeToHtml(); - } - -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/User.php b/app/code/Magento/Webapi/Block/Adminhtml/User.php deleted file mode 100644 index e0d6e19b8903d9885f17ad83870114bb75b4e902..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/User.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** - * Web API adminhtml user block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml; - -class User extends \Magento\Backend\Block\Widget\Grid\Container -{ - /** - * @var string - */ - protected $_blockGroup = 'Magento_Webapi'; - - /** - * @var string - */ - protected $_controller = 'adminhtml_user'; - - /** - * Internal constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->_headerText = __('API Users'); - $this->_updateButton('add', 'label', __('Add New API User')); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit.php b/app/code/Magento/Webapi/Block/Adminhtml/User/Edit.php deleted file mode 100644 index 7062ca31e77e22c634855684086ff6de3dec8b9f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -/** - * Web API user edit page. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Object getApiUser() getApiUser() - * @method \Magento\Webapi\Block\Adminhtml\User\Edit setApiUser() setApiUser(\Magento\Object $apiUser) - */ -namespace Magento\Webapi\Block\Adminhtml\User; - -class Edit extends \Magento\Backend\Block\Widget\Form\Container -{ - /** - * @var string - */ - protected $_blockGroup = 'Magento_Webapi'; - - /** - * @var string - */ - protected $_controller = 'adminhtml_user'; - - /** - * @var string - */ - protected $_objectId = 'user_id'; - - /** - * Internal constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->_addButton('save_and_continue', array( - 'label' => __('Save and Continue Edit'), - 'class' => 'save', - 'data_attribute' => array( - 'mage-init' => array( - 'button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form'), - ), - ), - ), 100); - - $this->_updateButton('save', 'label', __('Save API User')); - $this->_updateButton('save', 'id', 'save_button'); - $this->_updateButton('delete', 'label', __('Delete API User')); - } - - /** - * Set Web API user to child form block. - * - * @return \Magento\Webapi\Block\Adminhtml\User\Edit - */ - protected function _beforeToHtml() - { - /** @var $formBlock \Magento\Webapi\Block\Adminhtml\User\Edit\Form */ - $formBlock = $this->getChildBlock('form'); - $formBlock->setApiUser($this->getApiUser()); - return parent::_beforeToHtml(); - } - - /** - * Get header text. - * - * @return string - */ - public function getHeaderText() - { - if ($this->getApiUser()->getId()) { - return __("Edit API User '%1'", $this->escapeHtml($this->getApiUser()->getApiKey())); - } else { - return __('New API User'); - } - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Form.php b/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Form.php deleted file mode 100644 index 35ee61a5e8a70a2b55a69dec728a2cf5317e199f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Form.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * Web API user edit form. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webapi\Block\Adminhtml\User\Edit; - -/** - * @method \Magento\Webapi\Block\Adminhtml\User\Edit setApiUser() setApiUser(\Magento\Webapi\Model\Acl\User $user) - * @method \Magento\Webapi\Model\Acl\User getApiUser() getApiUser() - * - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Form extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Prepare Form. - * - * @return \Magento\Webapi\Block\Adminhtml\User\Edit\Form - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(); - $form->setId('edit_form'); - $form->setAction($this->getUrl('adminhtml/*/save')); - $form->setMethod('post'); - $form->setUseContainer(true); - $this->setForm($form); - - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/Main.php b/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/Main.php deleted file mode 100644 index 164d36abf588b2dbbcb7109daa62e8dd6db27323..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/Main.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Web API user edit form. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webapi\Block\Adminhtml\User\Edit\Tab; - -/** - * @method \Magento\Webapi\Block\Adminhtml\User\Edit setApiUser() setApiUser(\Magento\Webapi\Model\Acl\User $user) - * @method \Magento\Webapi\Model\Acl\User getApiUser() getApiUser() - * - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Main extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** - * Prepare Form. - * - * @return \Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main - */ - protected function _prepareForm() - { - /** @var \Magento\Data\Form $form */ - $form = $this->_formFactory->create(); - - $fieldset = $form->addFieldset('base_fieldset', array( - 'legend' => __('Account Information')) - ); - - $user = $this->getApiUser(); - if ($user->getId()) { - $fieldset->addField('user_id', 'hidden', array( - 'name' => 'user_id', - 'value' => $user->getId() - )); - } - - $fieldset->addField('company_name', 'text', array( - 'name' => 'company_name', - 'id' => 'company_name', - 'required' => false, - 'label' => __('Company Name'), - 'title' => __('Company Name'), - )); - - $fieldset->addField('contact_email', 'text', array( - 'name' => 'contact_email', - 'id' => 'contact_email', - 'class' => 'validate-email', - 'required' => true, - 'label' => __('Contact Email'), - 'title' => __('Contact Email'), - )); - - $fieldset->addField('api_key', 'text', array( - 'name' => 'api_key', - 'id' => 'api_key', - 'required' => true, - 'label' => __('API Key'), - 'title' => __('API Key'), - )); - - $fieldset->addField('secret', 'text', array( - 'name' => 'secret', - 'id' => 'secret', - 'required' => true, - 'label' => __('API Secret'), - 'title' => __('API Secret'), - )); - - if ($user) { - $form->setValues($user->getData()); - } - $this->setForm($form); - - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tabs.php b/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tabs.php deleted file mode 100644 index 8188dd1af9987a0814636734dc332c1eaccd7653..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Block/Adminhtml/User/Edit/Tabs.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Web API user edit page tabs. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Object getApiUser() getApiUser() - * @method \Magento\Webapi\Block\Adminhtml\User\Edit\Tabs setApiUser() setApiUser(\Magento\Object $apiUser) - */ -namespace Magento\Webapi\Block\Adminhtml\User\Edit; - -class Tabs extends \Magento\Backend\Block\Widget\Tabs -{ - /** - * Internal constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->setId('page_tabs'); - $this->setDestElementId('edit_form'); - $this->setTitle(__('User Information')); - } - - /** - * Before to HTML. - * - * @return \Magento\View\Element\AbstractBlock - */ - protected function _beforeToHtml() - { - /** @var \Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main $mainTab */ - $mainTab = $this->getLayout()->getBlock('webapi.user.edit.tab.main'); - $mainTab->setApiUser($this->getApiUser()); - $this->addTab('main_section', array( - 'label' => __('User Info'), - 'title' => __('User Info'), - 'content' => $mainTab->toHtml(), - 'active' => true - )); - - $rolesGrid = $this->getLayout()->getBlock('webapi.user.edit.tab.roles.grid'); - $this->addTab('roles_section', array( - 'label' => __('User Role'), - 'title' => __('User Role'), - 'content' => $rolesGrid->toHtml(), - )); - return parent::_beforeToHtml(); - } -} diff --git a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/Role.php b/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/Role.php deleted file mode 100644 index dab630543d10423043c75f12f2888d72126077d3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/Role.php +++ /dev/null @@ -1,321 +0,0 @@ -<?php -/** - * Controller for web API roles management in Magento admin panel. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Controller\Adminhtml\Webapi; - -class Role extends \Magento\Backend\App\Action -{ - /** - * @var \Magento\Core\Model\Validator\Factory - */ - protected $_validatorFactory; - - /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Core\Model\Validator\Factory $validatorFactory - */ - public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Core\Model\Validator\Factory $validatorFactory - ) { - $this->_validatorFactory = $validatorFactory; - parent::__construct($context); - } - - /** - * Init. - * - * @return \Magento\Webapi\Controller\Adminhtml\Webapi\Role - */ - protected function _initAction() - { - $this->_view->loadLayout(); - $this->_setActiveMenu('Magento_Webapi::system_api_webapi_roles'); - $this->_addBreadcrumb( - __('Web Api'), - __('Web Api') - ); - $this->_addBreadcrumb( - __('API Roles'), - __('API Roles') - ); - return $this; - } - - /** - * Web API roles grid. - */ - public function indexAction() - { - $this->_title->add(__('API Roles')); - $this->_initAction(); - $this->_view->renderLayout(); - } - - /** - * AJAX Web API roles grid. - */ - public function rolegridAction() - { - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - - /** - * Grid in edit role form. - */ - public function usersgridAction() - { - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - - /** - * Edit Web API role. - */ - public function editAction() - { - $this->_initAction(); - $this->_title->add(__('API Roles')); - - $roleId = $this->getRequest()->getParam('role_id'); - - /** @var \Magento\Webapi\Model\Acl\Role $role */ - $role = $this->_objectManager->create('Magento\Webapi\Model\Acl\Role'); - if ($roleId) { - $role->load($roleId); - if (!$role->getId()) { - $this->_getSession()->addError( - __('This API role no longer exists.') - ); - $this->_redirect('adminhtml/*/'); - return; - } - $this->_addBreadcrumb( - __('Edit API Role'), - __('Edit API Role') - ); - $this->_title->add(__('Edit API Role')); - } else { - $this->_addBreadcrumb( - __('Add New API Role'), - __('Add New API Role') - ); - $this->_title->add(__('New API Role')); - } - - // Restore previously entered form data from session - $data = $this->_getSession()->getWebapiUserData(true); - if (!empty($data)) { - $role->setData($data); - } - - /** @var \Magento\Webapi\Block\Adminhtml\Role\Edit $editBlock */ - $editBlock = $this->_view->getLayout()->getBlock('webapi.role.edit'); - if ($editBlock) { - $editBlock->setApiRole($role); - } - - /** @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs $tabsBlock */ - $tabsBlock = $this->_view->getLayout()->getBlock('webapi.role.edit.tabs'); - if ($tabsBlock) { - $tabsBlock->setApiRole($role); - } - - $this->_view->renderLayout(); - } - - /** - * Remove role. - */ - public function deleteAction() - { - $roleId = $this->getRequest()->getParam('role_id', false); - - try { - $this->_objectManager->create('Magento\Webapi\Model\Acl\Role')->load($roleId)->delete(); - $this->_getSession()->addSuccess( - __('The API role has been deleted.') - ); - } catch (\Exception $e) { - $this->_getSession()->addError( - __('An error occurred while deleting this role.') - ); - } - - $this->_redirect("*/*/"); - } - - /** - * Save role. - */ - public function saveAction() - { - $data = $this->getRequest()->getPost(); - if ($data) { - $roleId = $this->getRequest()->getPost('role_id', false); - /** @var \Magento\Webapi\Model\Acl\Role $role */ - $role = $this->_objectManager->create('Magento\Webapi\Model\Acl\Role')->load($roleId); - if (!$role->getId() && $roleId) { - $this->_getSession()->addError( - __('This role no longer exists.') - ); - $this->_redirect('adminhtml/*/'); - return; - } - $role->setData($data); - - try { - $this->_validateRole($role); - $role->save(); - - $isNewRole = empty($roleId); - $this->_saveResources($role->getId(), $isNewRole); - $this->_saveUsers($role->getId()); - - $this->_getSession()->addSuccess( - __('The API role has been saved.') - ); - $this->_getSession()->setWebapiRoleData(false); - - if ($roleId && !$this->getRequest()->has('continue')) { - $this->_redirect('adminhtml/*/'); - } else { - $this->_redirect('adminhtml/*/edit', array('role_id' => $role->getId())); - } - } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_getSession()->setWebapiRoleData($data); - $this->_redirect('adminhtml/*/edit', array('role_id' => $role->getId())); - } - } - } - - /** - * Validate Web API role data. - * - * @param \Magento\Webapi\Model\Acl\Role $role - * @throws \Magento\Validator\ValidatorException - */ - protected function _validateRole($role) - { - $group = $role->isObjectNew() ? 'create' : 'update'; - $validator = $this->_validatorFactory->createValidator('api_role', $group); - if (!$validator->isValid($role)) { - throw new \Magento\Validator\ValidatorException($validator->getMessages()); - } - } - - /** - * Save role resources. - * - * @param integer $roleId - * @param boolean $isNewRole - */ - protected function _saveResources($roleId, $isNewRole) - { - // parse resource list - $resources = explode(',', $this->getRequest()->getParam('resource', false)); - $isAll = $this->getRequest()->getParam('all'); - $rootResource = $this->_objectManager->get('Magento\Core\Model\Acl\RootResource'); - if ($isAll) { - $resources = array($rootResource->getId()); - } elseif (in_array($rootResource->getId(), $resources)) { - unset($resources[array_search( - $rootResource->getId(), - $resources - )]); - } - - $saveResourcesFlag = true; - if (!$isNewRole) { - // Check changes - /** @var \Magento\Webapi\Model\Resource\Acl\Rule $ruleResource */ - $ruleResource = $this->_objectManager->get('Magento\Webapi\Model\Resource\Acl\Rule'); - $oldResources = $ruleResource->getResourceIdsByRole($roleId); - if (count($oldResources) == count($resources) && !array_diff($oldResources, $resources)) { - $saveResourcesFlag = false; - } - } - - if ($saveResourcesFlag) { - $this->_objectManager->create('Magento\Webapi\Model\Acl\Rule') - ->setRoleId($roleId) - ->setResources($resources) - ->saveResources(); - } - } - - /** - * Save linked users. - * - * @param integer $roleId - */ - protected function _saveUsers($roleId) - { - // parse users list - $roleUsers = $this->_parseRoleUsers($this->getRequest()->getParam('in_role_user')); - $oldRoleUsers = $this->_parseRoleUsers($this->getRequest()->getParam('in_role_user_old')); - - if ($roleUsers != $oldRoleUsers) { - foreach ($oldRoleUsers as $userId) { - $user = $this->_objectManager->create('Magento\Webapi\Model\Acl\User')->load($userId); - $user->setRoleId(null)->save(); - } - - foreach ($roleUsers as $userId) { - $user = $this->_objectManager->create('Magento\Webapi\Model\Acl\User')->load($userId); - $user->setRoleId($roleId)->save(); - } - } - } - - /** - * Parse request string with users. - * - * @param string $roleUsers - * @return array - */ - protected function _parseRoleUsers($roleUsers) - { - parse_str($roleUsers, $roleUsers); - if ($roleUsers && count($roleUsers)) { - return array_keys($roleUsers); - } - - return array(); - } - - /** - * Check access rights. - * - * @return boolean - */ - protected function _isAllowed() - { - return $this->_authorization->isAllowed('Magento_Webapi::webapi_roles'); - } - -} diff --git a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php b/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php deleted file mode 100644 index 73f27d6810073ebcec5913071364c15a73806adf..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Controller/Adminhtml/Webapi/User.php +++ /dev/null @@ -1,266 +0,0 @@ -<?php -/** - * Controller for web API users management in Magento admin panel. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Controller\Adminhtml\Webapi; - -class User extends \Magento\Backend\App\AbstractAction -{ - /** - * @var \Magento\Core\Model\Validator\Factory - */ - protected $_validatorFactory; - - /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Core\Model\Validator\Factory $validatorFactory - */ - public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Core\Model\Validator\Factory $validatorFactory - ) { - $this->_validatorFactory = $validatorFactory; - parent::__construct($context); - } - - /** - * Initialize breadcrumbs. - * - * @return \Magento\Webapi\Controller\Adminhtml\Webapi\User - */ - protected function _initAction() - { - $this->_view->loadLayout(); - $this->_setActiveMenu('Magento_Webapi::system_api_webapi_users') - ->_addBreadcrumb( - __('Web Services'), - __('Web Services') - ) - ->_addBreadcrumb( - __('API Users'), - __('API Users') - ); - - return $this; - } - - /** - * Show web API users grid. - */ - public function indexAction() - { - $this->_initAction(); - $this->_title->add(__('API Users')); - - $this->_view->renderLayout(); - } - - /** - * Create New Web API user. - */ - public function newAction() - { - $this->getRequest()->setParam('user_id', null); - $this->_forward('edit'); - } - - /** - * Edit Web API user. - */ - public function editAction() - { - $this->_initAction(); - $this->_title->add(__('API Users')); - - $userId = (int)$this->getRequest()->getParam('user_id'); - $user = $this->_loadApiUser($userId); - if (!$user) { - return; - } - - // Update title and breadcrumb record. - $actionTitle = $user->getId() - ? $this->_objectManager->get('Magento\Escaper')->escapeHtml($user->getApiKey()) - : __('New API User'); - $this->_title->add($actionTitle); - $this->_addBreadcrumb($actionTitle, $actionTitle); - - // Restore previously entered form data from session. - $data = $this->_getSession()->getWebapiUserData(true); - if (!empty($data)) { - $user->setData($data); - } - - /** @var \Magento\Webapi\Block\Adminhtml\User\Edit $editBlock */ - $editBlock = $this->_view->getLayout()->getBlock('webapi.user.edit'); - if ($editBlock) { - $editBlock->setApiUser($user); - } - /** @var \Magento\Webapi\Block\Adminhtml\User\Edit\Tabs $tabsBlock */ - $tabsBlock = $this->_view->getLayout()->getBlock('webapi.user.edit.tabs'); - if ($tabsBlock) { - $tabsBlock->setApiUser($user); - } - - $this->_view->renderLayout(); - } - - /** - * Save Web API user. - */ - public function saveAction() - { - $userId = (int)$this->getRequest()->getPost('user_id'); - $data = $this->getRequest()->getPost(); - $redirectBack = false; - if ($data) { - $user = $this->_loadApiUser($userId); - if (!$user) { - return; - } - - $user->setData($data); - try { - $this->_validateUserData($user); - $user->save(); - $userId = $user->getId(); - - $this->_getSession() - ->setWebapiUserData(null) - ->addSuccess(__('The API user has been saved.')); - $redirectBack = $this->getRequest()->has('back'); - } catch (\Magento\Core\Exception $e) { - $this->_getSession() - ->setWebapiUserData($data) - ->addError($e->getMessage()); - $redirectBack = true; - } catch (\Exception $e) { - $this->_objectManager->get('Magento\Logger')->logException($e); - $this->_getSession() - ->setWebapiUserData($data) - ->addError($e->getMessage()); - $redirectBack = true; - } - } - if ($redirectBack) { - $this->_redirect('adminhtml/*/edit', array('user_id' => $userId)); - } else { - $this->_redirect('adminhtml/*/'); - } - } - - /** - * Delete user. - */ - public function deleteAction() - { - $userId = (int)$this->getRequest()->getParam('user_id'); - if ($userId) { - $user = $this->_loadApiUser($userId); - if (!$user) { - return; - } - try { - $user->delete(); - - $this->_getSession()->addSuccess( - __('The API user has been deleted.') - ); - $this->_redirect('adminhtml/*/'); - return; - } catch (\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_redirect('adminhtml/*/edit', array('user_id' => $userId)); - return; - } - } - $this->_getSession()->addError( - __('Unable to find a user to be deleted.') - ); - $this->_redirect('adminhtml/*/'); - } - - /** - * AJAX Web API users grid. - */ - public function gridAction() - { - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - - /** - * Web API user roles grid. - */ - public function rolesgridAction() - { - $this->_view->loadLayout(false); - $this->_view->renderLayout(); - } - - /** - * Check ACL. - * - * @return boolean - */ - protected function _isAllowed() - { - return $this->_authorization->isAllowed('Magento_Webapi::webapi_users'); - } - - /** - * Validate Web API user data. - * - * @param \Magento\Webapi\Model\Acl\User $user - * @throws \Magento\Validator\ValidatorException - */ - protected function _validateUserData($user) - { - $group = $user->isObjectNew() ? 'create' : 'update'; - $validator = $this->_validatorFactory->createValidator('api_user', $group); - if (!$validator->isValid($user)) { - throw new \Magento\Validator\ValidatorException($validator->getMessages()); - } - } - - /** - * Load Web API user. - * - * @param int $userId - * @return bool|\Magento\Webapi\Model\Acl\User - */ - protected function _loadApiUser($userId) - { - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = $this->_objectManager->create('Magento\Webapi\Model\Acl\User')->load($userId); - if (!$user->getId() && $userId) { - $this->_getSession()->addError( - __('This user no longer exists.') - ); - $this->_redirect('adminhtml/*/'); - return false; - } - return $user; - } -} diff --git a/app/code/Magento/Webapi/Controller/Request.php b/app/code/Magento/Webapi/Controller/Request.php index 0e951a658b3197c73dd5413595be1233e7926c1f..78645513aace81afe1fc0ffe24895a4bbb11d090 100644 --- a/app/code/Magento/Webapi/Controller/Request.php +++ b/app/code/Magento/Webapi/Controller/Request.php @@ -27,6 +27,9 @@ namespace Magento\Webapi\Controller; class Request extends \Zend_Controller_Request_Http implements \Magento\App\RequestInterface { + /** @var int */ + protected $_consumerId = 0; + /** * Modify pathInfo: strip down the front name and query parameters. * @@ -47,4 +50,24 @@ class Request extends \Zend_Controller_Request_Http implements \Magento\App\Requ /** Remove GET parameters from path */ $this->_pathInfo = preg_replace('#\?.*#', '', $this->_pathInfo); } + + /** + * Set consumer ID. + * + * @param int $consumerId + */ + public function setConsumerId($consumerId) + { + $this->_consumerId = $consumerId; + } + + /** + * Get consumer ID. + * + * @return int + */ + public function getConsumerId() + { + return $this->_consumerId; + } } diff --git a/app/code/Magento/Webapi/Controller/Rest.php b/app/code/Magento/Webapi/Controller/Rest.php index ab2be5435ad97716e750ee3affcfb5950da337d8..a65933a313cc2bf3b2f3c83af52e224ff6eea093 100644 --- a/app/code/Magento/Webapi/Controller/Rest.php +++ b/app/code/Magento/Webapi/Controller/Rest.php @@ -1,7 +1,5 @@ <?php /** - * Front controller for WebAPI REST area. - * * Magento * * NOTICE OF LICENSE @@ -23,8 +21,17 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Webapi\Controller; +use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationService; + +/** + * Front controller for WebAPI REST area. + * + * TODO: Fix coupling between objects + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class Rest implements \Magento\App\FrontControllerInterface { /** @var \Magento\Webapi\Controller\Rest\Router */ @@ -48,6 +55,9 @@ class Rest implements \Magento\App\FrontControllerInterface /** @var \Magento\Oauth\Helper\Request */ protected $_oauthHelper; + /** @var AuthorizationService */ + protected $_authorizationService; + /** * @param Rest\Request $request * @param Rest\Response $response @@ -56,6 +66,7 @@ class Rest implements \Magento\App\FrontControllerInterface * @param \Magento\App\State $appState * @param \Magento\Oauth\OauthInterface $oauthService * @param \Magento\Oauth\Helper\Request $oauthHelper + * @param AuthorizationService $authorizationService */ public function __construct( \Magento\Webapi\Controller\Rest\Request $request, @@ -64,7 +75,8 @@ class Rest implements \Magento\App\FrontControllerInterface \Magento\ObjectManager $objectManager, \Magento\App\State $appState, \Magento\Oauth\OauthInterface $oauthService, - \Magento\Oauth\Helper\Request $oauthHelper + \Magento\Oauth\Helper\Request $oauthHelper, + AuthorizationService $authorizationService ) { $this->_router = $router; $this->_request = $request; @@ -73,6 +85,7 @@ class Rest implements \Magento\App\FrontControllerInterface $this->_appState = $appState; $this->_oauthService = $oauthService; $this->_oauthHelper = $oauthHelper; + $this->_authorizationService = $authorizationService; } /** @@ -100,15 +113,30 @@ class Rest implements \Magento\App\FrontControllerInterface if (!$this->_appState->isInstalled()) { throw new \Magento\Webapi\Exception(__('Magento is not yet installed')); } + // TODO: Consider changing service interface to operate with objects to avoid overhead $requestUrl = $this->_oauthHelper->getRequestUrl($this->_request); $oauthRequest = $this->_oauthHelper->prepareRequest( $this->_request, $requestUrl, $this->_request->getRequestData() ); - $this->_oauthService->validateAccessTokenRequest( + $consumerId = $this->_oauthService->validateAccessTokenRequest( $oauthRequest, $requestUrl, $this->_request->getMethod() ); + $this->_request->setConsumerId($consumerId); + $route = $this->_router->match($this->_request); + if (!$this->_authorizationService->isAllowed($route->getAclResources())) { + // TODO: Consider passing Integration ID instead of Consumer ID + throw new \Magento\Service\AuthorizationException( + "Not Authorized.", + 0, + null, + array(), + 'authorization', + "Consumer ID = {$consumerId}", + implode($route->getAclResources(), ', ')); + } + if ($route->isSecure() && !$this->_request->isSecure()) { throw new \Magento\Webapi\Exception(__('Operation allowed only in HTTPS')); } diff --git a/app/code/Magento/Webapi/Controller/Rest/Router/Route.php b/app/code/Magento/Webapi/Controller/Rest/Router/Route.php index 50b5b8964ba5f5ae8a6112ecb792b18a1e8431ac..3d6018838a1797d60cc9179142d0313cbbbd1948 100644 --- a/app/code/Magento/Webapi/Controller/Rest/Router/Route.php +++ b/app/code/Magento/Webapi/Controller/Rest/Router/Route.php @@ -36,6 +36,9 @@ class Route extends \Zend_Controller_Router_Route /** @var boolean */ protected $_secure; + /** @var array */ + protected $_aclResources = array(); + /** * Set service class. * @@ -102,6 +105,26 @@ class Route extends \Zend_Controller_Router_Route return $this->_secure; } + /** + * Set ACL resources list. + * + * @param array $aclResources + */ + public function setAclResources($aclResources) + { + $this->_aclResources = $aclResources; + } + + /** + * Get ACL resources list. + * + * @return array + */ + public function getAclResources() + { + return $this->_aclResources; + } + /** * Matches a Request with parts defined by a map. Assigns and * returns an array of variables on a successful match. diff --git a/app/code/Magento/Webapi/Controller/Soap.php b/app/code/Magento/Webapi/Controller/Soap.php index b326d47dc3a3222f4ac1e3727d5faea75f447dd0..0250903e6e51499fe9949c6905dd38b2ba64849e 100644 --- a/app/code/Magento/Webapi/Controller/Soap.php +++ b/app/code/Magento/Webapi/Controller/Soap.php @@ -25,6 +25,9 @@ */ namespace Magento\Webapi\Controller; +use Magento\Webapi\Exception as WebapiException; +use Magento\Service\AuthorizationException; + /** * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -114,7 +117,7 @@ class Soap implements \Magento\App\FrontControllerInterface $request->setPathInfo('/' . implode('/', $pathParts)); try { if (!$this->_appState->isInstalled()) { - throw new \Magento\Webapi\Exception(__('Magento is not yet installed')); + throw new WebapiException(__('Magento is not yet installed')); } if ($this->_isWsdlRequest()) { $responseBody = $this->_wsdlGenerator->generate( @@ -123,7 +126,8 @@ class Soap implements \Magento\App\FrontControllerInterface ); $this->_setResponseContentType(self::CONTENT_TYPE_WSDL_REQUEST); } else { - $this->_oauthService->validateAccessToken($this->_getAccessToken()); + $consumerId = $this->_oauthService->validateAccessToken($this->_getAccessToken()); + $this->_request->setConsumerId($consumerId); $responseBody = $this->_soapServer->handle(); $this->_setResponseContentType(self::CONTENT_TYPE_SOAP_CALL); } @@ -145,15 +149,21 @@ class Soap implements \Magento\App\FrontControllerInterface } /** - * Parse the Authorization header and return the access token - * eg Authorization: Bearer <access-token> + * Parse the Authorization header and return the access token e.g. Authorization: Bearer <access-token> * * @return string Access token + * @throws AuthorizationException */ protected function _getAccessToken() { - $token = explode(' ', $_SERVER['HTTP_AUTHORIZATION']); - return $token[1]; + if (isset($_SERVER['HTTP_AUTHORIZATION'])) { + $token = explode(' ', $_SERVER['HTTP_AUTHORIZATION']); + if (isset($token[1]) && is_string($token[1])) { + return $token[1]; + } + throw new AuthorizationException(__('Authentication header format is invalid.')); + } + throw new AuthorizationException(__('Authentication header is absent.')); } /** diff --git a/app/code/Magento/Webapi/Controller/Soap/Handler.php b/app/code/Magento/Webapi/Controller/Soap/Handler.php index ec4a301ceed1358264b676cb50df86b48d9095aa..d06fc11c2bcbacb1de7da2c5e79ce57c630925a9 100644 --- a/app/code/Magento/Webapi/Controller/Soap/Handler.php +++ b/app/code/Magento/Webapi/Controller/Soap/Handler.php @@ -1,9 +1,5 @@ <?php /** - * Handler of requests to SOAP server. - * - * The main responsibility is to instantiate proper action controller (service) and execute requested method on it. - * * Magento * * NOTICE OF LICENSE @@ -25,36 +21,54 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Webapi\Controller\Soap; +use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationService; +use Magento\Webapi\Model\Soap\Config as SoapConfig; +use Magento\Webapi\Controller\Soap\Request as SoapRequest; +use Magento\Webapi\Exception as WebapiException; +use Magento\Service\AuthorizationException; + +/** + * Handler of requests to SOAP server. + * + * The main responsibility is to instantiate proper action controller (service) and execute requested method on it. + */ class Handler { const RESULT_NODE_NAME = 'result'; - /** @var \Magento\Webapi\Controller\Soap\Request */ + /** @var SoapRequest */ protected $_request; /** @var \Magento\ObjectManager */ protected $_objectManager; - /** @var \Magento\Webapi\Model\Soap\Config */ + /** @var SoapConfig */ protected $_apiConfig; + /** @var AuthorizationService */ + protected $_authorizationService; + /** * Initialize dependencies. * - * @param \Magento\Webapi\Controller\Soap\Request $request + * @param SoapRequest $request * @param \Magento\ObjectManager $objectManager - * @param \Magento\Webapi\Model\Soap\Config $apiConfig + * @param SoapConfig $apiConfig + * @param AuthorizationService $authorizationService */ public function __construct( - \Magento\Webapi\Controller\Soap\Request $request, + SoapRequest $request, \Magento\ObjectManager $objectManager, - \Magento\Webapi\Model\Soap\Config $apiConfig + SoapConfig $apiConfig, + AuthorizationService $authorizationService ) { $this->_request = $request; $this->_objectManager = $objectManager; $this->_apiConfig = $apiConfig; + $this->_authorizationService = $authorizationService; } /** @@ -63,20 +77,33 @@ class Handler * @param string $operation * @param array $arguments * @return \stdClass|null - * @throws \Magento\Webapi\Exception|\LogicException + * @throws WebapiException + * @throws \LogicException + * @throws AuthorizationException */ public function __call($operation, $arguments) { $requestedServices = $this->_request->getRequestedServices(); $serviceMethodInfo = $this->_apiConfig->getServiceMethodInfo($operation, $requestedServices); - $serviceClass = $serviceMethodInfo[\Magento\Webapi\Model\Soap\Config::KEY_CLASS]; - $serviceMethod = $serviceMethodInfo[\Magento\Webapi\Model\Soap\Config::KEY_METHOD]; + $serviceClass = $serviceMethodInfo[SoapConfig::KEY_CLASS]; + $serviceMethod = $serviceMethodInfo[SoapConfig::KEY_METHOD]; // check if the operation is a secure operation & whether the request was made in HTTPS - if ($serviceMethodInfo[\Magento\Webapi\Model\Soap\Config::KEY_IS_SECURE] && !$this->_request->isSecure()) { - throw new \Magento\Webapi\Exception(__("Operation allowed only in HTTPS")); + if ($serviceMethodInfo[SoapConfig::KEY_IS_SECURE] && !$this->_request->isSecure()) { + throw new WebapiException(__("Operation allowed only in HTTPS")); } + if (!$this->_authorizationService->isAllowed($serviceMethodInfo[SoapConfig::KEY_ACL_RESOURCES])) { + // TODO: Consider passing Integration ID instead of Consumer ID + throw new AuthorizationException( + "Not Authorized.", + 0, + null, + array(), + 'authorization', + "Consumer ID = {$this->_request->getConsumerId()}", + implode($serviceMethodInfo[SoapConfig::KEY_ACL_RESOURCES], ', ')); + } $service = $this->_objectManager->get($serviceClass); $outputData = $service->$serviceMethod($this->_prepareParameters($arguments)); if (!is_array($outputData)) { diff --git a/app/code/Magento/Webapi/Model/Acl/Builder.php b/app/code/Magento/Webapi/Model/Acl/Builder.php deleted file mode 100644 index 06692277d7920234549f797693d13a8fa6d7e0f0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Builder.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * WebAPI ACL Builder - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class Builder extends \Magento\Acl\Builder -{ - /** - * @param \Magento\AclFactory $aclFactory - * @param \Magento\Acl\CacheInterface $cache - * @param \Magento\Acl\LoaderInterface $roleLoader - * @param \Magento\Acl\LoaderInterface $resourceLoader - * @param \Magento\Acl\LoaderInterface $ruleLoader - */ - public function __construct( - \Magento\AclFactory $aclFactory, - \Magento\Acl\CacheInterface $cache, - \Magento\Acl\LoaderInterface $roleLoader, - \Magento\Acl\LoaderInterface $resourceLoader, - \Magento\Acl\LoaderInterface $ruleLoader - ) { - parent::__construct($aclFactory, $cache, $roleLoader, $resourceLoader, $ruleLoader); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Cache.php b/app/code/Magento/Webapi/Model/Acl/Cache.php deleted file mode 100644 index a988190ece65ebb5501278ca6d8cdcc91116f400..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Cache.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php -/** - * Webapi ACL cache - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class Cache extends \Magento\Core\Model\Acl\Cache -{ - /** - * @param \Magento\App\Cache\Type\Config $cache - * @param string $cacheKey - */ - public function __construct(\Magento\App\Cache\Type\Config $cache, $cacheKey) - { - parent::__construct($cache, $cacheKey); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/Config/Converter/Dom.php b/app/code/Magento/Webapi/Model/Acl/Resource/Config/Converter/Dom.php deleted file mode 100644 index b099f6d65b91c6ce2808024f3a9cd20ff525d91e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Resource/Config/Converter/Dom.php +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource\Config\Converter; - -class Dom extends \Magento\Acl\Resource\Config\Converter\Dom -{ - /** - * {@inheritdoc} - */ - public function convert($source) - { - $aclResourceConfig = parent::convert($source); - $aclResourceConfig['config']['mapping'] = array(); - $xpath = new \DOMXPath($source); - /** @var $mappingNode \DOMNode */ - foreach ($xpath->query('/config/mapping/resource') as $mappingNode) { - $mappingData = array(); - $mappingAttributes = $mappingNode->attributes; - $idNode = $mappingAttributes->getNamedItem('id'); - if (is_null($idNode)) { - throw new \Exception('Attribute "id" is required for ACL resource mapping.'); - } - $mappingData['id'] = $idNode->nodeValue; - - $parentNode = $mappingAttributes->getNamedItem('parent'); - if (is_null($parentNode)) { - throw new \Exception('Attribute "parent" is required for ACL resource mapping.'); - } - $mappingData['parent'] = $parentNode->nodeValue; - $aclResourceConfig['config']['mapping'][] = $mappingData; - } - return $aclResourceConfig; - } -} - diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/Config/Reader/Filesystem.php b/app/code/Magento/Webapi/Model/Acl/Resource/Config/Reader/Filesystem.php deleted file mode 100644 index 833ba2a45c410a332c9d18b93168c46e7a3b5c04..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Resource/Config/Reader/Filesystem.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource\Config\Reader; - -class Filesystem extends \Magento\Config\Reader\Filesystem -{ - /** - * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Config\ConverterInterface $converter - * @param \Magento\Webapi\Model\Acl\Resource\Config\SchemaLocator $schemaLocator - * @param \Magento\Config\ValidationStateInterface $validationState - * @param string $fileName - * @param array $idAttributes - * @param string $domDocumentClass - */ - public function __construct( - \Magento\Config\FileResolverInterface $fileResolver, - \Magento\Config\ConverterInterface $converter, - \Magento\Webapi\Model\Acl\Resource\Config\SchemaLocator $schemaLocator, - \Magento\Config\ValidationStateInterface $validationState, - $fileName = 'acl.xml', - $idAttributes = array(), - $domDocumentClass = 'Magento\Acl\Resource\Config\Dom' - ) { - parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass, - 'webapi' - ); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php b/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php deleted file mode 100644 index 80d46cc003b2289f38e391f25dd73d4253ac8e49..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocator.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * ACL resources configuration schema locator - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource\Config; - -class SchemaLocator implements \Magento\Config\SchemaLocatorInterface -{ - /** - * Path to corresponding XSD file with validation rules for merged config - * - * @var string - */ - protected $_schema = null; - - /** - * Path to corresponding XSD file with validation rules for separate config files - * - * @var string - */ - protected $_perFileSchema; - - /** - * @param \Magento\Module\Dir\Reader $moduleReader - */ - public function __construct(\Magento\Module\Dir\Reader $moduleReader) - { - $this->_schema = $moduleReader->getModuleDir('etc', 'Magento_Webapi') . DIRECTORY_SEPARATOR . 'acl.xsd'; - } - - /** - * Get path to merged config schema - * - * @return string|null - */ - public function getSchema() - { - return $this->_schema; - } - - /** - * Get path to pre file validation schema - * - * @return string|null - */ - public function getPerFileSchema() - { - return $this->_perFileSchema; - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/Provider.php b/app/code/Magento/Webapi/Model/Acl/Resource/Provider.php deleted file mode 100644 index f700a4c82518254e04122e926f9e50e1cfd8fb3f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Resource/Provider.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource; - -class Provider implements \Magento\Webapi\Model\Acl\Resource\ProviderInterface -{ - /** - * @var \Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem - */ - protected $_configReader; - - /** - * @var \Magento\Acl\Resource\TreeBuilder - */ - protected $_resourceTreeBuilder; - - /** - * @var \Magento\Config\ScopeInterface - */ - protected $_scope; - - /** - * @param \Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem $configReader - * @param \Magento\Config\ScopeInterface $scope - * @param \Magento\Acl\Resource\TreeBuilder $resourceTreeBuilder - */ - public function __construct( - \Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem $configReader, - \Magento\Config\ScopeInterface $scope, - \Magento\Acl\Resource\TreeBuilder $resourceTreeBuilder - ) { - $this->_configReader = $configReader; - $this->_scope = $scope; - $this->_resourceTreeBuilder = $resourceTreeBuilder; - } - - /** - * {@inheritdoc} - */ - public function getAclResources() - { - $aclResourceConfig = $this->_configReader->read(); - if (!empty($aclResourceConfig['config']['acl']['resources'])) { - return $this->_resourceTreeBuilder->build($aclResourceConfig['config']['acl']['resources']); - } - return array(); - } - - /** - * {@inheritdoc} - */ - public function getAclVirtualResources() - { - $aclResourceConfig = $this->_configReader->read(); - return isset($aclResourceConfig['config']['mapping']) ? $aclResourceConfig['config']['mapping'] : array(); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Resource/ProviderInterface.php b/app/code/Magento/Webapi/Model/Acl/Resource/ProviderInterface.php deleted file mode 100644 index 76ab71017bdd3062d891d3132e306537b0feebc8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Resource/ProviderInterface.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Web API ACL resources provider interface - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource; - -interface ProviderInterface extends \Magento\Acl\Resource\ProviderInterface -{ - /** - * Retrieve ACL Virtual Resources. - * - * Virtual resources are not shown in resource list, they use existing resource to check permission. - * - * @return array - */ - public function getAclVirtualResources(); -} - diff --git a/app/code/Magento/Webapi/Model/Acl/Role.php b/app/code/Magento/Webapi/Model/Acl/Role.php deleted file mode 100644 index baa250f5ea3304c855acec3877d533301262201b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Role.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/** - * Role item model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class Role extends \Magento\Core\Model\AbstractModel -{ - /** - * Prefix of model events names. - * - * @var string - */ - protected $_eventPrefix = 'webapi_role'; - - /** - * Initialize resource. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Resource\Acl\Role'); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Role/Factory.php b/app/code/Magento/Webapi/Model/Acl/Role/Factory.php deleted file mode 100644 index eb23babb6227810537ed551f9d00e1f8585bb308..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Role/Factory.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * ACL Role factory. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class Factory -{ - const CLASS_NAME = 'Magento\Webapi\Model\Acl\Role'; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create ACL role model. - * - * @param array $arguments - * @return \Magento\Webapi\Model\Acl\Role - */ - public function create(array $arguments = array()) - { - return $this->_objectManager->create(self::CLASS_NAME, $arguments); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Role/InRoleUserUpdater.php b/app/code/Magento/Webapi/Model/Acl/Role/InRoleUserUpdater.php deleted file mode 100644 index 76b6d57ce5b58521960399f49fc6a8e1a0a6f6d2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Role/InRoleUserUpdater.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * Users in role grid "In Role User" column with checkbox updater. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class InRoleUserUpdater implements \Magento\Core\Model\Layout\Argument\UpdaterInterface -{ - /** - * @var int - */ - protected $_roleId; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\User - */ - protected $_userResource; - - /** - * Constructor. - * - * @param \Magento\App\RequestInterface $request - * @param \Magento\Webapi\Model\Resource\Acl\User $userResource - */ - public function __construct( - \Magento\App\RequestInterface $request, - \Magento\Webapi\Model\Resource\Acl\User $userResource - ) { - $this->_roleId = (int)$request->getParam('role_id'); - $this->_userResource = $userResource; - } - - /** - * Init values with users assigned to role. - * - * @param array|null $values - * @return array|null - */ - public function update($values) - { - if ($this->_roleId) { - $values = $this->_userResource->getRoleUsers($this->_roleId); - } - return $values; - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Role/UsersUpdater.php b/app/code/Magento/Webapi/Model/Acl/Role/UsersUpdater.php deleted file mode 100644 index cefc4bfa97039d4e31b802bbc1c349dca2ffd3f7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Role/UsersUpdater.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * Users in role grid items updater. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class UsersUpdater implements \Magento\Core\Model\Layout\Argument\UpdaterInterface -{ - /** - * Filter name for users by role. - */ - const IN_ROLE_USERS_PARAMETER = 'in_role_users'; - - /**#@+ - * Supported values of filtering users by role. - */ - const IN_ROLE_USERS_ANY = 1; - const IN_ROLE_USERS_YES = 2; - const IN_ROLE_USERS_NO = 3; - /**#@-*/ - - /** - * @var int - */ - protected $_roleId; - - /** - * @var \Magento\App\RequestInterface - */ - protected $_inRoleUsersFilter; - - /** - * Constructor. - * - * @param \Magento\App\RequestInterface $request - * @param \Magento\Backend\Helper\Data $backendHelper - */ - public function __construct( - \Magento\App\RequestInterface $request, - \Magento\Backend\Helper\Data $backendHelper - ) { - $this->_roleId = (int)$request->getParam('role_id'); - $this->_inRoleUsersFilter = $this->_parseInRoleUsersFilter($request, $backendHelper); - } - - /** - * Parse $_inRoleUsersFilter value from request - * - * @param \Magento\App\RequestInterface $request - * @param \Magento\Backend\Helper\Data $backendHelper - * @return int - */ - protected function _parseInRoleUsersFilter( - \Magento\App\RequestInterface $request, - \Magento\Backend\Helper\Data $backendHelper - ) { - $result = self::IN_ROLE_USERS_ANY; - $filter = $backendHelper->prepareFilterString($request->getParam('filter', '')); - if (isset($filter[self::IN_ROLE_USERS_PARAMETER])) { - $result = $filter[self::IN_ROLE_USERS_PARAMETER] ? self::IN_ROLE_USERS_YES : self::IN_ROLE_USERS_NO; - } elseif (!$request->isAjax()) { - $result = self::IN_ROLE_USERS_YES; - } - return $result; - } - - /** - * Add filtering users by role. - * - * @param \Magento\Webapi\Model\Resource\Acl\User\Collection $collection - * @return \Magento\Webapi\Model\Resource\Acl\User\Collection - */ - public function update($collection) - { - if ($this->_roleId) { - switch ($this->_inRoleUsersFilter) { - case self::IN_ROLE_USERS_YES: - $collection->addFieldToFilter('role_id', $this->_roleId); - break; - case self::IN_ROLE_USERS_NO: - $collection->addFieldToFilter('role_id', array( - array('neq' => $this->_roleId), - array('is' => new \Zend_Db_Expr('NULL')) - )); - break; - } - } - return $collection; - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Rule.php b/app/code/Magento/Webapi/Model/Acl/Rule.php deleted file mode 100644 index 5bfd02e78003eeec1367d3a2324c219492feee73..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Rule.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Web API ACL Rules. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method int getRoleId() getRoleId() - * @method \Magento\Webapi\Model\Acl\Rule setRoleId() setRoleId(int $value) - * @method string getResourceId() getResourceId() - * @method \Magento\Webapi\Model\Resource\Acl\Rule getResource() getResource() - * @method \Magento\Webapi\Model\Resource\Acl\Rule\Collection getCollection() getCollection() - * @method \Magento\Webapi\Model\Acl\Rule setResourceId() setResourceId(string $value) - * @method \Magento\Webapi\Model\Acl\Rule setResources() setResources(array $resources) - * @method array getResources() getResources() - */ -namespace Magento\Webapi\Model\Acl; - -class Rule extends \Magento\Core\Model\AbstractModel -{ - /** - * Web API ACL resource separator. - */ - const RESOURCE_SEPARATOR = '/'; - - /** - * Constructor. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Resource\Acl\Rule'); - } - - /** - * Save role resources. - * - * @return \Magento\Webapi\Model\Acl\Rule - */ - public function saveResources() - { - $this->getResource()->saveResources($this); - return $this; - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/Rule/Factory.php b/app/code/Magento/Webapi/Model/Acl/Rule/Factory.php deleted file mode 100644 index abac37a3fc7c8b80dd88964242a2be8929814b3b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/Rule/Factory.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * ACL Role factory. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Rule; - -class Factory -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create a new instance of \Magento\Webapi\Model\Acl\Rule - * - * @param array $arguments fed into constructor - * @return \Magento\Webapi\Model\Acl\Rule - */ - public function create(array $arguments = array()) - { - return $this->_objectManager->create('Magento\Webapi\Model\Acl\Rule', $arguments); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/User.php b/app/code/Magento/Webapi/Model/Acl/User.php deleted file mode 100644 index a7765f45acfa58ba5b7185f014e8fc19700c46b5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/User.php +++ /dev/null @@ -1,106 +0,0 @@ -<?php -/** - * Web API User model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method \Magento\Webapi\Model\Acl\User setRoleId() setRoleId(int $id) - * @method int getRoleId() getRoleId() - * @method \Magento\Webapi\Model\Acl\User setApiKey() setApiKey(string $apiKey) - * @method string getApiKey() getApiKey() - * @method \Magento\Webapi\Model\Acl\User setContactEmail() setContactEmail(string $contactEmail) - * @method string getContactEmail() getContactEmail() - * @method \Magento\Webapi\Model\Acl\User setSecret() setSecret(string $secret) - * @method \Magento\Webapi\Model\Acl\User setCompanyName() setCompanyName(string $companyName) - * @method string getCompanyName() getCompanyName() - */ -namespace Magento\Webapi\Model\Acl; - -class User extends \Magento\Core\Model\AbstractModel -{ - /** - * Prefix of model events names. - * - * @var string - */ - protected $_eventPrefix = 'webapi_user'; - - /** - * Initialize resource model. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Resource\Acl\User'); - } - - /** - * Get role users. - * - * @param integer $roleId - * @return array - */ - public function getRoleUsers($roleId) - { - return $this->getResource()->getRoleUsers($roleId); - } - - /** - * Load user by key. - * - * @param string $key - * @return \Magento\Webapi\Model\Acl\User - */ - public function loadByKey($key) - { - return $this->load($key, 'api_key'); - } - - /** - * Get consumer key. - * - * @return string - */ - public function getKey() - { - return $this->getData('key'); - } - - /** - * Get consumer secret. - * - * @return string - */ - public function getSecret() - { - return $this->getData('secret'); - } - - /** - * Get consumer callback URL. - * - * @return string - */ - public function getCallBackUrl() - { - return ''; - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/User/Factory.php b/app/code/Magento/Webapi/Model/Acl/User/Factory.php deleted file mode 100644 index 142afb7de443793b1e0a8537b31e2b3d59258e49..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/User/Factory.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * ACL User factory. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\User; - -class Factory extends \Magento\Integration\Model\Oauth\Consumer\Factory -{ - const CLASS_NAME = 'Magento\Webapi\Model\Acl\User'; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create ACL user model. - * - * @param array $arguments - * @return \Magento\Webapi\Model\Acl\User - */ - public function create(array $arguments = array()) - { - return $this->_objectManager->create(self::CLASS_NAME, $arguments); - } -} diff --git a/app/code/Magento/Webapi/Model/Acl/User/RoleUpdater.php b/app/code/Magento/Webapi/Model/Acl/User/RoleUpdater.php deleted file mode 100644 index 5e3b3e310098bf66ad1eb225ba636fdf0bb6188d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Acl/User/RoleUpdater.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * User role in role grid items updater. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\User; - -class RoleUpdater implements \Magento\Core\Model\Layout\Argument\UpdaterInterface -{ - /** - * @var int - */ - protected $_userId; - - /** - * @var \Magento\Webapi\Model\Acl\User\Factory - */ - protected $_userFactory; - - /** - * Constructor. - * - * @param \Magento\App\RequestInterface $request - * @param \Magento\Webapi\Model\Acl\User\Factory $userFactory - */ - public function __construct( - \Magento\App\RequestInterface $request, - \Magento\Webapi\Model\Acl\User\Factory $userFactory - ) { - $this->_userId = (int)$request->getParam('user_id'); - $this->_userFactory = $userFactory; - } - - /** - * Initialize value with role assigned to user. - * - * @param int|null $value - * @return int|null - */ - public function update($value) - { - if ($this->_userId) { - $value = $this->_userFactory->create()->load($this->_userId)->getRoleId(); - } - return $value; - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Loader/Resource.php b/app/code/Magento/Webapi/Model/Authorization/Loader/Resource.php deleted file mode 100644 index 5f8268c04bbdaa41ee969705a54cc6219f3b3e82..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Loader/Resource.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * API ACL Resource Loader. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -/** - * Class \Magento\Webapi\Model\Authorization\Loader\Resource - */ -class Resource extends \Magento\Acl\Loader\Resource -{ - /** - * @param \Magento\Webapi\Model\Acl\Resource\ProviderInterface $resourceProvider - * @param \Magento\Acl\ResourceFactory $resourceFactory - */ - public function __construct( - \Magento\Webapi\Model\Acl\Resource\ProviderInterface $resourceProvider, - \Magento\Acl\ResourceFactory $resourceFactory - ) { - parent::__construct($resourceProvider, $resourceFactory); - } - - /** - * Deny each resource for all roles. - * - * @param \Magento\Acl $acl - */ - protected function _denyResources(\Magento\Acl $acl) - { - foreach ($acl->getResources() as $aclResource) { - $acl->deny(null, $aclResource); - } - } - - /** - * Load virtual resources as sub-resources of existing one. - * - * @param \Magento\Acl $acl - */ - protected function _loadVirtualResources(\Magento\Acl $acl) - { - $virtualResources = $this->_resourceProvider->getAclVirtualResources(); - foreach ($virtualResources as $virtualResource) { - $resourceParent = $virtualResource['parent']; - $resourceId = $virtualResource['id']; - if ($acl->has($resourceParent) && !$acl->has($resourceId)) { - /** @var $resource \Magento\Acl\Resource */ - $resource = $this->_resourceFactory->createResource(array('resourceId' => $resourceId)); - $acl->addResource($resource, $resourceParent); - } - } - } - - /** - * Populate ACL with resources from external storage. - * - * @param \Magento\Acl $acl - * @throws \Magento\Core\Exception - */ - public function populateAcl(\Magento\Acl $acl) - { - parent::populateAcl($acl); - $this->_denyResources($acl); - $this->_loadVirtualResources($acl); - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Loader/Role.php b/app/code/Magento/Webapi/Model/Authorization/Loader/Role.php deleted file mode 100644 index b7ef7cb2db90f1621d6204377815f045bb6ff595..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Loader/Role.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * API ACL Role Loader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -class Role implements \Magento\Acl\LoaderInterface -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Role - */ - protected $_roleResource; - - /** - * @var \Magento\Webapi\Model\Authorization\Role\Factory - */ - protected $_roleFactory; - - /** - * @var \Magento\Core\Model\Config - */ - protected $_config; - - /** - * @param \Magento\Webapi\Model\Resource\Acl\Role $roleResource - * @param \Magento\Webapi\Model\Authorization\Role\Factory $roleFactory - */ - public function __construct(\Magento\Webapi\Model\Resource\Acl\Role $roleResource, - \Magento\Webapi\Model\Authorization\Role\Factory $roleFactory - ) { - $this->_roleResource = $roleResource; - $this->_roleFactory = $roleFactory; - } - - /** - * Populate ACL with roles from external storage. - * - * @param \Magento\Acl $acl - */ - public function populateAcl(\Magento\Acl $acl) - { - $roleList = $this->_roleResource->getRolesIds(); - foreach ($roleList as $roleId) { - /** @var $aclRole \Magento\Webapi\Model\Authorization\Role */ - $aclRole = $this->_roleFactory->createRole(array('roleId' => $roleId)); - $acl->addRole($aclRole); - //Deny all privileges to Role. Some of them could be allowed later by whitelist - $acl->deny($aclRole); - } - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Loader/Rule.php b/app/code/Magento/Webapi/Model/Authorization/Loader/Rule.php deleted file mode 100644 index ab355186a9b65e9e3ca5d59e980f77062e292f31..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Loader/Rule.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * API ACL Rule Loader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -class Rule implements \Magento\Acl\LoaderInterface -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule - */ - protected $_ruleResource; - - /** - * @param \Magento\Webapi\Model\Resource\Acl\Rule $ruleResource - */ - public function __construct(\Magento\Webapi\Model\Resource\Acl\Rule $ruleResource) - { - $this->_ruleResource = $ruleResource; - } - - /** - * Populate ACL with rules from external storage. - * - * @param \Magento\Acl $acl - */ - public function populateAcl(\Magento\Acl $acl) - { - $ruleList = $this->_ruleResource->getRuleList(); - foreach ($ruleList as $rule) { - $role = $rule['role_id']; - $resource = $rule['resource_id']; - if ($acl->hasRole($role) && $acl->has($resource)) { - $acl->allow($role, $resource); - } - } - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Policy/Acl.php b/app/code/Magento/Webapi/Model/Authorization/Policy/Acl.php deleted file mode 100644 index cd41a0c046cef0ba8b6b06e3664bd5e3a42cf780..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Policy/Acl.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * WebAPI ACL Policy - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Policy; - -class Acl extends \Magento\Authorization\Policy\Acl -{ - /** - * @param \Magento\Acl\Builder $aclBuilder - */ - public function __construct(\Magento\Acl\Builder $aclBuilder) - { - parent::__construct($aclBuilder); - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Role/Factory.php b/app/code/Magento/Webapi/Model/Authorization/Role/Factory.php deleted file mode 100644 index 0fd6e206eefa50c13328ced0b8a6dcf5b4c74574..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Role/Factory.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Factory for \Magento\Webapi\Model\Authorization\Role - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Role; - -class Factory -{ - const ROLE_CLASS_NAME = 'Magento\Webapi\Model\Authorization\Role'; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Return new ACL role model. - * - * @param array $arguments - * @return \Magento\Webapi\Model\Authorization\Role - */ - public function createRole(array $arguments = array()) - { - return $this->_objectManager->create(self::ROLE_CLASS_NAME, $arguments); - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/Role/Locator/Factory.php b/app/code/Magento/Webapi/Model/Authorization/Role/Locator/Factory.php deleted file mode 100644 index f097c59156eea39ae41c2e0faba356407e0c89c7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/Role/Locator/Factory.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Factory for \Magento\Webapi\Model\Authorization\RoleLocator - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Role\Locator; - -class Factory -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create a new instance of \Magento\Webapi\Model\Authorization\RoleLocator - * - * @param array $arguments fed into constructor - * @return \Magento\Webapi\Model\Authorization\RoleLocator - */ - public function create(array $arguments = array()) - { - return $this->_objectManager->create('Magento\Webapi\Model\Authorization\RoleLocator', $arguments); - } -} diff --git a/app/code/Magento/Webapi/Model/Authorization/RoleLocator.php b/app/code/Magento/Webapi/Model/Authorization/RoleLocator.php deleted file mode 100644 index 807e21789f7408f46c2f0679c6dc662bb96fe5b7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Authorization/RoleLocator.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * API ACL RoleLocator - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization; - -class RoleLocator implements \Magento\Authorization\RoleLocator -{ - /** - * @var string|null - */ - protected $_roleId = null; - - /** - * Initialize role ID. - * - * @param array $data - */ - public function __construct(array $data = array()) - { - $this->_roleId = isset($data['roleId']) ? $data['roleId'] : null; - } - - /** - * Set role ID into role locator. - * - * @param string $roleId - */ - public function setRoleId($roleId) - { - $this->_roleId = $roleId; - } - - /** - * Retrieve current role. - * - * @return string|null - */ - public function getAclRoleId() - { - return $this->_roleId; - } -} diff --git a/app/code/Magento/Webapi/Model/Authz/UserLocator.php b/app/code/Magento/Webapi/Model/Authz/UserLocator.php new file mode 100644 index 0000000000000000000000000000000000000000..b21568822c7108293889fc6f3f4a4cc70cb2bb93 --- /dev/null +++ b/app/code/Magento/Webapi/Model/Authz/UserLocator.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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webapi\Model\Authz; + +use Magento\Authz\Model\UserLocatorInterface; +use Magento\Authz\Model\UserIdentifier; +use Magento\Webapi\Controller\Request as Request; +use Magento\Integration\Model\Integration\Factory as IntegrationFactory; + +/** + * Web API user locator. + */ +class UserLocator implements UserLocatorInterface +{ + /** @var Request */ + protected $_request; + + /** @var IntegrationFactory */ + protected $_integrationFactory; + + /** + * Initialize dependencies. + * + * @param Request $request + * @param IntegrationFactory $integrationFactory + */ + public function __construct(Request $request, IntegrationFactory $integrationFactory) + { + $this->_request = $request; + $this->_integrationFactory = $integrationFactory; + } + + /** + * {@inheritdoc} + */ + public function getUserId() + { + $consumerId = $this->_request->getConsumerId(); + $integration = $this->_integrationFactory->create()->loadByConsumerId($consumerId); + return $integration->getId() ? (int)$integration->getId() : 0; + } + + /** + * {@inheritdoc} + */ + public function getUserType() + { + return UserIdentifier::USER_TYPE_INTEGRATION; + } +} diff --git a/app/code/Magento/Webapi/Model/Config/Converter.php b/app/code/Magento/Webapi/Model/Config/Converter.php index 9a513f74208774b420f4eaf1458be76623d39ef1..b237fe0fbe1b6ee429af6639425f7b5704e6ac1f 100644 --- a/app/code/Magento/Webapi/Model/Config/Converter.php +++ b/app/code/Magento/Webapi/Model/Config/Converter.php @@ -38,6 +38,7 @@ class Converter implements \Magento\Config\ConverterInterface const KEY_HTTP_METHOD = 'httpMethod'; const KEY_SERVICE_METHODS = 'methods'; const KEY_METHOD_ROUTE = 'route'; + const KEY_ACL_RESOURCES = 'resources'; /**#@-*/ /** @@ -74,6 +75,12 @@ class Converter implements \Magento\Config\ConverterInterface } $httpMethod = $restRoute->attributes->getNamedItem('httpMethod')->nodeValue; $method = $restRoute->attributes->getNamedItem('method')->nodeValue; + + $resources = $restRoute->attributes->getNamedItem('resources')->nodeValue; + /** Allow whitespace usage after comma. */ + $resources = str_replace(', ', ',', $resources); + $resources = explode(',', $resources); + $isSecureAttribute = $restRoute->attributes->getNamedItem('isSecure'); $isSecure = $isSecureAttribute ? true : false; $path = (string)$restRoute->nodeValue; @@ -82,7 +89,8 @@ class Converter implements \Magento\Config\ConverterInterface self::KEY_HTTP_METHOD => $httpMethod, self::KEY_SERVICE_METHOD => $method, self::KEY_METHOD_ROUTE => $path, - self::KEY_IS_SECURE => $isSecure + self::KEY_IS_SECURE => $isSecure, + self::KEY_ACL_RESOURCES => $resources ); } } diff --git a/app/code/Magento/Webapi/Model/Config/Integration/Reader.php b/app/code/Magento/Webapi/Model/Config/Integration/Reader.php index 8464c16404f54ba650c4aac6b792707b4932fda4..7a8637f50d7f9ead9a63d19030e41ccf1d2ea6a9 100644 --- a/app/code/Magento/Webapi/Model/Config/Integration/Reader.php +++ b/app/code/Magento/Webapi/Model/Config/Integration/Reader.php @@ -40,18 +40,33 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Webapi\Model\Config\Integration\Converter $converter - * @param \Magento\Webapi\Model\Config\Integration\SchemaLocator $schemeLocator + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Webapi\Model\Config\Integration\Converter $converter, - \Magento\Webapi\Model\Config\Integration\SchemaLocator $schemeLocator, + \Magento\Webapi\Model\Config\Integration\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - $fileName = 'integration\api.xml' + $fileName = 'integration\api.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - parent::__construct($fileResolver, $converter, $schemeLocator, $validationState, $fileName); + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope + ); } } diff --git a/app/code/Magento/Webapi/Model/Config/Reader.php b/app/code/Magento/Webapi/Model/Config/Reader.php index 345ba22dc3b695e0e6e5259c7dfa278863bd8954..95131fb9493f0e57b1179e56ee1e5f2c4e6be8a9 100644 --- a/app/code/Magento/Webapi/Model/Config/Reader.php +++ b/app/code/Magento/Webapi/Model/Config/Reader.php @@ -40,18 +40,33 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Webapi\Model\Config\Converter $converter - * @param \Magento\Webapi\Model\Config\SchemaLocator $schemeLocator + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Webapi\Model\Config\Converter $converter, - \Magento\Webapi\Model\Config\SchemaLocator $schemeLocator, + \Magento\Webapi\Model\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - $fileName = 'webapi.xml' + $fileName = 'webapi.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - parent::__construct($fileResolver, $converter, $schemeLocator, $validationState, $fileName); + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope + ); } } diff --git a/app/code/Magento/Webapi/Model/Plugin/IntegrationServiceV1.php b/app/code/Magento/Webapi/Model/Plugin/IntegrationServiceV1.php new file mode 100644 index 0000000000000000000000000000000000000000..2c132adb419425a006941e755642dbe588cea34a --- /dev/null +++ b/app/code/Magento/Webapi/Model/Plugin/IntegrationServiceV1.php @@ -0,0 +1,157 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webapi\Model\Plugin; + +use Magento\Authz\Model\UserIdentifier; +use Magento\Authz\Model\UserIdentifier\Factory as UserIdentifierFactory; +use \Magento\Integration\Model\Integration as IntegrationModel; +use Magento\Authz\Service\AuthorizationV1Interface as AuthorizationInterface; + +/** + * Plugin for \Magento\Integration\Service\IntegrationV1. + */ +class IntegrationServiceV1 +{ + /** @var AuthorizationInterface */ + protected $_authzService; + + /** @var UserIdentifierFactory */ + protected $_userIdentifierFactory; + + /** + * Initialize dependencies. + * + * @param AuthorizationInterface $authzService + * @param UserIdentifierFactory $userIdentifierFactory + */ + public function __construct(AuthorizationInterface $authzService, UserIdentifierFactory $userIdentifierFactory) + { + $this->_authzService = $authzService; + $this->_userIdentifierFactory = $userIdentifierFactory; + } + + /** + * Persist API permissions. + * + * @param IntegrationModel $integration + * @return IntegrationModel + */ + public function afterCreate($integration) + { + $this->_saveApiPermissions($integration); + return $integration; + } + + /** + * Persist API permissions. + * + * @param IntegrationModel $integration + * @return IntegrationModel + */ + public function afterUpdate($integration) + { + $this->_saveApiPermissions($integration); + return $integration; + } + + /** + * Add API permissions to integration data. + * + * @param IntegrationModel $integration + * @return IntegrationModel + */ + public function afterGet($integration) + { + $this->_addAllowedResources($integration); + return $integration; + } + + /** + * Add the list of allowed resources to the integration object data by 'resource' key. + * + * @param IntegrationModel $integration + */ + protected function _addAllowedResources(IntegrationModel $integration) + { + if ($integration->getId()) { + $userIdentifier = $this->_createUserIdentifier($integration->getId()); + $integration->setData('resource', $this->_authzService->getAllowedResources($userIdentifier)); + } + } + + /** + * Persist API permissions. + * + * Permissions are expected to be set to integration object by 'resource' key. + * If 'all_resources' is set and is evaluated to true, permissions to all resources will be granted. + * + * @param IntegrationModel $integration + */ + protected function _saveApiPermissions(IntegrationModel $integration) + { + if ($integration->getId()) { + $userIdentifier = $this->_createUserIdentifier($integration->getId()); + if ($integration->getData('all_resources')) { + $this->_authzService->grantAllPermissions($userIdentifier); + } else if (is_array($integration->getData('resource'))) { + $this->_authzService->grantPermissions($userIdentifier, $integration->getData('resource')); + } else { + $this->_authzService->grantPermissions($userIdentifier, array()); + } + } + } + + /** + * Instantiate new user identifier for an integration. + * + * @param int $integrationId + * @return UserIdentifier + */ + protected function _createUserIdentifier($integrationId) + { + $userIdentifier = $this->_userIdentifierFactory->create( + UserIdentifier::USER_TYPE_INTEGRATION, + (int)$integrationId + ); + return $userIdentifier; + } + + /** + * Process integration resource permissions after the integration is created + * + * @param array $integrationData Data of integration deleted + * @return array $integrationData + */ + public function afterDelete(array $integrationData) + { + //No check needed for integration data since it cannot be empty in the parent invocation - delete + $userIdentifier = $this->_userIdentifierFactory->create( + UserIdentifier::USER_TYPE_INTEGRATION, + (int)$integrationData[IntegrationModel::ID] + ); + $this->_authzService->removePermissions($userIdentifier); + return $integrationData; + } +} diff --git a/app/code/Magento/Webapi/Model/Plugin/Setup.php b/app/code/Magento/Webapi/Model/Plugin/Setup.php index cd58f6141dc22d91e1fc46cdf0253ee3f4478497..3a8d2bfe8be6d8253f8fe3c74ea6f2784c0ae1eb 100644 --- a/app/code/Magento/Webapi/Model/Plugin/Setup.php +++ b/app/code/Magento/Webapi/Model/Plugin/Setup.php @@ -21,6 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Webapi\Model\Plugin; use Magento\Authz\Model\UserIdentifier; @@ -65,8 +66,8 @@ class Setup * Construct Setup plugin instance * * @param \Magento\Webapi\Model\IntegrationConfig $integrationConfig - * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService * @param \Magento\Authz\Service\AuthorizationV1 $authzService + * @param \Magento\Integration\Service\IntegrationV1Interface $integrationService * @param \Magento\Authz\Model\UserIdentifier\Factory $userIdentifierFactory */ public function __construct( @@ -96,11 +97,11 @@ class Setup $integrations = $this->_integrationConfig->getIntegrations(); foreach ($integrationNames as $name) { if (isset($integrations[$name])) { - $integrationData = $this->_integrationService->findByName($name); - if (isset($integrationData[Integration::ID])) { + $integration = $this->_integrationService->findByName($name); + if ($integration->getId()) { $userIdentifier = $this->_userIdentifierFactory->create( UserIdentifier::USER_TYPE_INTEGRATION, - (int)$integrationData[Integration::ID] + $integration->getId() ); $this->_authzService->grantPermissions( $userIdentifier, @@ -111,4 +112,4 @@ class Setup } return $integrationNames; } -} \ No newline at end of file +} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/Role.php b/app/code/Magento/Webapi/Model/Resource/Acl/Role.php deleted file mode 100644 index 91191d8f165f6d285d5c688a9c6aa58c5fec1813..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/Role.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * Web API ACL role resource. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class Role extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Class constructor. - * - * @param \Magento\App\Resource $resource - */ - public function __construct(\Magento\App\Resource $resource) - { - parent::__construct($resource); - } - - /** - * Resource initialization. - */ - protected function _construct() - { - $this->_init('webapi_role', 'role_id'); - } - - /** - * Initialize unique fields. - * - * @return \Magento\Webapi\Model\Resource\Acl\Role - */ - protected function _initUniqueFields() - { - $this->_uniqueFields = array( - array( - 'field' => 'role_name', - 'title' => __('Role Name') - ), - ); - return $this; - } - - /** - * Get roles list for selects. - * - * @return array - */ - public function getRolesList() - { - $adapter = $this->getReadConnection(); - $select = $adapter->select() - ->from($this->getMainTable(), array($this->getIdFieldName(), 'role_name')) - ->order('role_name'); - return $adapter->fetchPairs($select); - } - - /** - * Get all roles IDs. - * - * @return array - */ - public function getRolesIds() - { - $adapter = $this->getReadConnection(); - $select = $adapter->select()->from($this->getMainTable(), array($this->getIdFieldName())); - return $adapter->fetchCol($select); - } -} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/Role/Collection.php b/app/code/Magento/Webapi/Model/Resource/Acl/Role/Collection.php deleted file mode 100644 index 82fbacd4c1e510047b99aecab43c32ca00ee5d01..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/Role/Collection.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Web API Role Resource Collection. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl\Role; - -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Resource collection initialization. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Acl\Role', 'Magento\Webapi\Model\Resource\Acl\Role'); - } -} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/Rule.php b/app/code/Magento/Webapi/Model/Resource/Acl/Rule.php deleted file mode 100644 index 6c448970dde7ed308019c9a13c84227751011413..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/Rule.php +++ /dev/null @@ -1,109 +0,0 @@ -<?php -/** - * Resource model for ACL rule. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @method array getResources() getResources() - * @method \Magento\Webapi\Model\Resource\Acl\Rule setResources() setResources(array $resourcesList) - * @method int getRoleId() getRoleId() - * @method \Magento\Webapi\Model\Resource\Acl\Rule setRoleId() setRoleId(int $roleId) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class Rule extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Resource initialization. - */ - protected function _construct() - { - $this->_init('webapi_rule', 'rule_id'); - } - - /** - * Get all rules from DB. - * - * @return array - */ - public function getRuleList() - { - $adapter = $this->getReadConnection(); - $select = $adapter->select()->from($this->getMainTable(), array('resource_id', 'role_id')); - return $adapter->fetchAll($select); - } - - /** - * Get resource IDs assigned to role. - * - * @param integer $roleId Web api user role ID - * @return array - */ - public function getResourceIdsByRole($roleId) - { - $adapter = $this->getReadConnection(); - $select = $adapter->select() - ->from($this->getMainTable(), array('resource_id')) - ->where('role_id = ?', (int)$roleId); - return $adapter->fetchCol($select); - } - - /** - * Save resources. - * - * @param \Magento\Webapi\Model\Acl\Rule $rule - * @throws \Exception - */ - public function saveResources(\Magento\Webapi\Model\Acl\Rule $rule) - { - $roleId = $rule->getRoleId(); - if ($roleId > 0) { - $adapter = $this->_getWriteAdapter(); - $adapter->beginTransaction(); - - try { - $adapter->delete($this->getMainTable(), array('role_id = ?' => (int)$roleId)); - - $resources = $rule->getResources(); - if ($resources) { - $resourcesToInsert = array(); - foreach ($resources as $resName) { - $resourcesToInsert[] = array( - 'role_id' => $roleId, - 'resource_id' => trim($resName) - ); - } - $adapter->insertArray( - $this->getMainTable(), - array('role_id', 'resource_id'), - $resourcesToInsert - ); - } - - $adapter->commit(); - } catch (\Exception $e) { - $adapter->rollBack(); - throw $e; - } - } - } -} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/Rule/Collection.php b/app/code/Magento/Webapi/Model/Resource/Acl/Rule/Collection.php deleted file mode 100644 index eb456d94c1624be995404ea695aa53e0709d996e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/Rule/Collection.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webapi - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Web API Rules Resource Collection. - * - * @category Magento - * @package Magento_Webapi - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Webapi\Model\Resource\Acl\Rule; - -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Resource collection initialization. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Acl\Rule', 'Magento\Webapi\Model\Resource\Acl\Rule'); - } - - /** - * Retrieve rules by role. - * - * @param int $roleId - * @return \Magento\Webapi\Model\Resource\Acl\Rule\Collection - */ - public function getByRole($roleId) - { - $this->getSelect()->where("role_id = ?", (int)$roleId); - return $this; - } -} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/User.php b/app/code/Magento/Webapi/Model/Resource/Acl/User.php deleted file mode 100644 index 19c31bbe61a9cc9320b523d6a0c74978bd55c8a1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/User.php +++ /dev/null @@ -1,78 +0,0 @@ -<?php -/** - * Web API User resource model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class User extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Class constructor. - * - * @param \Magento\App\Resource $resource - */ - public function __construct(\Magento\App\Resource $resource) - { - parent::__construct($resource); - } - - /** - * Resource initialization. - */ - protected function _construct() - { - $this->_init('webapi_user', 'user_id'); - } - - /** - * Initialize unique fields. - * - * @return \Magento\Webapi\Model\Resource\Acl\User - */ - protected function _initUniqueFields() - { - $this->_uniqueFields = array( - array( - 'field' => 'api_key', - 'title' => __('API Key') - ), - ); - return $this; - } - - /** - * Get role users. - * - * @param integer $roleId - * @return array - */ - public function getRoleUsers($roleId) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select() - ->from($this->getMainTable(), array('user_id')) - ->where('role_id = ?', (int)$roleId); - return $adapter->fetchCol($select); - } -} diff --git a/app/code/Magento/Webapi/Model/Resource/Acl/User/Collection.php b/app/code/Magento/Webapi/Model/Resource/Acl/User/Collection.php deleted file mode 100644 index 626a4968ab674a8fec6ab4b8a4efbef223a78cc7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Resource/Acl/User/Collection.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Web API User Resource Collection. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl\User; - -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Resource collection initialization. - */ - protected function _construct() - { - $this->_init('Magento\Webapi\Model\Acl\User', 'Magento\Webapi\Model\Resource\Acl\User'); - } -} diff --git a/app/code/Magento/Webapi/Model/Rest/Config.php b/app/code/Magento/Webapi/Model/Rest/Config.php index a9945dd7603de252d9653ed07e210e6ab7a28dc3..0d4bf38d2769f36e4657ba4df40a7467c24a4c86 100644 --- a/app/code/Magento/Webapi/Model/Rest/Config.php +++ b/app/code/Magento/Webapi/Model/Rest/Config.php @@ -46,6 +46,7 @@ class Config const KEY_CLASS = 'class'; const KEY_METHOD = 'method'; const KEY_ROUTE_PATH = 'routePath'; + const KEY_ACL_RESOURCES = 'resources'; /*#@-*/ /** @var \Magento\Webapi\Model\Config */ @@ -88,7 +89,8 @@ class Config $route->setServiceClass($routeData[self::KEY_CLASS]) ->setServiceMethod($routeData[self::KEY_METHOD]) - ->setSecure($routeData[self::KEY_IS_SECURE]); + ->setSecure($routeData[self::KEY_IS_SECURE]) + ->setAclResources($routeData[self::KEY_ACL_RESOURCES]); return $route; } @@ -130,12 +132,14 @@ class Config if (strtoupper($methodInfo[Converter::KEY_HTTP_METHOD]) == strtoupper($httpMethod)) { $secure = $methodInfo[Converter::KEY_IS_SECURE]; $methodRoute = $methodInfo[Converter::KEY_METHOD_ROUTE]; + $aclResources = $methodInfo[Converter::KEY_ACL_RESOURCES]; $routes[] = $this->_createRoute( array( self::KEY_ROUTE_PATH => $serviceData[Converter::KEY_BASE_URL] . $methodRoute, self::KEY_CLASS => $serviceName, self::KEY_METHOD => $methodName, - self::KEY_IS_SECURE => $secure + self::KEY_IS_SECURE => $secure, + self::KEY_ACL_RESOURCES => $aclResources ) ); } diff --git a/app/code/Magento/Webapi/Model/Soap/Config.php b/app/code/Magento/Webapi/Model/Soap/Config.php index ba7e4285cfa6bdc4e2ce58f141904f8f48fea1f2..6dae7df7070f120569382046036630ac2008c78b 100644 --- a/app/code/Magento/Webapi/Model/Soap/Config.php +++ b/app/code/Magento/Webapi/Model/Soap/Config.php @@ -37,6 +37,7 @@ class Config const KEY_IS_SECURE = 'isSecure'; const KEY_METHOD = 'method'; const KEY_IS_REQUIRED = 'inputRequired'; + const KEY_ACL_RESOURCES = 'resources'; /**#@-*/ /** @var \Magento\Filesystem */ @@ -110,7 +111,8 @@ class Config $this->_soapOperations[$operationName] = array( self::KEY_CLASS => $class, self::KEY_METHOD => $method, - self::KEY_IS_SECURE => $methodData[Converter::KEY_IS_SECURE] + self::KEY_IS_SECURE => $methodData[Converter::KEY_IS_SECURE], + self::KEY_ACL_RESOURCES => $methodData[Converter::KEY_ACL_RESOURCES] ); } } @@ -132,16 +134,14 @@ class Config $this->_soapServices = array(); foreach ($this->_config->getServices() as $serviceData) { $serviceClass = $serviceData[Converter::KEY_SERVICE_CLASS]; - $reflection = new \ReflectionClass($serviceClass); - foreach ($reflection->getMethods() as $method) { - // find if method is secure, assume operation is not secure by default - $methodName = $method->getName(); - $isSecure = $serviceData[Converter::KEY_SERVICE_METHODS][$methodName][Converter::KEY_IS_SECURE]; + foreach ($serviceData[Converter::KEY_SERVICE_METHODS] as $methodMetadata) { // TODO: Simplify the structure in SOAP. Currently it is unified in SOAP and REST + $methodName = $methodMetadata[Converter::KEY_SERVICE_METHOD]; $this->_soapServices[$serviceClass]['methods'][$methodName] = array( self::KEY_METHOD => $methodName, - self::KEY_IS_REQUIRED => (bool)$method->getNumberOfParameters(), - self::KEY_IS_SECURE => $isSecure + self::KEY_IS_REQUIRED => (bool)$methodMetadata[Converter::KEY_IS_SECURE], + self::KEY_IS_SECURE => $methodMetadata[Converter::KEY_IS_SECURE], + self::KEY_ACL_RESOURCES => $methodMetadata[Converter::KEY_ACL_RESOURCES] ); $this->_soapServices[$serviceClass][self::KEY_CLASS] = $serviceClass; }; @@ -171,7 +171,8 @@ class Config return array( self::KEY_CLASS => $soapOperations[$soapOperation][self::KEY_CLASS], self::KEY_METHOD => $soapOperations[$soapOperation][self::KEY_METHOD], - self::KEY_IS_SECURE => $soapOperations[$soapOperation][self::KEY_IS_SECURE] + self::KEY_IS_SECURE => $soapOperations[$soapOperation][self::KEY_IS_SECURE], + self::KEY_ACL_RESOURCES => $soapOperations[$soapOperation][self::KEY_ACL_RESOURCES] ); } diff --git a/app/code/Magento/Webapi/Model/Source/Acl/Role.php b/app/code/Magento/Webapi/Model/Source/Acl/Role.php deleted file mode 100644 index 7bbf690618429c89b5dbfab0e5282539e1439ef2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/Model/Source/Acl/Role.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webapi - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Web API Role source model. - * - * @category Magento - * @package Magento_Webapi - * @author Magento Core Team <core@magentocommerce.com> - */ -namespace Magento\Webapi\Model\Source\Acl; - -class Role implements \Magento\Core\Model\Option\ArrayInterface -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Role - */ - protected $_resource = null; - - /** - * @param \Magento\Webapi\Model\Resource\Acl\RoleFactory $roleFactory - */ - public function __construct( - \Magento\Webapi\Model\Resource\Acl\RoleFactory $roleFactory - ) { - $this->_resource = $roleFactory->create(); - } - - /** - * Retrieve option hash of Web API Roles. - * - * @param bool $addEmpty - * @return array - */ - public function toOptionHash($addEmpty = true) - { - $options = $this->_resource->getRolesList(); - if ($addEmpty) { - $options = array('' => '') + $options; - } - return $options; - } - - /** - * Return option array. - * - * @return array - */ - public function toOptionArray() - { - $options = $this->_resource->getRolesList(); - return $options; - } -} diff --git a/app/code/Magento/Webapi/etc/acl.xsd b/app/code/Magento/Webapi/etc/acl.xsd deleted file mode 100644 index 88ff6a0b0e866e7c78c573391ddf24ffa2fb6be0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/acl.xsd +++ /dev/null @@ -1,129 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Structure description for acl.xml ACL resource files. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="config"> - <xs:complexType> - <xs:sequence> - <xs:element name="acl"> - <xs:complexType> - <xs:sequence> - <xs:element name="resources"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="resource" type="aclResource" /> - </xs:sequence> - </xs:complexType> - - <xs:unique name="uniqueResourceId"> - <xs:annotation> - <xs:documentation> - Attribute ID is unique under all ACL resources - </xs:documentation> - </xs:annotation> - <xs:selector xpath=".//*"/> - <xs:field xpath="@id"/> - </xs:unique> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="mapping"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="resource" type="aclMapping"> - <xs:unique name="uniqueMappedResourceId"> - <xs:annotation> - <xs:documentation> - Attribute ID is unique under all mapped ACL resources - </xs:documentation> - </xs:annotation> - <xs:selector xpath=".//*"/> - <xs:field xpath="@id"/> - </xs:unique> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:complexType name="aclResource"> - <xs:annotation> - <xs:documentation> - ACL Resource. Recursive complex type - </xs:documentation> - </xs:annotation> - - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="resource" type="aclResource" /> - </xs:sequence> - - <xs:attribute name="id" type="typeId" use="required" /> - <xs:attribute name="title" type="typeTitle" use="optional" /> - <xs:attribute name="sortOrder" type="xs:int" use="optional" /> - <xs:attribute name="disabled" type="xs:boolean" use="optional" /> - </xs:complexType> - - <xs:complexType name="aclMapping"> - <xs:annotation> - <xs:documentation> - ACL Resource mapping. - </xs:documentation> - </xs:annotation> - - <xs:attribute name="id" type="typeId" use="required" /> - <xs:attribute name="parent" type="typeId" use="required" /> - </xs:complexType> - - <xs:simpleType name="typeId"> - <xs:annotation> - <xs:documentation> - Item ID attribute can have only [A-Za-z0-9_]/[A-Za-z0-9_]. Minimal length is 3 symbols. Case insensitive. - </xs:documentation> - </xs:annotation> - - <xs:restriction base="xs:string"> - <xs:pattern value="[A-Za-z_0-9]+/?[A-Za-z_0-9]+" /> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="typeTitle"> - <xs:annotation> - <xs:documentation> - Item title attribute minimal length is 3 symbols - </xs:documentation> - </xs:annotation> - - <xs:restriction base="xs:string"> - <xs:minLength value="3" /> - <xs:maxLength value="50" /> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/app/code/Magento/Webapi/etc/adminhtml/acl.xml b/app/code/Magento/Webapi/etc/adminhtml/acl.xml deleted file mode 100644 index c83409123c48ab5420060e4b7a15c334e5733e75..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/adminhtml/acl.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Configuration of ACL for Webapi module. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <acl> - <resources> - - <resource id="Magento_Adminhtml::admin"> - <resource id="Magento_Adminhtml::system"> - <resource id="Magento_Webapi::webapi" title="Rest" sortOrder="40"> - <resource id="Magento_Webapi::webapi_users" title="Users" sortOrder="10"/> - <resource id="Magento_Webapi::webapi_roles" title="Roles" sortOrder="20"/> - </resource> - </resource> - </resource> - </resources> - </acl> -</config> diff --git a/app/code/Magento/Webapi/etc/adminhtml/menu.xml b/app/code/Magento/Webapi/etc/adminhtml/menu.xml deleted file mode 100644 index 1bc1d041c30ec98621135fa41e59da002b3175f8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/adminhtml/menu.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Configuration of Webapi module menu in Magento admin panel. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <menu> - <add id="Magento_Webapi::system_webapi" title="REST" module="Magento_Webapi" sortOrder="40" parent="Magento_Adminhtml::system" resource="Magento_Webapi::webapi"/> - <add id="Magento_Webapi::system_api_webapi_roles" title="Roles" module="Magento_Webapi" sortOrder="10" parent="Magento_Webapi::system_webapi" action="adminhtml/webapi_role" resource="Magento_Webapi::webapi_roles"/> - <add id="Magento_Webapi::system_api_webapi_users" title="Users" module="Magento_Webapi" sortOrder="1" parent="Magento_Webapi::system_webapi" action="adminhtml/webapi_user" resource="Magento_Webapi::webapi_users"/> - - </menu> -</config> diff --git a/app/code/Magento/Webapi/etc/adminhtml/routes.xml b/app/code/Magento/Webapi/etc/adminhtml/routes.xml deleted file mode 100644 index 1e67b3e7da102d7bc718e2ea2819380e74908021..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/adminhtml/routes.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <router id="admin"> - <route id="adminhtml"> - <module name="Magento_Webapi_Adminhtml" before="Magento_Backend" /> - </route> - </router> -</config> diff --git a/app/code/Magento/Webapi/etc/config.xml b/app/code/Magento/Webapi/etc/config.xml deleted file mode 100644 index 95d7c45372b2f42270e3420765ee1ff1eca041ce..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/config.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Webapi module configuration. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> -</config> diff --git a/app/code/Magento/Webapi/etc/di.xml b/app/code/Magento/Webapi/etc/di.xml index 4e87c64decd3cbe624e027e460524dbc1b2f8b05..3bb8d5606daeb14dab98a3d96440de524f0b95cc 100644 --- a/app/code/Magento/Webapi/etc/di.xml +++ b/app/code/Magento/Webapi/etc/di.xml @@ -36,4 +36,11 @@ </value> </param> </type> + <type name="Magento\Xml\Generator" shared="false" /> + <type name="Magento\Xml\Parser" shared="false" /> + <type name="Magento\Code\Scanner\DirectoryScanner" shared="false" /> + <type name="Magento\Server\Reflection" shared="false" /> + <type name="Magento\Integration\Service\IntegrationV1"> + <plugin name="webapiIntegrationServiceV1" type="Magento\Webapi\Model\Plugin\IntegrationServiceV1"/> + </type> </config> diff --git a/app/code/Magento/Webapi/etc/module.xml b/app/code/Magento/Webapi/etc/module.xml index c1f25d2ac17c4f534b93e5adf79ec2b1ce4c9faf..42ebeefa5ed0c8df64f43447bacae540feb55e11 100755 --- a/app/code/Magento/Webapi/etc/module.xml +++ b/app/code/Magento/Webapi/etc/module.xml @@ -24,7 +24,7 @@ */ --> <config> - <module name="Magento_Webapi" version="1.0.0.3" active="true"> + <module name="Magento_Webapi" version="1.0.0.4" active="true"> <sequence> <module name="Magento_Core"/> <module name="Magento_Integration"/> diff --git a/app/code/Magento/Webapi/etc/validation.xml b/app/code/Magento/Webapi/etc/validation.xml deleted file mode 100644 index 4b48169973820e99a40e9d55c3e89f420c005141..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/etc/validation.xml +++ /dev/null @@ -1,109 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- -/** - * Webapi module validation configuration. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<validation> - <entity name="api_user"> - <rules> - <rule name="form"> - <property_constraints> - <property name="company_name"> - <constraint class="Magento\Validator\StringLength"> - <argument> - <option name="max">250</option> - </argument> - </constraint> - </property> - <property name="contact_email"> - <constraint class="Magento\Validator\EmailAddress"/> - <constraint class="Magento\Validator\StringLength"> - <argument> - <option name="min">1</option> - <option name="max">250</option> - </argument> - </constraint> - </property> - <property name="api_key"> - <constraint class="Magento\Validator\StringLength"> - <argument> - <option name="min">1</option> - <option name="max">250</option> - </argument> - </constraint> - </property> - <property name="secret"> - <constraint class="Magento\Validator\StringLength"> - <argument> - <option name="min">1</option> - <option name="max">250</option> - </argument> - </constraint> - </property> - </property_constraints> - </rule> - </rules> - <groups> - <group name="create"> - <uses> - <use rule="form"/> - </uses> - </group> - <group name="update"> - <uses> - <use rule="form"/> - </uses> - </group> - </groups> - </entity> - <entity name="api_role"> - <rules> - <rule name="form"> - <property_constraints> - <property name="role_name"> - <constraint class="Magento\Validator\StringLength"> - <argument> - <option name="min">1</option> - <option name="max">250</option> - </argument> - </constraint> - </property> - </property_constraints> - </rule> - </rules> - <groups> - <group name="create"> - <uses> - <use rule="form"/> - </uses> - </group> - <group name="update"> - <uses> - <use rule="form"/> - </uses> - </group> - </groups> - </entity> -</validation> diff --git a/app/code/Magento/Webapi/etc/webapi.xsd b/app/code/Magento/Webapi/etc/webapi.xsd index 25017998aa7a68d08d71884db4f2bdeb8728c85c..05f6994271804d4e81bf33643a91914becdef399 100644 --- a/app/code/Magento/Webapi/etc/webapi.xsd +++ b/app/code/Magento/Webapi/etc/webapi.xsd @@ -29,12 +29,12 @@ <xs:element name="config" type="configType"/> <xs:complexType name="configType"> <xs:sequence> - <xs:element type="serviceType" name="service" maxOccurs="unbounded" minOccurs="0"/> + <xs:element type="serviceType" name="service" maxOccurs="unbounded" minOccurs="1"/> </xs:sequence> </xs:complexType> <xs:complexType name="serviceType"> <xs:sequence> - <xs:element type="restRouteType" name="rest-route" maxOccurs="unbounded" minOccurs="0"/> + <xs:element type="restRouteType" name="rest-route" maxOccurs="unbounded" minOccurs="1"/> </xs:sequence> <xs:attribute type="xs:string" name="class"/> <xs:attribute type="xs:string" name="baseUrl"/> @@ -53,8 +53,14 @@ </xs:simpleType> </xs:attribute> <xs:attribute type="xs:string" name="method"/> + <xs:attribute type="resourcesType" name="resources"/> <xs:attribute type="xs:boolean" name="isSecure" default="false"/> </xs:extension> </xs:simpleContent> </xs:complexType> + <xs:simpleType name="resourcesType"> + <xs:restriction base="xs:string"> + <xs:pattern value=".+::.+(, ?.+::.+)*"/> + </xs:restriction> + </xs:simpleType> </xs:schema> diff --git a/app/code/Magento/Webapi/etc/webapi_rest/di.xml b/app/code/Magento/Webapi/etc/webapi_rest/di.xml index e09556f0e5c8ee8ff70bdeef1eae639c71cb8276..6e6562d31b7b11376a154e17352e4d7dc5c2d1e9 100644 --- a/app/code/Magento/Webapi/etc/webapi_rest/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_rest/di.xml @@ -24,70 +24,14 @@ */ --> <config> - <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Rest" /> - <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\Acl" /> - <preference for="Magento\Authorization\RoleLocator" type="Magento\Webapi\Model\Authorization\RoleLocator" /> - <preference for="Magento\Webapi\Model\Acl\Resource\ProviderInterface" type="Magento\Webapi\Model\Acl\Resource\Provider"/> - <type name="Magento\Acl\Builder"> - <param name="resourceLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Resource" /> - </param> - <param name="roleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Role" /> - </param> - <param name="ruleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Rule" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Builder"> - <param name="cache"> - <instance type="Magento\Webapi\Model\Acl\Cache" /> - </param> - <param name="resourceLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Resource" /> - </param> - <param name="roleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Role" /> - </param> - <param name="ruleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Rule" /> - </param> - </type> - <type name="Magento\Webapi\Model\Authorization\Policy\Acl"> - <param name="aclBuilder"> - <instance type="Magento\Webapi\Model\Acl\Builder" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Cache"> - <param name="cacheKey"> - <value>api_acl_resources</value> - </param> - </type> - <type name="Magento\Core\Model\Acl\RootResource"> - <param name="identifier"> - <value>Magento_Webapi</value> + <preference for="Magento\Authz\Model\UserLocatorInterface" type="Magento\Webapi\Model\Authz\UserLocator"/> + <type name="Magento\Webapi\Model\Authz\UserLocator"> + <param name="request"> + <instance type="Magento\Webapi\Controller\Rest\Request"/> </param> </type> + <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Rest" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> - <type name="Magento\Xml\Generator" shared="false" /> - <type name="Magento\Xml\Parser" shared="false" /> - <type name="Magento\Code\Scanner\DirectoryScanner" shared="false" /> - <type name="Magento\Server\Reflection" shared="false" /> - <type name="Magento\Webapi\Model\Authorization\Loader\Resource"> - <param name="resourceProvider"> - <instance type="Magento\Webapi\Model\Acl\Resource\Provider" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Resource\Provider"> - <param name="configReader"> - <instance type="Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem"> - <param name="converter"> - <instance type="Magento\Webapi\Model\Acl\Resource\Config\Converter\Dom" /> - </param> - </type> <type name="Magento\Webapi\Controller\Rest\Request\Deserializer\Factory"> <param name="deserializers"> <value> @@ -149,5 +93,8 @@ <param name="oauthHelper"> <instance type="Magento\Oauth\Helper\Request\Proxy"/> </param> + <param name="authorizationService"> + <instance type="Magento\Authz\Service\AuthorizationV1Interface\Proxy" /> + </param> </type> </config> diff --git a/app/code/Magento/Webapi/etc/webapi_soap/di.xml b/app/code/Magento/Webapi/etc/webapi_soap/di.xml index d701f2aa35bdb628404c8f2ee1e876220aa6d69d..922a5cf8290e616068d355717f8895c38e219e1d 100644 --- a/app/code/Magento/Webapi/etc/webapi_soap/di.xml +++ b/app/code/Magento/Webapi/etc/webapi_soap/di.xml @@ -24,70 +24,14 @@ */ --> <config> - <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Soap" /> - <preference for="Magento\Authorization\Policy" type="Magento\Authorization\Policy\Acl" /> - <preference for="Magento\Authorization\RoleLocator" type="Magento\Webapi\Model\Authorization\RoleLocator" /> - <preference for="Magento\Webapi\Model\Acl\Resource\ProviderInterface" type="Magento\Webapi\Model\Acl\Resource\Provider"/> - <type name="Magento\Acl\Builder"> - <param name="resourceLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Resource" /> - </param> - <param name="roleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Role" /> - </param> - <param name="ruleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Rule" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Builder"> - <param name="cache"> - <instance type="Magento\Webapi\Model\Acl\Cache" /> - </param> - <param name="resourceLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Resource" /> - </param> - <param name="roleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Role" /> - </param> - <param name="ruleLoader"> - <instance type="Magento\Webapi\Model\Authorization\Loader\Rule" /> - </param> - </type> - <type name="Magento\Webapi\Model\Authorization\Policy\Acl"> - <param name="aclBuilder"> - <instance type="Magento\Webapi\Model\Acl\Builder" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Cache"> - <param name="cacheKey"> - <value>api_acl_resources</value> - </param> - </type> - <type name="Magento\Core\Model\Acl\RootResource"> - <param name="identifier"> - <value>Magento_Webapi</value> + <preference for="Magento\Authz\Model\UserLocatorInterface" type="Magento\Webapi\Model\Authz\UserLocator"/> + <type name="Magento\Webapi\Model\Authz\UserLocator"> + <param name="request"> + <instance type="Magento\Webapi\Controller\Soap\Request"/> </param> </type> + <preference for="Magento\App\FrontControllerInterface" type="Magento\Webapi\Controller\Soap" /> <type name="Magento\Webapi\Controller\Rest\Router\Route" shared="false" /> - <type name="Magento\Xml\Generator" shared="false" /> - <type name="Magento\Xml\Parser" shared="false" /> - <type name="Magento\Code\Scanner\DirectoryScanner" shared="false" /> - <type name="Magento\Server\Reflection" shared="false" /> - <type name="Magento\Webapi\Model\Authorization\Loader\Resource"> - <param name="resourceProvider"> - <instance type="Magento\Webapi\Model\Acl\Resource\Provider" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Resource\Provider"> - <param name="configReader"> - <instance type="Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem" /> - </param> - </type> - <type name="Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem"> - <param name="converter"> - <instance type="Magento\Webapi\Model\Acl\Resource\Config\Converter\Dom" /> - </param> - </type> <type name="Magento\Webapi\Controller\Soap"> <param name="soapServer"> <instance type="Magento\Webapi\Model\Soap\Server\Proxy"/> @@ -96,4 +40,9 @@ <instance type="Magento\Webapi\Controller\ErrorProcessor\Proxy"/> </param> </type> + <type name="Magento\Webapi\Controller\Soap\Handler"> + <param name="authorizationService"> + <instance type="Magento\Authz\Service\AuthorizationV1Interface\Proxy" /> + </param> + </type> </config> diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/FormTest.php b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php similarity index 71% rename from dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/FormTest.php rename to app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php index a437ec65a01c58855ab848b3e5340f98a92a2d08..6c4fb1191c118b66de8f60a51c9f42335a481b44 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/FormTest.php +++ b/app/code/Magento/Webapi/sql/webapi_setup/upgrade-1.0.0.3-1.0.0.4.php @@ -1,6 +1,6 @@ <?php /** - * Test for \Magento\Webapi\Block\Adminhtml\Role\Edit\Form block. + * Update script for Webapi module. * * Magento * @@ -23,14 +23,14 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit; -class FormTest extends \Magento\Webapi\Block\Adminhtml\AbstractFormTest -{ - protected $_formClass = 'Magento\Webapi\Block\Adminhtml\Role\Edit\Form'; +/* @var \Magento\Core\Model\Resource\Setup $installer */ +$installer = $this; +$installer->startSetup(); +$connection = $installer->getConnection(); - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Form - */ - protected $_block; -} +$connection->dropTable($this->getTable('webapi_user')); +$connection->dropTable($this->getTable('webapi_rule')); +$connection->dropTable($this->getTable('webapi_role')); + +$installer->endSetup(); diff --git a/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml b/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml index ca5af5665540de72f6c9c06c949d0ea84c241a77..307cecb1194e60a08bb55d1b59115a367ee188af 100644 --- a/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml +++ b/app/code/Magento/Webapi/view/adminhtml/integration/activate/permissions/tab/webapi.phtml @@ -27,29 +27,35 @@ */ ?> <fieldset class="fieldset form-inline entry-edit"> - <div class="field" data-role="tree-resources-container"> - <div class="control"> - <div id="resource-tree" class="tree x-tree" data-role="resource-tree"></div> + <?php if ($this->isTreeEmpty()): ?> + <p class="empty"><?php echo __('No permissions requested'); ?></p> + <?php else: ?> + <div class="field" data-role="tree-resources-container"> + <div class="control"> + <div id="resource-tree" class="tree x-tree" data-role="resource-tree"></div> + </div> </div> - </div> + <?php endif ?> </fieldset> -<script type="text/javascript"> -jQuery(function($) { - head.js('<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js')?>', - '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js')?>', - '<?php echo $this->getViewFileUrl('Magento_User::js/roles-tree.js')?>', function() { - $.widget('mage.rolesTree', $.mage.rolesTree, { - _checkNode: function(event) {}, - _checkNodes: function() { - this._super(); - this.element.jstree('disable_hotkeys').jstree('hide_checkboxes') - .find('li.jstree-unchecked').hide().end().find('li.jstree-checked').attr('rel', 'disabled'); - } +<?php if (!$this->isTreeEmpty()): ?> + <script type="text/javascript"> + jQuery(function($) { + head.js('<?php echo $this->getViewFileUrl('jquery/jstree/jquery.hotkeys.js')?>', + '<?php echo $this->getViewFileUrl('jquery/jstree/jquery.jstree.js')?>', + '<?php echo $this->getViewFileUrl('Magento_User::js/roles-tree.js')?>', function() { + $.widget('mage.rolesTree', $.mage.rolesTree, { + _checkNode: function(event) {}, + _checkNodes: function() { + this._super(); + this.element.jstree('disable_hotkeys').jstree('hide_checkboxes') + .find('li.jstree-unchecked').hide().end().find('li.jstree-checked').attr('rel', 'disabled'); + } + }); + $('[data-role="resource-tree"]').rolesTree({ + 'treeInitData': <?php echo $this->getResourcesTreeJson() ?>, + 'treeInitSelectedData': <?php echo $this->getSelectedResourcesJson() ?> + }); }); - $('[data-role="resource-tree"]').rolesTree({ - 'treeInitData': <?php echo $this->getResourcesTreeJson() ?>, - 'treeInitSelectedData': <?php echo $this->getSelectedResourcesJson() ?> - }); - }); -}); -</script> + }); + </script> +<?php endif ?> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_integration_edit.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_integration_edit.xml index a034a0812f23d075a47b4e15403ef02dfe3f4927..8750b4f826288509c68d7a6d7695b90890ce0b53 100644 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_integration_edit.xml +++ b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_integration_edit.xml @@ -32,6 +32,12 @@ <argument name="block" xsi:type="string">integration_edit_tab_webapi</argument> <argument name="after" xsi:type="string">info_section</argument> </action> + <block class="Magento\Webapi\Block\Adminhtml\Integration\Activate\Permissions\Tab\Webapi" name="integration_config_edit_tab_webapi" template="integration/activate/permissions/tab/webapi.phtml"/> + <action method="addTabAfter"> + <argument name="name" xsi:type="string">api_config_section</argument> + <argument name="block" xsi:type="string">integration_config_edit_tab_webapi</argument> + <argument name="after" xsi:type="string">api_section</argument> + </action> </referenceBlock> <referenceContainer name="js"> <block class="Magento\Backend\Block\Template" name="adminhtml.integration.webapi.tree.js" template="Magento_User::user/roles_grid_js.phtml"/> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit.xml deleted file mode 100644 index 148849bdee87be332c6baf63146c30bece49714b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_webapi_role_edit_tab_users_grid_block"/> - <referenceContainer name="content"> - <block class="Magento\Webapi\Block\Adminhtml\Role\Edit" name="webapi.role.edit"/> - </referenceContainer> - <referenceContainer name="left"> - <block class="Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs" name="webapi.role.edit.tabs"> - <block class="Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main" name="webapi.role.edit.tab.main"/> - <block class="Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource" name="webapi.role.edit.tab.resource" template="Magento_Webapi::rolesedit.phtml"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi.role.edit.tab.users.grid.container"/> - </block> - </referenceContainer> - <referenceBlock name="head"> - <action method="setCanLoadExtJs"> - <argument name="flag" xsi:type="string">1</argument> - </action> - </referenceBlock> - <referenceContainer name="js"> - <block class="Magento\View\Element\Template" template="Magento_Webapi::rolesusersgridjs.phtml"/> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit_tab_users_grid_block.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit_tab_users_grid_block.xml deleted file mode 100644 index bde870c4131b2662742c8832fa333f7749cf5f4b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_edit_tab_users_grid_block.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="webapi.role.edit.tab.users.grid"> - <arguments> - <argument name="dataSource" xsi:type="object"> - <updater>Magento\Webapi\Model\Acl\Role\UsersUpdater</updater> - </argument> - </arguments> - </referenceBlock> - <referenceBlock name="webapi.role.edit.tab.users.grid.container"> - <block class="Magento\Backend\Block\Widget\Grid" name="webapi.role.edit.tab.users.grid" as="grid"> - <arguments> - <argument name="id" xsi:type="string">roleUserGrid</argument> - <argument name="dataSource" xsi:type="object">Magento\Webapi\Model\Resource\Acl\User\Collection</argument> - <argument name="use_ajax" xsi:type="string">true</argument> - <argument name="default_sort" xsi:type="string">role_user_id</argument> - <argument name="default_dir" xsi:type="string">ASC</argument> - <argument name="grid_url" xsi:type="url" path="*/*/usersgrid"> - <param name="_current">1</param> - </argument> - </arguments> - <action method="setTitle"> - <argument translate="true" name="value" xsi:type="string">Role Users Information</argument> - </action> - <action method="setDefaultFilter"> - <argument name="value" xsi:type="array"> - <item name="in_role_users" xsi:type="string">1</item> - </argument> - </action> - <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="webapi.role.edit.tab.users.grid.columnSet" as="grid.columnSet"> - <block class="Magento\Backend\Block\Widget\Grid\Column" name="webapi.role.edit.tab.users.grid.columnSet.in_role_users" as="in_role_users"> - <arguments> - <argument name="id" xsi:type="string">in_role_users</argument> - <argument name="html_name" xsi:type="string">in_role_users</argument> - <argument name="header_css_class" xsi:type="string">a-center</argument> - <argument name="type" xsi:type="string">checkbox</argument> - <argument name="values" xsi:type="string"> - <updater>Magento\Webapi\Model\Acl\Role\InRoleUserUpdater</updater> - <value/> - </argument> - <argument name="name" xsi:type="string">in_role_users</argument> - <argument name="align" xsi:type="string">center</argument> - <argument name="index" xsi:type="string">user_id</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_user_id"> - <arguments> - <argument name="id" xsi:type="string">role_name</argument> - <argument name="header" xsi:type="string" translate="true">User ID</argument> - <argument name="width" xsi:type="string">20</argument> - <argument name="align" xsi:type="string">left</argument> - <argument name="sortable" xsi:type="string">1</argument> - <argument name="index" xsi:type="string">user_id</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_user_contactemail"> - <arguments> - <argument name="id" xsi:type="string">role_user_contactemail</argument> - <argument name="header" xsi:type="string" translate="true">Contact Email</argument> - <argument name="align" xsi:type="string">left</argument> - <argument name="index" xsi:type="string">contact_email</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_user_apikey"> - <arguments> - <argument name="id" xsi:type="string">role_user_apikey</argument> - <argument name="header" xsi:type="string" translate="true">API Key</argument> - <argument name="align" xsi:type="string">left</argument> - <argument name="index" xsi:type="string">api_key</argument> - </arguments> - </block> - </block> - </block> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_grid_block.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_grid_block.xml deleted file mode 100644 index 061a0cd1861771050ca78e80e3dfa2178cc92e93..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_grid_block.xml +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="webapi_role.grid.container"> - <block class="Magento\Backend\Block\Widget\Grid" as="grid" name="webapi.role.grid"> - <arguments> - <argument name="id" xsi:type="string">webapiRoleGrid</argument> - <argument name="dataSource" xsi:type="object">Magento\Webapi\Model\Resource\Acl\Role\Collection</argument> - <argument name="use_ajax" xsi:type="string">true</argument> - <argument name="default_sort" xsi:type="string">role_id</argument> - <argument name="default_dir" xsi:type="string">asc</argument> - <argument name="grid_url" xsi:type="url" path="*/*/rolegrid"> - <param name="_current">1</param> - </argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="webapi.role.grid.columnSet"> - <arguments> - <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/*/edit</item> - <item name="extraParamsTemplate" xsi:type="array"> - <item name="role_id" xsi:type="string">getId</item> - </item> - </argument> - <argument name="empty_text" xsi:type="string" translate="true">No Roles Found</argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_id"> - <arguments> - <argument name="header" xsi:type="string" translate="true">ID</argument> - <argument name="width" xsi:type="string">80px</argument> - <argument name="type" xsi:type="string">text</argument> - <argument name="index" xsi:type="string">role_id</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_name"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Role Name</argument> - <argument name="index" xsi:type="string">role_name</argument> - </arguments> - </block> - </block> - </block> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_index.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_index.xml deleted file mode 100644 index f817b2ceacb99ac2878ff0dea651d2cdece23add..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_index.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_webapi_role_grid_block"/> - <referenceContainer name="content"> - <block class="Magento\Webapi\Block\Adminhtml\Role" name="webapi_role.grid.container"/> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_rolegrid.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_rolegrid.xml deleted file mode 100644 index 403d7ed6347d7fd6666ce43d1ba40f0172e12d1c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_rolegrid.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="formkey"/> - <update handle="adminhtml_webapi_role_grid_block"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi_role.grid.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_usersgrid.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_usersgrid.xml deleted file mode 100644 index de882e9a0779ef97bf61c5c40ae0be19f88087f9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_role_usersgrid.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="formkey"/> - <update handle="adminhtml_webapi_role_edit_tab_users_grid_block"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi.role.edit.tab.users.grid.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit.xml deleted file mode 100644 index 06509e2bffc1b63d226815723b98e41b95a152a3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_webapi_user_edit_tab_roles_grid_block"/> - <referenceContainer name="content"> - <block class="Magento\Webapi\Block\Adminhtml\User\Edit" name="webapi.user.edit"/> - </referenceContainer> - <referenceContainer name="left"> - <block class="Magento\Webapi\Block\Adminhtml\User\Edit\Tabs" name="webapi.user.edit.tabs"> - <block class="Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main" name="webapi.user.edit.tab.main"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi.user.edit.tab.roles.grid.container"/> - </block> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit_tab_roles_grid_block.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit_tab_roles_grid_block.xml deleted file mode 100644 index 3097b6eb3afa95fe9bf6a785c65866a18d774bf4..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_edit_tab_roles_grid_block.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="webapi.user.edit.tab.roles.grid.container"> - <block class="Magento\Backend\Block\Widget\Grid" name="webapi.user.edit.tab.roles.grid" as="grid"> - <arguments> - <argument name="id" xsi:type="string">permissionsUserRolesGrid</argument> - <argument name="dataSource" xsi:type="object">Magento\Webapi\Model\Resource\Acl\Role\Collection</argument> - <argument name="use_ajax" xsi:type="string">true</argument> - <argument name="default_sort" xsi:type="string">sort_order</argument> - <argument name="default_dir" xsi:type="string">ASC</argument> - <argument name="grid_url" xsi:type="url" path="*/*/rolesgrid"> - <param name="_current">1</param> - </argument> - </arguments> - <action method="setTitle"> - <argument translate="true" name="value" xsi:type="string">User Roles Information</argument> - </action> - <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" name="webapi.user.edit.tab.roles.grid.columnSet" as="grid.columnSet"> - <arguments> - <argument name="id" xsi:type="string">permissionsUserRolesGrid</argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\Column" name="webapi.user.edit.tab.roles.grid.columnSet.role_id" as="role_id"> - <arguments> - <argument name="id" xsi:type="string">role_id</argument> - <argument name="index" xsi:type="string">role_id</argument> - <argument name="html_name" xsi:type="string">role_id</argument> - <argument name="header" xsi:type="string" translate="true">Assigned</argument> - <argument name="type" xsi:type="string">radio</argument> - <argument name="header_css_class" xsi:type="string">a-center</argument> - <argument name="align" xsi:type="string">center</argument> - <argument name="filter" xsi:type="string">0</argument> - <argument name="sortable" xsi:type="string">0</argument> - <argument name="required" xsi:type="string">0</argument> - <argument name="value" xsi:type="string"> - <updater>Magento\Webapi\Model\Acl\User\RoleUpdater</updater> - <value/> - </argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_name"> - <arguments> - <argument name="id" xsi:type="string">role_name</argument> - <argument name="header" xsi:type="string" translate="true">Role Name</argument> - <argument name="index" xsi:type="string">role_name</argument> - </arguments> - </block> - </block> - </block> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid.xml deleted file mode 100644 index cebca6e0fdcc0de7e97a6646fabb281d81e1db33..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="formkey"/> - <update handle="adminhtml_webapi_user_grid_block"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi_user.grid.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid_block.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid_block.xml deleted file mode 100644 index 226f096fa7f53fc553928de594c9317bf2f5a2c0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_grid_block.xml +++ /dev/null @@ -1,81 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="webapi_user.grid.container"> - <block class="Magento\Backend\Block\Widget\Grid" as="grid" name="webapi.user.grid"> - <arguments> - <argument name="id" xsi:type="string">permissionsUserGrid</argument> - <argument name="dataSource" xsi:type="object">Magento\Webapi\Model\Resource\Acl\User\Collection</argument> - <argument name="use_ajax" xsi:type="string">true</argument> - <argument name="default_sort" xsi:type="string">user_name</argument> - <argument name="default_dir" xsi:type="string">asc</argument> - <argument name="grid_url" xsi:type="url" path="*/*/grid"> - <param name="_current">1</param> - </argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="webapi.user.grid.columnSet"> - <arguments> - <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/*/edit</item> - <item name="extraParamsTemplate" xsi:type="array"> - <item name="user_id" xsi:type="string">getId</item> - </item> - </argument> - <argument name="empty_text" xsi:type="string" translate="true">No Users Found</argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="user_id"> - <arguments> - <argument name="header" xsi:type="string" translate="true">ID</argument> - <argument name="width" xsi:type="string">80px</argument> - <argument name="type" xsi:type="string">text</argument> - <argument name="index" xsi:type="string">user_id</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="contact_email"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Contact Email</argument> - <argument name="index" xsi:type="string">contact_email</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="api_key"> - <arguments> - <argument name="header" xsi:type="string" translate="true">API Key</argument> - <argument name="index" xsi:type="string">api_key</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="role_name"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Role Name</argument> - <argument name="index" xsi:type="string">role_id</argument> - <argument name="width" xsi:type="string">200px</argument> - <argument name="type" xsi:type="string">options</argument> - <argument name="options" xsi:type="options" model="Magento\Webapi\Model\Source\Acl\Role"/> - </arguments> - </block> - </block> - </block> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_index.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_index.xml deleted file mode 100644 index 95ea54783ea9064688eaa4e8fad19123f6801101..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_index.xml +++ /dev/null @@ -1,31 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="adminhtml_webapi_user_grid_block"/> - <referenceContainer name="content"> - <block class="Magento\Webapi\Block\Adminhtml\User" name="webapi_user.grid.container"/> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_rolesgrid.xml b/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_rolesgrid.xml deleted file mode 100644 index 61107e416f042d45f946c67872f8cfb3fe943de1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/layout/adminhtml_webapi_user_rolesgrid.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="formkey"/> - <update handle="adminhtml_webapi_user_edit_tab_roles_grid_block"/> - <block class="Magento\Backend\Block\Widget\Grid\Container" name="webapi.user.edit.tab.roles.grid.container" template="Magento_Backend::widget/grid/container/empty.phtml" output="1"/> -</layout> diff --git a/app/code/Magento/Webapi/view/adminhtml/rolesedit.phtml b/app/code/Magento/Webapi/view/adminhtml/rolesedit.phtml deleted file mode 100644 index 1dab3938ea5f293f738566461cac47858b2be272..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/rolesedit.phtml +++ /dev/null @@ -1,149 +0,0 @@ -<?php -/** - * Template of web API roles edit page in Magento admin panel. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - * - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource $this - */ -?> - -<fieldset class="fieldset form-inline entry-edit"> - <input type="hidden" name="resource" id="role_resources" value="" /> - - <legend class="legend"> - <span><?php echo __('Roles Resources') ?></span> - </legend><br /> - - <div class="field"> - <label class="label" for="all"><span><?php echo __('Resource Access') ?></span></label> - - <div class="control"> - <select id="all" name="all" onchange="$('resources_container').toggle()" class="select"> - <option value="0" <?php echo ($this->isEverythingAllowed()?'':'selected="selected"'); ?>><?php echo __('Custom') ?></option> - <option value="1" <?php echo ($this->isEverythingAllowed()?'selected="selected"':''); ?>><?php echo __('All') ?></option> - </select> - </div> - </div> - - <div class="field" id="resources_container"> - <label class="label"><span><?php echo __('Resources') ?></span></label> - - <div class="control"> - <div class="tree x-tree" id="resource-tree"></div> - </div> - </div> -</fieldset> - -<!-- Draw Resources Tree --> -<script type="text/javascript"> -<?php if ($this->isEverythingAllowed()): ?> - $('resources_container').hide(); -<?php endif; ?> -Ext.EventManager.onDocumentReady(function() { - var tree = new Ext.tree.TreePanel('resource-tree', { - animate: false, - loader: false, - enableDD: false, - containerScroll: true, - rootUIProvider: Ext.tree.CheckboxNodeUI, - selModel: new Ext.tree.CheckNodeMultiSelectionModel(), - rootVisible: false - }); - - tree.on('check', checkHandler, tree); - - // set the root node - var root = new Ext.tree.TreeNode({ - text: 'root', - draggable:false, - checked:'false', - id:'<?php echo \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource::RESOURCES_TREE_ROOT_ID; ?>', - uiProvider: Ext.tree.CheckboxNodeUI - }); - - tree.setRootNode(root); - buildResourcesTree(root, <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($this->getResourcesTree()) ?>); - tree.addListener('click', resourceClick.createDelegate(this)); - - // render the tree - tree.render(); - // root.expand(); - tree.expandAll(); - - $('role_resources').value = tree.getChecked().join(','); -}); - -function resourceClick(node, e){ - node.getUI().check(!node.getUI().checked()); - varienElementMethods.setHasChanges(Event.element(e), e); -}; - -function buildResourcesTree(parent, config) { - if (!config) return null; - - if (parent && config && config.length){ - for (var i = 0; i < config.length; i++){ - config[i].uiProvider = Ext.tree.CheckboxNodeUI; - var node = new Ext.tree.TreeNode(config[i]); - parent.appendChild(node); - if(config[i].children){ - buildResourcesTree(node, config[i].children); - } - } - } -} - -function checkHandler(node) -{ - if ( node.attributes.checked && node.parentNode ) { - var n = node.parentNode; - this.removeListener('check', checkHandler); - do { - if (!n || n.attributes.id == 'admin' || n.attributes.id == '<?php echo \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource::RESOURCES_TREE_ROOT_ID; ?>') { - break; - } else { - n.ui.check(true); - } - } while (n = n.parentNode ); - this.on('check', checkHandler); - } - if ( !node.isLeaf() && node.hasChildNodes() ) { - this.removeListener('check', checkHandler); - processChildren(node, node.attributes.checked); - this.on('check', checkHandler); - } - $('role_resources').value = this.getChecked().join(','); -} - -function processChildren(node, state) -{ - if ( !node.hasChildNodes() ) return false; - for(var i = 0; i < node.childNodes.length; i++ ) { - node.childNodes[i].ui.check(state); - if ( node.childNodes[i].hasChildNodes() ) { - processChildren(node.childNodes[i], state); - } - } - return true; -} -</script> diff --git a/app/code/Magento/Webapi/view/adminhtml/rolesusersgridjs.phtml b/app/code/Magento/Webapi/view/adminhtml/rolesusersgridjs.phtml deleted file mode 100644 index 3399d3e9e0dfbbf2eb8627e655cb4fd300adace0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webapi/view/adminhtml/rolesusersgridjs.phtml +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Template contains JS that handles checkbox on users grid in role edit tab. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - * - * @var \Magento\View\Element\Template $this - */ -?> -<?php $usersGridBlock = $this->getLayout()->getBlock('webapi.role.edit.tab.users.grid'); ?> -<?php $inRoleUsersColumn = $this->getLayout()->getBlock('webapi.role.edit.tab.users.grid.columnSet.in_role_users'); ?> -<?php if ($usersGridBlock && $usersGridBlock->getJsObjectName()): ?> - <script type="text/javascript"> - var checkBoxes = $H({}); - var warning = false; - var inRoleUsers = $H(arrayToObject( - <?php echo $this->helper('Magento\Core\Helper\Data')->jsonEncode($inRoleUsersColumn->getValues()) ?>) - ); - if (inRoleUsers.size() > 0) { - warning = true; - } - $('in_role_user').value = inRoleUsers.toQueryString(); - - function arrayToObject(array) { - var result = {}; - for (var i = 0; i < array.length; ++i) { - result[array[i]] = 1; - } - return result; - } - - function registerUserRole(grid, element, checked) { - if (checked) { - inRoleUsers.set(element.value, 0); - } else { - inRoleUsers.unset(element.value); - } - $('in_role_user').value = inRoleUsers.toQueryString(); - grid.reloadParams = {'in_role_user[]':inRoleUsers.keys()}; - } - - function roleUsersRowClick(grid, event) { - var trElement = Event.findElement(event, 'tr'); - var isInput = Event.element(event).tagName == 'INPUT'; - if (trElement) { - var checkbox = Element.getElementsBySelector(trElement, 'input'); - if (checkbox[0]) { - var checked = isInput ? checkbox[0].checked : !checkbox[0].checked; - if (inRoleUsers.get(checkbox[0].value) && !checked && warning && checkBoxes.size() > 0) { - if (!confirm("<?php echo __('Warning!\r\nThis action will remove this user from already assigned role\r\nAre you sure?' - ) ?>")) { - checkbox[0].checked = false; - checkBoxes.each(function(elem) { - if (elem.value.status == 1) { - elem.value.object.checked = true; - } - }); - return false; - } - warning = false; - } - <?php echo $usersGridBlock->getJsObjectName() ?>.setCheckboxChecked(checkbox[0], checked); - } - } - } - - function roleUsersRowInit(grid, row) { - var checkbox = $(row).getElementsByClassName('checkbox')[0]; - if (checkbox) { - checkBoxes.set(checkbox.value, {'status' : ((checkbox.checked) ? 1 : 0), 'object' : checkbox}); - } - } - - function checkCheckboxesHandler(obj) { - if (warning && checkBoxes.size() > 0) { - if (!confirm("<?php echo __('Warning!\r\nThis action will remove those users from already assigned roles\r\nAre you sure?')?>") - ) { - obj.checked = false; - checkBoxes.each(function(elem) { - if (elem.value.status == 1) { - elem.value.object.checked = true; - } - }); - return false; - } - warning = false; - } - checkBoxes.each(function(elem) { - <?php echo $usersGridBlock->getJsObjectName() ?>.setCheckboxChecked(elem.value.object, obj.checked); - }); - } - - <?php echo $usersGridBlock->getJsObjectName() ?>.rowClickCallback = roleUsersRowClick; - <?php echo $usersGridBlock->getJsObjectName() ?>.initRowCallback = roleUsersRowInit; - <?php echo $usersGridBlock->getJsObjectName() ?>.checkboxCheckCallback = registerUserRole; - <?php echo $usersGridBlock->getJsObjectName() ?>.checkCheckboxes = checkCheckboxesHandler; - <?php echo $usersGridBlock->getJsObjectName() ?>.rows.each( - function(row) { - roleUsersRowInit(<?php echo $usersGridBlock->getJsObjectName() ?>, row)} - ); - $('in_role_user_old').value = $('in_role_user').value; - </script> -<?php endif; ?> diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webhook.php b/app/code/Magento/Webhook/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webhook.php deleted file mode 100644 index 3b71bab910f85cf9e5d5017a3c1e58d629ad3a8c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Integration/Activate/Permissions/Tab/Webhook.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Webhook permissions tab for integration activation dialog. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Integration\Activate\Permissions\Tab; - -use Magento\Backend\Block\Widget\Tab\TabInterface; -use Magento\View\Element\Template; - -class Webhook extends Template implements TabInterface -{ - /** - * {@inheritDoc} - */ - public function canShowTab() - { - return true; - } - - /** - * {@inheritDoc} - */ - public function getTabLabel() - { - return __('Webhook'); - } - - /** - * {@inheritDoc} - */ - public function getTabTitle() - { - return __('Webhook'); - } - - /** - * {@inheritDoc} - */ - public function isHidden() - { - return false; - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Activate.php b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Activate.php deleted file mode 100644 index 934bb556406849110d149d227eb7a683b90b7743..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Activate.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -/** - * Creates block with an activation template - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -class Activate extends \Magento\Backend\Block\Template -{ - const DATA_NAME = 'name'; - const DATA_TOPICS = 'topics'; - /** Subscription Data key for getting the subscription id */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - - /** Registry key for getting subscription data */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** @var array */ - protected $_subscriptionData; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - array $data = array() - ) { - parent::__construct($context, $data); - $this->_subscriptionData = $registry->registry(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION); - } - - /** - * Gets accept url - * - * @return string - */ - public function getAcceptUrl() - { - return $this->getUrl('adminhtml/*/accept', array('id' => $this->_subscriptionData[self::DATA_SUBSCRIPTION_ID])); - } - - /** - * Get subscription name - * - * @return string - */ - public function getSubscriptionName() - { - return $this->_subscriptionData[self::DATA_NAME]; - } - - /** - * Get list of topics for subscription - * - * @return string[] - */ - public function getSubscriptionTopics() - { - return $this->_subscriptionData[self::DATA_TOPICS]; - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php deleted file mode 100644 index 1c63171b3fac6453925bd860487d0084c366eecb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Creates registration form - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create; - -/** - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Form extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** Constants for API user details */ - const API_KEY_LENGTH = 32; - const API_SECRET_LENGTH = 32; - const MIN_TEXT_INPUT_LENGTH = 20; - - /** Registry key for getting subscription data */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Data key for getting subscription id out of subscription data */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - - /** - * Prepares registration form - * - * @return \Magento\Backend\Block\Widget\Form - */ - protected function _prepareForm() - { - $subscription = $this->_coreRegistry->registry(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION); - $apiKey = $this->_generateRandomString(self::API_KEY_LENGTH); - $apiSecret = $this->_generateRandomString(self::API_SECRET_LENGTH); - $inputLength = max(self::API_KEY_LENGTH, self::API_SECRET_LENGTH, self::MIN_TEXT_INPUT_LENGTH); - - $form = $this->_formFactory->create(array( - 'attributes' => array( - 'id' => 'api_user', - 'action' => $this->getUrl( - 'adminhtml/*/register', array('id' => $subscription[self::DATA_SUBSCRIPTION_ID]) - ), - 'method' => 'post', - )) - ); - - $fieldset = $form; - - $fieldset->addField('company', 'text', array( - 'label' => __('Company'), - 'name' => 'company', - 'size' => $inputLength, - )); - - $fieldset->addField('email', 'text', array( - 'label' => __('Contact Email'), - 'name' => 'email', - 'class' => 'email', - 'required' => true, - 'size' => $inputLength, - )); - - $fieldset->addField('apikey', 'text', array( - 'label' => __('API Key'), - 'name' => 'apikey', - 'value' => $apiKey, - 'class' => 'monospace', - 'required' => true, - 'size' => $inputLength, - )); - - $fieldset->addField('apisecret', 'text', array( - 'label' => __('API Secret'), - 'name' => 'apisecret', - 'value' => $apiSecret, - 'class' => 'monospace', - 'required' => true, - 'size' => $inputLength, - )); - - $form->setUseContainer(true); - - $this->setForm($form); - - return parent::_prepareForm(); - } - - /** - * Generates a random alphanumeric string - * - * @param int $length - * @return string - */ - private function _generateRandomString($length) - { - return $this->mathRandom->getRandomString( - $length, \Magento\Math\Random::CHARS_DIGITS . \Magento\Math\Random::CHARS_LOWERS - ); - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/Container.php b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/Container.php deleted file mode 100644 index bac3dfadbab2ebe2c497593385d8e4fbb815823d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/Container.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * Container for "create registration" form - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create\Form; - -class Container extends \Magento\Backend\Block\Template -{ - /** Key used to store subscription data into the registry */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Keys used to retrieve values from subscription data array */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - const DATA_NAME = 'name'; - - /** @var array */ - protected $_subscriptionData; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - array $data = array() - ) { - parent::__construct($context, $data); - $this->_subscriptionData = $registry->registry(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION);; - } - - /** - * Gets submit url - * - * @return string Form url - */ - public function getSubmitUrl() - { - return $this->getUrl( - 'adminhtml/*/register', array('id' => $this->_subscriptionData[self::DATA_SUBSCRIPTION_ID]) - ); - } - - /** - * Get subscription name - * - * @return string - */ - public function getSubscriptionName() - { - return $this->_subscriptionData[self::DATA_NAME]; - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Failed.php b/app/code/Magento/Webhook/Block/Adminhtml/Registration/Failed.php deleted file mode 100644 index 7e0bbb610a88c0805d144fb2e8f310654dbffba2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Registration/Failed.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Creates a block given failed registration - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -class Failed extends \Magento\Backend\Block\Template -{ - /** - * Get error message produced on failure - * - * @return string The error message produced upon failure - */ - public function getSessionError() - { - $lastAdded = $this->_backendSession->getMessages(true)->getLastAddedMessage(); - return $lastAdded ? $lastAdded->toString() : null; - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Subscription.php b/app/code/Magento/Webhook/Block/Adminhtml/Subscription.php deleted file mode 100644 index 8cc0a4728c6283d71be23e27863ee0a9c2c59cb2..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Subscription.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Subscription grid container - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml; - -class Subscription extends \Magento\Backend\Block\Widget\Grid\Container -{ - /** - * @var string - */ - protected $_blockGroup = 'Magento_Webhook'; - - /** - * @var string - */ - protected $_controller = 'adminhtml_subscription'; - - /** - * Internal constructor. - */ - protected function _construct() - { - parent::_construct(); - - $this->_headerText = __('Subscriptions'); - $this->_addButtonLabel = __('Add Subscription'); - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit.php b/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit.php deleted file mode 100644 index fb57603916ae0dbe4c600cbe6859bcb590f0919f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit.php +++ /dev/null @@ -1,102 +0,0 @@ -<?php -/** - * Container for editing subscription grid - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription; - -class Edit extends \Magento\Backend\Block\Widget\Form\Container -{ - /** Key used to store subscription data into the registry */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Keys used to retrieve values from subscription data array */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - - /** @var array $_subscriptionData */ - protected $_subscriptionData; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - array $data = array() - ) { - parent::__construct($context, $data); - - $this->_objectId = 'id'; - $this->_blockGroup = 'Magento_Webhook'; - $this->_controller = 'adminhtml_subscription'; - $this->_subscriptionData = $registry->registry(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION); - // Don't allow the merchant to delete subscriptions that were generated by config file. - if ($this->_isCreatedByConfig()) { - $this->_removeButton('delete'); - $this->_removeButton('reset'); - $this->_removeButton('save'); - } - } - - /** - * Gets header text - * - * @return string - */ - public function getHeaderText() - { - if ($this->_isExistingSubscription()) { - return __('Edit Subscription'); - } else { - return __('Add Subscription'); - } - } - - /** - * Returns true is subscription exists - * - * @return bool - */ - protected function _isExistingSubscription() - { - return $this->_subscriptionData - && isset($this->_subscriptionData[self::DATA_SUBSCRIPTION_ID]) - && $this->_subscriptionData[self::DATA_SUBSCRIPTION_ID]; - } - - /** - * Check whether subscription was generated from configuration. - * - * Return false if subscription created within UI. - * - * @return bool - */ - protected function _isCreatedByConfig() - { - return $this->_subscriptionData && isset($this->_subscriptionData['alias']); - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php b/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php deleted file mode 100644 index 53585d4d4bd829618a18a66a5210f16ac242aa0c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Edit/Form.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/** - * Form to edit webhook subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Edit; - -/** - * @SuppressWarnings(PHPMD.DepthOfInheritance) - */ -class Form extends \Magento\Backend\Block\Widget\Form\Generic -{ - /** Key used to store subscription data into the registry */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Keys used to retrieve values from subscription data array */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - const DATA_ALIAS = 'alias'; - - /** @var \Magento\Webhook\Model\Source\Format $_format */ - protected $_format; - - /** @var \Magento\Webhook\Model\Source\Authentication $_authentication */ - protected $_authentication; - - /** @var \Magento\Webhook\Model\Source\Hook $_hook */ - protected $_hook; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Webhook\Model\Source\Format $format - * @param \Magento\Webhook\Model\Source\Authentication $authentication - * @param \Magento\Webhook\Model\Source\Hook $hook - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Data\FormFactory $formFactory, - \Magento\Webhook\Model\Source\Format $format, - \Magento\Webhook\Model\Source\Authentication $authentication, - \Magento\Webhook\Model\Source\Hook $hook, - array $data = array() - ) { - parent::__construct($context, $registry, $formFactory, $data); - $this->_formFactory = $formFactory; - $this->_registry = $registry; - $this->_format = $format; - $this->_authentication = $authentication; - $this->_hook = $hook; - } - - /** - * Prepares subscription editor form - * - * @return \Magento\Backend\Block\Widget\Form - */ - protected function _prepareForm() - { - $subscriptionData = $this->_registry->registry(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION); - - $subscriptionId = isset($subscriptionData[self::DATA_SUBSCRIPTION_ID]) - ? $subscriptionData[self::DATA_SUBSCRIPTION_ID] - : 0; - $form = $this->_formFactory->create(array( - 'attributes' => array( - 'id' => 'edit_form', - 'action' => $this->getUrl('adminhtml/*/save', array('id' => $subscriptionId)), - 'method' => 'post', - )) - ); - - // We don't want to allow subscriptions defined in config to be edited by the user. - $disabled = isset($subscriptionData[self::DATA_ALIAS]) && !empty($subscriptionData[self::DATA_ALIAS]); - - $fieldset = $form->addFieldset('subscription_fieldset', array('legend' => __('Subscription'))); - - $fieldset->addField( - 'name', 'text', - array( - 'label' => __('Name'), - 'class' => 'required-entry', - 'required' => true, - 'name' => 'name', - 'disabled' => $disabled, - ) - ); - - $fieldset->addField( - 'endpoint_url', 'text', - array( - 'label' => __('Endpoint URL'), - 'class' => 'required-entry', - 'required' => true, - 'name' => 'endpoint_url', - 'disabled' => $disabled, - ) - ); - - $fieldset->addField( - 'format', 'select', - array( - 'name' => 'format', - 'label' => __('Format'), - 'title' => __('Format'), - 'values' => $this->_format->getFormatsForForm(), - 'disabled' => $disabled, - ) - ); - - $fieldset->addField( - 'authentication_type', 'select', - array( - 'name' => 'authentication_type', - 'label' => __('Authentication Types'), - 'title' => __('Authentication Types'), - 'values' => $this->_authentication->getAuthenticationsForForm(), - 'disabled' => $disabled, - ) - ); - - $fieldset->addField( - 'topics', 'multiselect', - array( - 'name' => 'topics[]', - 'label' => __('Topics'), - 'title' => __('Topics'), - 'required' => true, - 'values' => $this->_hook->getTopicsForForm(), - 'disabled' => $disabled, - ) - ); - - $form->setUseContainer(true); - $form->setValues($subscriptionData); - $this->setForm($form); - return parent::_prepareForm(); - } -} diff --git a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/Action.php b/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/Action.php deleted file mode 100644 index b7e0b767db937db1a5116e9aeaa16767ddc8f7d1..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/Action.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php -/** - * Renders html code for subscription grid items - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer; - -class Action - extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer -{ - /** - * Render a given html for the subscription grid - * - * @param \Magento\Object $row - * @return string The rendered html code for a given row - */ - public function render(\Magento\Object $row) - { - if (!($row instanceof \Magento\Webhook\Model\Subscription)) { - return ''; - } - - switch ($row->getStatus()) { - case \Magento\Webhook\Model\Subscription::STATUS_ACTIVE : - return '<a href="' - . $this->getUrl('adminhtml/webhook_subscription/revoke', array('id' => $row->getId())) - . '">' . __('Revoke') . '</a>'; - case \Magento\Webhook\Model\Subscription::STATUS_REVOKED : - return '<a href="' - . $this->getUrl('adminhtml/webhook_subscription/activate', array('id' => $row->getId())) - . '">' . __('Activate') . '</a>'; - case \Magento\Webhook\Model\Subscription::STATUS_INACTIVE : - $url = $this->getUrl('adminhtml/webhook_registration/activate', array('id' => $row->getId())); - return '<a href="#" onclick="activateSubscription(\''. $url .'\'); return false;">' - . __('Activate') . '</a>'; - default : - return ''; - } - } -} diff --git a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php deleted file mode 100644 index 436a8cddb5891191e05e43265cef0142402b31ef..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Registration.php +++ /dev/null @@ -1,239 +0,0 @@ -<?php - -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -/** - * Registration controller - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ -class Registration extends \Magento\Backend\App\AbstractAction -{ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - const DATA_TOPICS = 'topics'; - const DATA_NAME = 'name'; - - /** Key used to store subscription data into the registry */ - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Param keys used to extract subscription details from the Request */ - const PARAM_SUBSCRIPTION_ID = 'id'; - const PARAM_APIKEY = 'apikey'; - const PARAM_APISECRET = 'apisecret'; - const PARAM_EMAIL = 'email'; - const PARAM_COMPANY = 'company'; - - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - /** @var \Magento\Webhook\Service\SubscriptionV1Interface */ - private $_subscriptionService; - - /** @var \Magento\Webhook\Model\Webapi\User\Factory */ - private $_userFactory; - - /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Webhook\Model\Webapi\User\Factory $userFactory - * @param \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService - * @param \Magento\Core\Model\Registry $registry - */ - public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Webhook\Model\Webapi\User\Factory $userFactory, - \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService, - \Magento\Core\Model\Registry $registry - ) { - parent::__construct($context); - $this->_userFactory = $userFactory; - $this->_subscriptionService = $subscriptionService; - $this->_registry = $registry; - } - - /** - * Activate subscription - * Step 1 - display subscription required resources - */ - public function activateAction() - { - try { - $this->_initSubscription(); - $this->_view->loadLayout(); - $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { - $this->_redirectFailed($e->getMessage()); - } - } - - /** - * Agree to provide required subscription resources - * Step 2 - redirect to specified auth action - */ - public function acceptAction() - { - try { - $subscriptionData = $this->_initSubscription(); - - $route = '*/webhook_registration/user'; - $this->_redirect( - $route, - array(self::PARAM_SUBSCRIPTION_ID => $subscriptionData[self::DATA_SUBSCRIPTION_ID]) - ); - } catch (\Magento\Core\Exception $e) { - $this->_redirectFailed($e->getMessage()); - } - } - - /** - * Displays form for gathering api user data - */ - public function userAction() - { - try { - $this->_initSubscription(); - $this->_view->loadLayout(); - $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { - $this->_redirectFailed($e->getMessage()); - } - } - - /** - * Continue createApiUser - */ - public function registerAction() - { - try { - $subscriptionData = $this->_initSubscription(); - /** @var string $key */ - $key = $this->getRequest()->getParam(self::PARAM_APIKEY); - /** @var string $secret */ - $secret = $this->getRequest()->getParam(self::PARAM_APISECRET); - /** @var string $email */ - $email = $this->getRequest()->getParam(self::PARAM_EMAIL); - /** @var string $company */ - $company = $this->getRequest()->getParam(self::PARAM_COMPANY); - - if (empty($key) || empty($secret) || empty($email)) { - throw new \Magento\Webhook\Exception( - __('API Key, API Secret and Contact Email are required fields.') - ); - } - - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - $this->_redirectFailed(__('Invalid Email address provided')); - return; - } - - $userContext = array( - 'email' => $email, - 'key' => $key, - 'secret' => $secret, - 'company' => $company, - ); - - /** @var string[] $topics */ - $topics = $subscriptionData[self::DATA_TOPICS]; - $userId = $this->_userFactory->createUser($userContext, $topics); - - $subscriptionData['api_user_id'] = $userId; - $subscriptionData['status'] = \Magento\Webhook\Model\Subscription::STATUS_ACTIVE; - $subscriptionData = $this->_subscriptionService->update($subscriptionData); - - $this->_redirectSucceeded($subscriptionData); - - } catch (\Magento\Core\Exception $e) { - $this->_redirectFailed($e->getMessage()); - } - } - - /** - * Redirect to this page when the authentication process is completed successfully - */ - public function succeededAction() - { - try { - $this->_view->loadLayout(); - $this->_view->renderLayout(); - $subscriptionData = $this->_initSubscription(); - - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been activated.', - $subscriptionData[self::DATA_NAME]) - ); - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - } - - /** - * Redirect to this action when the authentication process fails for any reason. - */ - public function failedAction() - { - $this->_view->loadLayout(); - $this->_view->renderLayout(); - } - - /** - * Initialize general settings for subscription - * - * @throws \Exception|\Magento\Core\Exception if subscription can't be found - * @return array - */ - protected function _initSubscription() - { - $subscriptionId = (int) $this->getRequest()->getParam(self::PARAM_SUBSCRIPTION_ID); - $subscriptionData = $this->_subscriptionService->get($subscriptionId); - - $this->_registry->register(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION, $subscriptionData); - return $subscriptionData; - } - - /** - * Log successful subscription and redirect to success page - * - * @param array $subscriptionData - */ - protected function _redirectSucceeded(array $subscriptionData) - { - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been activated.', $subscriptionData[self::DATA_NAME]) - ); - $this->_redirect('adminhtml/webhook_registration/succeeded', - array(self::PARAM_SUBSCRIPTION_ID => $subscriptionData[self::DATA_SUBSCRIPTION_ID])); - } - - /** - * Add error and redirect to failure page - * - * @param string $errorMessage - */ - protected function _redirectFailed($errorMessage) - { - $this->_getSession()->addError($errorMessage); - $this->_redirect('adminhtml/webhook_registration/failed'); - } -} diff --git a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php b/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php deleted file mode 100644 index e3afc24564330731afefb82794a3f888ef71a730..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Controller/Adminhtml/Webhook/Subscription.php +++ /dev/null @@ -1,295 +0,0 @@ -<?php -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -/** - * Subscription controller - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @SuppressWarnings(PHPMD.ExcessiveParameterList) - */ -class Subscription extends \Magento\Backend\App\AbstractAction -{ - /** Param Key for extracting subscription id from Request */ - const PARAM_SUBSCRIPTION_ID = 'id'; - - /** Data keys for extracting information from Subscription data array */ - const DATA_SUBSCRIPTION_ID = 'subscription_id'; - const DATA_ALIAS = 'alias'; - const DATA_NAME = 'name'; - const DATA_ENDPOINT_URL = 'endpoint_url'; - const DATA_TOPICS = 'topics'; - - /** Keys used for registering data into the registry */ - const REGISTRY_KEY_WEBHOOK_ACTION = 'webhook_action'; - const REGISTRY_KEY_CURRENT_SUBSCRIPTION = 'current_subscription'; - - /** Value stored under the key REGISTRY_KEY_WEBHOOK_ACTION to indicate that this is a new subscription */ - const ACTION_NEW = 'new'; - - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - /** @var \Magento\Webhook\Service\SubscriptionV1Interface */ - private $_subscriptionService; - - /** - * @param \Magento\Backend\App\Action\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService - */ - public function __construct( - \Magento\Backend\App\Action\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Webhook\Service\SubscriptionV1Interface $subscriptionService - ) { - parent::__construct($context); - $this->_registry = $registry; - $this->_subscriptionService = $subscriptionService; - } - - /** - * Loads and renders subscription controller layout - */ - public function indexAction() - { - $this->_view->loadLayout(); - $this->_setActiveMenu('Magento_Webhook::system_api_webapi_webhook'); - $this->_title->add(__('System')); - $this->_title->add(__('Web Services')); - $this->_title->add(__('WebHook Subscriptions')); - - $this->_view->renderLayout(); - } - - /** - * Register new action and throw control to 'edit' action - */ - public function newAction() - { - $this->_forward('edit'); - } - - /** - * Initialize subscription and render action layout - */ - public function editAction() - { - try { - $subscriptionData = $this->_initSubscriptionData(); - - if ($this->_registry->registry(self::REGISTRY_KEY_WEBHOOK_ACTION) !== self::ACTION_NEW) { - $data = $this->_session->getFormData(true); - if (!empty($data)) { - $subscriptionData = $this->_updateSubscriptionData($subscriptionData, $data); - } - $this->_registry->unregister(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION); - $this->_registry->register(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION, $subscriptionData); - } - - $this->_view->loadLayout(); - $this->_setActiveMenu('Magento_Webapi::system_webapi'); - $this->_title->add(__('System')); - $this->_title->add(__('Web Services')); - $this->_title->add(__('WebHook Subscriptions')); - if ($this->_registry->registry(self::REGISTRY_KEY_WEBHOOK_ACTION) === self::ACTION_NEW) { - $this->_title->add(__('Add Subscription')); - } else { - $this->_title->add(__('Edit Subscription')); - } - - $this->_view->renderLayout(); - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_redirect('adminhtml/*/'); - } - } - - /** - * Save subscription action - */ - public function saveAction() - { - try { - /** @var array $data */ - $data = $this->getRequest()->getPost(); - $subscriptionData = $this->_initSubscriptionData(); - if ($data) { - $subscriptionData = $this->_updateSubscriptionData($subscriptionData, $data); - if ($this->_registry->registry(self::REGISTRY_KEY_WEBHOOK_ACTION) === self::ACTION_NEW) { - $this->_subscriptionService->create($subscriptionData); - } else if ( - isset($subscriptionData[self::DATA_SUBSCRIPTION_ID]) - && $subscriptionData[self::DATA_SUBSCRIPTION_ID] - ) { - $this->_subscriptionService->update($subscriptionData); - } else { - $this->_subscriptionService->create($subscriptionData); - } - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been saved.', - $subscriptionData[self::DATA_NAME]) - ); - $this->_redirect('adminhtml/*/'); - } else { - $this->_getSession()->addError( - __('The subscription \'%1\' has not been saved, as no data was provided.', - $subscriptionData[self::DATA_NAME]) - ); - $this->_redirect( - '*/*/edit', - array(self::PARAM_SUBSCRIPTION_ID => $this->getRequest()->getParam(self::PARAM_SUBSCRIPTION_ID)) - ); - } - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - $this->_redirect('adminhtml/*/'); - } - } - - /** - * Delete subscription action - */ - public function deleteAction() - { - try { - $subscriptionData = $this->_initSubscriptionData(); - if ($this->_isCreatedByUser($subscriptionData)) { - try { - $subscriptionId = isset($subscriptionData[self::DATA_SUBSCRIPTION_ID]) - ? $subscriptionData[self::DATA_SUBSCRIPTION_ID] - : null; - $this->_subscriptionService->delete($subscriptionId); - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been removed.', - $subscriptionData[self::DATA_NAME]) - ); - } - catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - } else { - $this->_getSession()->addError( - __('The subscription \'%1\' can not be removed.', - $subscriptionData[self::DATA_NAME]) - ); - } - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - $this->_redirect('adminhtml/*/'); - } - - /** - * Revoke subscription - */ - public function revokeAction() - { - try { - $subscriptionId = $this->getRequest()->getParam(self::PARAM_SUBSCRIPTION_ID); - if ($subscriptionId) { - $subscriptionData = $this->_subscriptionService->revoke($subscriptionId); - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been revoked.', - $subscriptionData[self::DATA_NAME]) - ); - } else { - $this->_getSession()->addError(__('No Subscription ID was provided with the request.')); - } - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - - $this->_redirect('adminhtml/webhook_subscription/index'); - } - - /** - * Activate subscription. Step 1 - display subscription required resources - */ - public function activateAction() - { - try { - $subscriptionId = $this->getRequest()->getParam(self::PARAM_SUBSCRIPTION_ID); - if ($subscriptionId) { - $subscriptionData = $this->_subscriptionService->activate($subscriptionId); - $this->_getSession()->addSuccess( - __('The subscription \'%1\' has been activated.', - $subscriptionData[self::DATA_NAME]) - ); - } else { - $this->_getSession()->addError(__('No Subscription ID was provided with the request.')); - } - } catch (\Magento\Core\Exception $e) { - $this->_getSession()->addError($e->getMessage()); - } - - $this->_redirect('adminhtml/webhook_subscription/index'); - } - - /** - * Initialize general settings for subscription - * - * @return array - * @throws \Magento\Webhook\Exception - */ - protected function _initSubscriptionData() - { - $subscriptionId = (int) $this->getRequest()->getParam(self::PARAM_SUBSCRIPTION_ID); - if ($subscriptionId) { - $subscriptionData = $this->_subscriptionService->get($subscriptionId); - } else { - $subscriptionData = array(); - $this->_registry->register(self::REGISTRY_KEY_WEBHOOK_ACTION, self::ACTION_NEW); - } - - $this->_registry->register(self::REGISTRY_KEY_CURRENT_SUBSCRIPTION, $subscriptionData); - return $subscriptionData; - } - - /** - * Helper function that returns updated subscription data with data gathered from a Form post. - * - * We need to make sure that only authorized data is being updated. For example we disable the 'Version' field - * in the UI for subscriptions generated by config, we don't want a user to be able to bypass this by performing - * a manual POST. - * - * @param array $subscriptionData - * @param array $data - * @return array - */ - protected function _updateSubscriptionData($subscriptionData, $data) - { - return array_merge($subscriptionData, $data); - } - - /** - * Determine if a subscription was created by a user or not, by looking at the data. - * - * @param array $subscriptionData - * @return bool true if the subscription was created by a user - */ - protected function _isCreatedByUser($subscriptionData) - { - return !isset($subscriptionData[self::DATA_ALIAS]); - } -} diff --git a/app/code/Magento/Webhook/Helper/Data.php b/app/code/Magento/Webhook/Helper/Data.php deleted file mode 100644 index 7e4241d29cdf45f70a94a1dfe6b2b5cc50df3b62..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Helper/Data.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -/** - * Webhook module helper needed for translation. - * - * As long as we have code like \Magento\Backend\Model\Menu\Item that calls helpers for every module - * we will need every module to have a Data helper, even if the module itself doesn't use it thanks to - * DI being available for translation. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Helper; - -class Data extends \Magento\App\Helper\AbstractHelper -{ -} diff --git a/app/code/Magento/Webhook/Model/Config.php b/app/code/Magento/Webhook/Model/Config.php deleted file mode 100644 index 48945bf39708aa1b80446c44d25e02922123e9a6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Config.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model; - -class Config -{ - /** - * Get webhook list - * - * @return array - */ - public function getWebhooks() - { - return array(); - } - - /** - * Get webhook subscriptions - * - * @return array - */ - public function getSubscriptions() - { - return array(); - } -} \ No newline at end of file diff --git a/app/code/Magento/Webhook/Model/Endpoint.php b/app/code/Magento/Webhook/Model/Endpoint.php deleted file mode 100644 index 492e606302686f2bee885ad3ce368228fd8dbc1d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Endpoint.php +++ /dev/null @@ -1,161 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model; - -/** - * Represents an endpoint to which messages can be sent - * - * @method string getName() - * @method \Magento\Webhook\Model\Endpoint setName(string $value) - * @method \Magento\Webhook\Model\Endpoint setEndpointUrl(string $value) - * @method string getUpdatedAt() - * @method \Magento\Webhook\Model\Endpoint setUpdatedAt(string $value) - * @method \Magento\Webhook\Model\Endpoint setFormat(string $value) - * @method string getApiUserId() - * @method \Magento\Webhook\Model\Endpoint setApiUserId(string $value) - * @method \Magento\Webhook\Model\Endpoint setAuthenticationType(string $value) - * @method \Magento\Webhook\Model\Endpoint setTimeoutInSecs(string $value) - */ -class Endpoint extends \Magento\Core\Model\AbstractModel implements \Magento\Outbound\EndpointInterface -{ - /** - * Used to create a User abstraction from a given webapi user associated with this subscription. - * @var \Magento\Webhook\Model\User\Factory - */ - private $_userFactory; - - /** - * @var \Magento\Stdlib\DateTime - */ - protected $_dateTime; - - /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Webhook\Model\User\Factory $userFactory - * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Webhook\Model\User\Factory $userFactory, - \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_userFactory = $userFactory; - $this->_dateTime = $dateTime; - } - - /** - * Initialize model - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Resource\Endpoint'); - } - - /** - * Return subscription endpoint url for compatibility with interface - * - * @return string - */ - public function getEndpointUrl() - { - return $this->getData('endpoint_url'); - } - - /** - * Return subscription timeout in secs for compatibility with interface - * - * @return string - */ - public function getTimeoutInSecs() - { - return $this->getData('timeout_in_secs'); - } - - /** - * Prepare data to be saved to database - * - * @return \Magento\Core\Model\AbstractModel - * @throws \Magento\Webhook\Exception - */ - protected function _beforeSave() - { - parent::_beforeSave(); - - if (!$this->hasAuthenticationType()) { - $this->setAuthenticationType(\Magento\Outbound\EndpointInterface::AUTH_TYPE_NONE); - } - - if ($this->hasDataChanges()) { - $this->setUpdatedAt($this->_dateTime->formatDate(time())); - } - - return $this; - } - - /** - * Returns the format this message should be sent in (JSON, XML, etc.) - * - * @return string - */ - public function getFormat() - { - return $this->getData('format'); - } - - /** - * 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() - { - if ($this->getApiUserId() === null) { - return null; - } - return $this->_userFactory->create($this->getApiUserId()); - } - - /** - * Returns the type of authentication to use when attaching authentication to a message - * - * @return string - */ - public function getAuthenticationType() - { - return $this->getData('authentication_type'); - } -} diff --git a/app/code/Magento/Webhook/Model/Event.php b/app/code/Magento/Webhook/Model/Event.php deleted file mode 100644 index 1d3f9ef91578b1a13a8e182df97a5e7085b41814..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Event.php +++ /dev/null @@ -1,192 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model; - -/** - * Stores event information in Magento database - * - * @method \Magento\Webhook\Model\Event setStatus() - * @method \Magento\Webhook\Model\Event setUpdatedAt() - * @method \Magento\Webhook\Model\Event setCreatedAt() - */ -class Event extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\EventInterface -{ - /** - * @var \Magento\Stdlib\DateTime - */ - protected $_dateTime; - - /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_dateTime = $dateTime; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - /** - * Initialize Model - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Resource\Event'); - $this->setStatus(\Magento\PubSub\EventInterface::STATUS_READY_TO_SEND); - } - - /** - * Prepare data to be saved to database - * - * @return \Magento\Webhook\Model\Event - */ - protected function _beforeSave() - { - parent::_beforeSave(); - if ($this->isObjectNew()) { - $this->setCreatedAt($this->_dateTime->formatDate(true)); - } elseif ($this->getId() && !$this->hasData('updated_at')) { - $this->setUpdatedAt($this->_dateTime->formatDate(true)); - } - return $this; - } - - /** - * Prepare data before set - * - * @param array $data - * @return \Magento\Webhook\Model\Event - */ - public function setBodyData(array $data) - { - return $this->setData('body_data', serialize($data)); - } - - /** - * Prepare data before return - * - * @return array - */ - public function getBodyData() - { - $data = $this->getData('body_data'); - if (!is_null($data)) { - return unserialize($data); - } - return array(); - } - - /** - * Prepare headers before set - * - * @param array $headers - * @return \Magento\Webhook\Model\Event - */ - public function setHeaders(array $headers) - { - return $this->setData('headers', serialize($headers)); - } - - /** - * Prepare headers before return - * - * @return array - */ - public function getHeaders() - { - $headers = $this->getData('headers'); - if (!is_null($headers)) { - return unserialize($headers); - } - return array(); - } - - /** - * Prepare options before set - * - * @param array $options - * @return \Magento\Webhook\Model\Event - */ - public function setOptions(array $options) - { - return $this->setData('options', serialize($options)); - } - - /** - * Return status. Enable compatibility with interface - * - * @return null|int - */ - public function getStatus() - { - return $this->getData('status'); - } - - /** - * Return topic and enable compatibility with interface - * - * @return null|string - */ - public function getTopic() - { - return $this->getData('topic'); - } - - /** - * Mark event as processed - * - * @return \Magento\Webhook\Model\Event - */ - public function complete() - { - $this->setData('status', \Magento\PubSub\EventInterface::STATUS_PROCESSED) - ->save(); - return $this; - } - - /** - * Mark event as processed - * - * @return \Magento\Webhook\Model\Event - */ - public function markAsInProgress() - { - $this->setData('status', \Magento\PubSub\EventInterface::STATUS_IN_PROGRESS); - return $this; - } -} diff --git a/app/code/Magento/Webhook/Model/Event/Factory.php b/app/code/Magento/Webhook/Model/Event/Factory.php deleted file mode 100644 index 38cacbbe5b3bb7a387dec31f7e3b746c7480d2a0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Event/Factory.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Creates new \Magento\Webhook\Model\Event 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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class Factory implements \Magento\PubSub\Event\FactoryInterface -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** @var \Magento\Convert\Object */ - private $_arrayConverter; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - * @param \Magento\Convert\Object $arrayConverter - */ - public function __construct( - \Magento\ObjectManager $objectManager, - \Magento\Convert\Object $arrayConverter - ) { - $this->_objectManager = $objectManager; - $this->_arrayConverter = $arrayConverter; - } - - /** - * Create event - * - * @param string $topic Topic on which to publish data - * @param array $data Data to be published. Should only contain primitives - * @return \Magento\Webhook\Model\Event - */ - public function create($topic, $data) - { - return $this->_objectManager->create('Magento\Webhook\Model\Event', array( - 'data' => array( - 'topic' => $topic, - 'body_data' => serialize($this->_arrayConverter->convertDataToArray($data)) - ) - ))->setDataChanges(true); - } - - /** - * Return the empty instance of Event - * - * @return \Magento\Webhook\Model\Event - */ - public function createEmpty() - { - return $this->_objectManager->create('Magento\Webhook\Model\Event'); - } -} diff --git a/app/code/Magento/Webhook/Model/Event/QueueReader.php b/app/code/Magento/Webhook/Model/Event/QueueReader.php deleted file mode 100644 index 8d8c48850610206940f16b1b580c15b78664e7ed..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Event/QueueReader.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Fulfills event queueing functionality for Magento, - * wrapper around Magento collection with Event QueueReader Interface. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class QueueReader implements \Magento\PubSub\Event\QueueReaderInterface -{ - /** @var \ArrayIterator */ - protected $_iterator; - - /** - * Initialize collection representing the queue - * - * @param \Magento\Webhook\Model\Resource\Event\Collection $collection - */ - public function __construct(\Magento\Webhook\Model\Resource\Event\Collection $collection) - { - $this->_iterator = $collection->getIterator(); - } - - /** - * Get the top event from the queue. - * - * @return \Magento\PubSub\EventInterface|null - */ - public function poll() - { - if ($this->_iterator->valid()) { - /** @var \Magento\Webhook\Model\Event $event */ - $event = $this->_iterator->current(); - $this->_iterator->next(); - return $event; - } - return null; - } -} diff --git a/app/code/Magento/Webhook/Model/Event/QueueWriter.php b/app/code/Magento/Webhook/Model/Event/QueueWriter.php deleted file mode 100644 index 8f119a246c9e34eb382fc03c86a2820a5cf44778..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Event/QueueWriter.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Fulfills event queueing functionality for Magento, writes events to database based 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class QueueWriter implements \Magento\PubSub\Event\QueueWriterInterface -{ - - /** @var \Magento\Webhook\Model\Event\Factory */ - protected $_eventFactory; - - /** - * Initialize queue writer - */ - public function __construct(\Magento\Webhook\Model\Event\Factory $eventFactory) - { - $this->_eventFactory = $eventFactory; - } - - /** - * Adds event to the queue. - * - * @param \Magento\PubSub\EventInterface $event - * @return null - */ - public function offer(\Magento\PubSub\EventInterface $event) - { - if ($event instanceof \Magento\Webhook\Model\Event) { - $event->save(); - } else { - $magentoEvent = $this->_eventFactory->create($event->getTopic(), $event->getBodyData()); - $magentoEvent->save(); - } - } -} diff --git a/app/code/Magento/Webhook/Model/Job.php b/app/code/Magento/Webhook/Model/Job.php deleted file mode 100644 index aa31958ff8e25c287f3f388deb1614fc08ba26a0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Job.php +++ /dev/null @@ -1,225 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model; - -/** - * Handles HTTP responses, and manages retry schedule - * - * @method bool hasEvent() - * @method \Magento\Webhook\Model\Job setEventId() - * @method int getEventId() - * @method bool hasSubscription() - * @method \Magento\Webhook\Model\Job setSubscriptionId() - * @method int getSubscriptionId() - * @method int getRetryCount() - * @method \Magento\Webhook\Model\Job setRetryCount() - * @method \Magento\Webhook\Model\Job setRetryAt() - * @method \Magento\Webhook\Model\Job setUpdatedAt() - * @method \Magento\Webhook\Model\Job setCreatedAt() - */ -class Job extends \Magento\Core\Model\AbstractModel implements \Magento\PubSub\JobInterface -{ - /** @var \Magento\Webhook\Model\Event\Factory */ - protected $_eventFactory; - - /** @var \Magento\Webhook\Model\Subscription\Factory */ - protected $_subscriptionFactory; - - /** - * @var \Magento\Stdlib\DateTime - */ - protected $_dateTime; - - /** @var array */ - private $_retryTimeToAdd = array( - 1 => 1, - 2 => 2, - 3 => 4, - 4 => 10, - 5 => 30, - 6 => 60, - 7 => 120, - 8 => 240, - ); - - /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Webhook\Model\Event\Factory $eventFactory - * @param \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory - * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Webhook\Model\Event\Factory $eventFactory, - \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory, - \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - $this->_eventFactory = $eventFactory; - $this->_subscriptionFactory = $subscriptionFactory; - $this->_dateTime = $dateTime; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - } - - /** - * Initialize model - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Resource\Job'); - - if ($this->hasEvent()) { - $this->setEventId($this->getEvent()->getId()); - } - - if ($this->hasSubscription()) { - $this->setSubscriptionId($this->getSubscription()->getId()); - } - $this->setStatus(\Magento\PubSub\JobInterface::STATUS_READY_TO_SEND); - } - - /** - * Prepare data to be saved to database - * - * @return \Magento\Webhook\Model\Job - */ - protected function _beforeSave() - { - parent::_beforeSave(); - if ($this->isObjectNew()) { - $this->setCreatedAt($this->_dateTime->formatDate(true)); - } elseif ($this->getId() && !$this->hasData('updated_at')) { - $this->setUpdatedAt($this->_dateTime->formatDate(true)); - } - return $this; - } - - /** - * Get event - * - * @return \Magento\PubSub\EventInterface|\Magento\Webhook\Model\Event|null - */ - public function getEvent() - { - if ($this->hasData('event')) { - return $this->getData('event'); - } - - if ($this->hasData('event_id')) { - $event = $this->_eventFactory->createEmpty() - ->load($this->getEventId()); - $this->setData('event', $event); - return $event; - } - - return null; - } - - /** - * Get subscription - * - * @return \Magento\Webhook\Model\Subscription|null - */ - public function getSubscription() - { - if ($this->hasData('subscription')) { - return $this->getData('subscription'); - } - - if ($this->hasData('subscription_id')) { - $subscription = $this->_subscriptionFactory->create() - ->load($this->getSubscriptionId()); - - $this->setData('subscription', $subscription); - return $subscription; - } - - return null; - } - - /** - * Update the Job status to indicate it has completed successfully - * - * @return \Magento\Webhook\Model\Job - */ - public function complete() - { - $this->setStatus(\Magento\PubSub\JobInterface::STATUS_SUCCEEDED) - ->save(); - return $this; - } - - /** - * Handles failed HTTP response - * - * @return \Magento\Webhook\Model\Job - */ - public function handleFailure() - { - $retryCount = $this->getRetryCount(); - if ($retryCount < count($this->_retryTimeToAdd)) { - $addedTimeInMinutes = $this->_retryTimeToAdd[$retryCount + 1] * 60 + time(); - $this->setRetryCount($retryCount + 1); - $this->setRetryAt($this->_dateTime->formatDate($addedTimeInMinutes)); - $this->setUpdatedAt($this->_dateTime->formatDate(time(), true)); - $this->setStatus(\Magento\PubSub\JobInterface::STATUS_RETRY); - } else { - $this->setStatus(\Magento\PubSub\JobInterface::STATUS_FAILED); - } - return $this; - } - - /** - * Retrieve the status of the Job - * - * @return int - */ - public function getStatus() - { - return $this->getData('status'); - } - - /** - * Set the status of the Job - * - * @param int $status - * @return \Magento\Webhook\Model\Job - */ - public function setStatus($status) - { - $this->setData('status', $status); - return $this; - } -} diff --git a/app/code/Magento/Webhook/Model/Job/Factory.php b/app/code/Magento/Webhook/Model/Job/Factory.php deleted file mode 100644 index e7fe8728cb45ee9b153606d976a403fd75af00ba..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Job/Factory.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * Factory for \Magento\Webhook\Model\Job - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class Factory implements \Magento\PubSub\Job\FactoryInterface -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create Job - * - * @param \Magento\PubSub\SubscriptionInterface $subscription - * @param \Magento\PubSub\EventInterface $event - * @return \Magento\PubSub\JobInterface - */ - public function create(\Magento\PubSub\SubscriptionInterface $subscription, \Magento\PubSub\EventInterface $event) - { - return $this->_objectManager->create('Magento\Webhook\Model\Job', array( - 'data' => array( - 'event' => $event, - 'subscription' => $subscription - ) - )); - } -} diff --git a/app/code/Magento/Webhook/Model/Job/QueueReader.php b/app/code/Magento/Webhook/Model/Job/QueueReader.php deleted file mode 100644 index 7890ba840dc8078b5bef72a3415de42b9d1091e8..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Job/QueueReader.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Provides the access to collection of job items from Magento database under \Magento\PubSub\Job\QueueReaderInterface - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class QueueReader implements \Magento\PubSub\Job\QueueReaderInterface -{ - /** @var \Magento\Webhook\Model\Resource\Job\Collection */ - protected $_collection; - - /** @var \ArrayIterator */ - protected $_iterator; - - /** - * Initialize model - * - * @param \Magento\Webhook\Model\Resource\Job\Collection $collection - */ - public function __construct(\Magento\Webhook\Model\Resource\Job\Collection $collection) - { - $this->_collection = $collection; - $this->_iterator = $this->_collection->getIterator(); - } - - /** - * Return the top job from the queue. - * - * @return \Magento\PubSub\JobInterface|null - */ - public function poll() - { - if ($this->_iterator->valid()) { - /** @var $job \Magento\PubSub\JobInterface */ - $job = $this->_iterator->current(); - $this->_iterator->next(); - return $job; - } - return null; - } -} diff --git a/app/code/Magento/Webhook/Model/Job/QueueWriter.php b/app/code/Magento/Webhook/Model/Job/QueueWriter.php deleted file mode 100644 index 82a37ba37a8ecf0d6556330580fcc0b54d2491ce..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Job/QueueWriter.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Custom Magento implementation of Job Queue Writer interface, writes jobs to database based 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class QueueWriter implements \Magento\PubSub\Job\QueueWriterInterface -{ - /** @var \Magento\Webhook\Model\Job\Factory */ - protected $_jobFactory; - - /** - * Initialize model - * - * @param \Magento\Webhook\Model\Job\Factory $jobFactory - */ - public function __construct(\Magento\Webhook\Model\Job\Factory $jobFactory) - { - $this->_jobFactory = $jobFactory; - } - - /** - * Adds the job to the queue. - * - * @param \Magento\PubSub\JobInterface $job - * @return null - */ - public function offer(\Magento\PubSub\JobInterface $job) - { - if ($job instanceof \Magento\Webhook\Model\Job) { - $job->save(); - } else { - /** @var \Magento\Webhook\Model\Job $magentoJob */ - $magentoJob = $this->_jobFactory->create($job->getSubscription(), $job->getEvent()); - $magentoJob->save(); - } - } -} diff --git a/app/code/Magento/Webhook/Model/Observer.php b/app/code/Magento/Webhook/Model/Observer.php deleted file mode 100644 index c36abfac7b5f423e82a781ac35404c9acde2c79d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Observer.php +++ /dev/null @@ -1,105 +0,0 @@ -<?php -/** - * Observer that handles webapi permission changes and bridges Magento events to webhook 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class Observer -{ - /** @var \Magento\Webhook\Model\Webapi\EventHandler $_webapiEventHandler */ - private $_webapiEventHandler; - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection $_subscriptionSet */ - private $_subscriptionSet; - - /** @var \Magento\Logger */ - private $_logger; - - /** - * @param \Magento\Webhook\Model\Webapi\EventHandler $webapiEventHandler - * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - * @param \Magento\Logger $logger - */ - public function __construct( - \Magento\Webhook\Model\Webapi\EventHandler $webapiEventHandler, - \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet, - \Magento\Logger $logger - ) { - $this->_webapiEventHandler = $webapiEventHandler; - $this->_subscriptionSet = $subscriptionSet; - $this->_logger = $logger; - } - - /** - * Triggered after webapi user deleted. It updates status of the activated subscriptions - * associated with this webapi user to inactive - */ - public function afterWebapiUserDelete() - { - try { - $subscriptions = $this->_subscriptionSet->getActivatedSubscriptionsWithoutApiUser(); - /** @var \Magento\Webhook\Model\Subscription $subscription */ - foreach ($subscriptions as $subscription) { - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE) - ->save(); - } - } catch (\Exception $exception) { - $this->_logger->logException($exception); - } - } - - /** - * Triggered after webapi user change - * - * @param \Magento\Event\Observer $observer - */ - public function afterWebapiUserChange(\Magento\Event\Observer $observer) - { - try { - $model = $observer->getEvent()->getObject(); - - $this->_webapiEventHandler->userChanged($model); - } catch (\Exception $exception) { - $this->_logger->logException($exception); - } - } - - /** - * Triggered after webapi role change - * - * @param \Magento\Event\Observer $observer - */ - public function afterWebapiRoleChange(\Magento\Event\Observer $observer) - { - try { - $model = $observer->getEvent()->getObject(); - - $this->_webapiEventHandler->roleChanged($model); - } catch (\Exception $exception) { - $this->_logger->logException($exception); - } - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Endpoint.php b/app/code/Magento/Webhook/Model/Resource/Endpoint.php deleted file mode 100644 index 093d7c5426f2612c015a6c9297d30d8e411b09e3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Endpoint.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Endpoint resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class Endpoint extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Initialize resource model - */ - public function _construct() - { - $this->_init('outbound_endpoint', 'endpoint_id'); - } - - /** - * Get endpoints associated with a given api user id. - * - * @param int|int[] $apiUserIds - * @return array - */ - public function getApiUserEndpoints($apiUserIds) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select() - ->from($this->getMainTable(), array('endpoint_id')) - ->where('api_user_id IN (?)', $apiUserIds); - return $adapter->fetchCol($select); - } - - /** - * Get endpoints that do not have an associated api user - * - * @return array - */ - public function getEndpointsWithoutApiUser() - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select() - ->from($this->getMainTable(), array('endpoint_id')) - ->where('api_user_id IS NULL'); - return $adapter->fetchCol($select); - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Event.php b/app/code/Magento/Webhook/Model/Resource/Event.php deleted file mode 100644 index d43694e2d797a0b8926f2addcbdbbf4db81cb17c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Event.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Event resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class Event extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Initialize resource model - */ - public function _construct() - { - $this->_init('webhook_event', 'event_id'); - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Event/Collection.php b/app/code/Magento/Webhook/Model/Resource/Event/Collection.php deleted file mode 100644 index 1acca1484ad2c8e3a5edadcb1fdccf855f8adc37..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Event/Collection.php +++ /dev/null @@ -1,181 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model\Resource\Event; - -/** - * Event resource Collection - */ -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Number of events to load at once; - */ - const PAGE_SIZE = 100; - - /** - * Default time to wait for event handler to process events - */ - const DEFAULT_TIMEOUT_IDLING_EVENTS = 7200; - - /** @var int timeout to wait until decide that event is failed */ - protected $_timeoutIdling; - - /** - * @var \Magento\Stdlib\DateTime - */ - protected $_dateTime; - - /** - * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Logger $logger - * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Stdlib\DateTime $dateTime - * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource - * @param mixed $timeoutIdling - */ - public function __construct( - \Magento\Core\Model\EntityFactory $entityFactory, - \Magento\Logger $logger, - \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Event\ManagerInterface $eventManager, - \Magento\Stdlib\DateTime $dateTime, - $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null, - $timeoutIdling = null - ) { - $this->_dateTime = $dateTime; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_timeoutIdling = is_null($timeoutIdling) ? - self::DEFAULT_TIMEOUT_IDLING_EVENTS : $timeoutIdling; - } - - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Event', 'Magento\Webhook\Model\Resource\Event'); - } - - /** - * Adds FOR UPDATE lock on retrieved rows and filter status - * - * @return \Magento\Webhook\Model\Resource\Event\Collection - */ - protected function _initSelect() - { - parent::_initSelect(); - $this->getSelect()->forUpdate(true); - $this->addFieldToFilter('status', \Magento\PubSub\EventInterface::STATUS_READY_TO_SEND) - ->setOrder('created_at', \Magento\Data\Collection::SORT_ORDER_ASC) - ->setPageSize(self::PAGE_SIZE); - return $this; - } - - /** - * Start transaction before executing the query in order to update the status atomically - * - * @return \Magento\Webhook\Model\Resource\Event\Collection - */ - protected function _beforeLoad() - { - parent::_beforeLoad(); - $this->getConnection()->beginTransaction(); - return $this; - } - - /** - * Update the status and commit transaction in case of success - * - * @return \Magento\Webhook\Model\Resource\Event\Collection - * @throws \Exception - */ - protected function _afterLoad() - { - parent::_afterLoad(); - try { - $loadedIds = $this->_getLoadedIds(); - if (!empty($loadedIds)) { - $this->getConnection()->update($this->getMainTable(), - array('status' => \Magento\PubSub\EventInterface::STATUS_IN_PROGRESS), - array('event_id IN (?)' => $loadedIds)); - } - $this->getConnection()->commit(); - } catch (\Exception $e) { - $this->getConnection()->rollBack(); - $this->clear(); - throw $e; - } - - return $this; - } - - /** - * Retrieve ids of all loaded records - * - * @return array - */ - protected function _getLoadedIds() - { - $result = array(); - foreach ($this->getItems() as $item) { - $result[] = $item->getId(); - } - return $result; - } - - /** - * Change event status back to STATUS_READY_TO_SEND if stays in STATUS_IN_PROGRESS longer than defined delay - * - * Regularly run by scheduling mechanism - * - * @throws \Exception - * @return null - */ - public function revokeIdlingInProgress() - { - $this->getConnection()->beginTransaction(); - try { - /* if event is in progress state for less than hour we do nothing with it*/ - $okUpdatedTime = time() - $this->_timeoutIdling; - $this->addFieldToFilter('status', \Magento\PubSub\EventInterface::STATUS_IN_PROGRESS) - ->addFieldToFilter('updated_at', array('to' => $this->_dateTime->formatDate($okUpdatedTime), - 'datetime' => true)); - $idsToRevoke = $this->_getLoadedIds(); - if (count($idsToRevoke)) { - $this->getConnection()->update($this->getMainTable(), - array('status' => \Magento\PubSub\EventInterface::STATUS_READY_TO_SEND), - array('event_id IN (?)' => $idsToRevoke)); - } - } catch (\Exception $e) { - $this->getConnection()->rollBack(); - $this->clear(); - throw $e; - } - $this->getConnection()->commit(); - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Job.php b/app/code/Magento/Webhook/Model/Resource/Job.php deleted file mode 100644 index 45b7bcb165236a48c2d3558348854c1a8979ec29..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Job.php +++ /dev/null @@ -1,39 +0,0 @@ -<?php -/** - * Job resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class Job extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * Initializes resource model - */ - public function _construct() - { - $this->_init('webhook_dispatch_job', 'dispatch_job_id'); - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Job/Collection.php b/app/code/Magento/Webhook/Model/Resource/Job/Collection.php deleted file mode 100644 index 56d6bb022ffc2ae34db13392f5454b1119ef9c89..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Job/Collection.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** - * Job collection resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Job; - -class Collection extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection -{ - /** - * Number of jobs to load at once; - */ - const PAGE_SIZE = 100; - - /** - * Default time to wait for job handler to process events - */ - const DEFAULT_TIMEOUT_IDLING_JOBS = 7200; - - /** @var int timeout to wait until decide that event is failed */ - protected $_timeoutIdling; - - /** - * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Logger $logger - * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Stdlib\DateTime $dateTime - * @param mixed $connection - * @param \Magento\Core\Model\Resource\Db\AbstractDb $resource - * @param mixed $timeoutIdling - */ - public function __construct( - \Magento\Core\Model\EntityFactory $entityFactory, - \Magento\Logger $logger, - \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, - \Magento\Event\ManagerInterface $eventManager, - \Magento\Stdlib\DateTime $dateTime, - $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null, - $timeoutIdling = null - ) { - $this->dateTime = $dateTime; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_timeoutIdling = is_null($timeoutIdling) ? - self::DEFAULT_TIMEOUT_IDLING_JOBS : $timeoutIdling; - } - - /** - * Initialize Collection - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Job', 'Magento\Webhook\Model\Resource\Job'); - } - - /** - * Adds FOR UPDATE lock on retrieved rows and filter status - * - * @return \Magento\Webhook\Model\Resource\Job\Collection - */ - protected function _initSelect() - { - parent::_initSelect(); - $this->getSelect()->forUpdate(true); - - $this->addFieldToFilter('status', array( - 'in' => array( - \Magento\PubSub\JobInterface::STATUS_READY_TO_SEND, - \Magento\PubSub\JobInterface::STATUS_RETRY - ))) - ->addFieldToFilter( - 'retry_at', - array('to' => $this->dateTime->formatDate(true), 'datetime' => true) - ) - ->setOrder('updated_at', \Magento\Data\Collection::SORT_ORDER_ASC) - ->setPageSize(self::PAGE_SIZE); - return $this; - } - - /** - * Start transaction before executing the query in order to update the status atomically - * - * @return \Magento\Webhook\Model\Resource\Job\Collection - */ - protected function _beforeLoad() - { - parent::_beforeLoad(); - $this->getConnection()->beginTransaction(); - return $this; - } - - /** - * Update the status and commit transaction in case of success - * - * @return \Magento\Webhook\Model\Resource\Job\Collection - * @throws \Exception - */ - protected function _afterLoad() - { - parent::_afterLoad(); - try { - $loadedIds = $this->_getLoadedIds(); - if (!empty($loadedIds)) { - $this->getConnection()->update($this->getMainTable(), - array('status' => \Magento\PubSub\JobInterface::STATUS_IN_PROGRESS), - array('dispatch_job_id IN (?)' => $loadedIds)); - } - $this->getConnection()->commit(); - } catch (\Exception $e) { - $this->getConnection()->rollBack(); - $this->clear(); - throw $e; - } - - return $this; - } - - - /** - * Retrieve ids of all loaded records - * - * @return array - */ - protected function _getLoadedIds() - { - $result = array(); - foreach ($this->getItems() as $item) { - $result[] = $item->getId(); - } - return $result; - } - - /** - * Change job status back to STATUS_READY_TO_SEND if stays in STATUS_IN_PROGRESS longer than defined delay - * - * Regularly run by scheduling mechanism - * - * @throws \Exception - * @return null - */ - public function revokeIdlingInProgress() - { - $this->getConnection()->beginTransaction(); - try { - /* if event is in progress state for less than defined delay we do nothing with it */ - $okUpdatedTime = time() - $this->_timeoutIdling; - $this->addFieldToFilter('status', \Magento\PubSub\JobInterface::STATUS_IN_PROGRESS) - ->addFieldToFilter('updated_at', array('to' => $this->dateTime->formatDate($okUpdatedTime), - 'datetime' => true)); - - if (!count($this->getItems())) { - $this->getConnection()->commit(); - return; - } - - /** @var \Magento\Webhook\Model\Job $job */ - foreach ($this->getItems() as $job) { - $job->handleFailure() - ->save(); - } - - } catch (\Exception $e) { - $this->getConnection()->rollBack(); - $this->clear(); - throw $e; - } - $this->getConnection()->commit(); - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription.php b/app/code/Magento/Webhook/Model/Resource/Subscription.php deleted file mode 100644 index f6c7ce8e088da60b782f7fdfdcb11f9a7c99f803..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Subscription.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** - * Webhook subscription resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class Subscription extends \Magento\Core\Model\Resource\Db\AbstractDb -{ - /** - * @var array - */ - private $_webHookList; - - /** - * @param \Magento\App\Resource $resource - * @param \Magento\Webhook\Model\Config $config - */ - public function __construct( - \Magento\App\Resource $resource, - \Magento\Webhook\Model\Config $config - ) { - $this->_webHookList = $config->getWebhooks(); - parent::__construct($resource); - } - - /** - * Pseudo-constructor for resource model initialization - */ - public function _construct() - { - $this->_init('webhook_subscription', 'subscription_id'); - } - - - /** - * Perform actions after subscription load - * - * @param \Magento\Core\Model\AbstractModel $subscription - * @return \Magento\Core\Model\Resource\Db\AbstractDb - */ - protected function _afterLoad(\Magento\Core\Model\AbstractModel $subscription) - { - $this->loadTopics($subscription); - return parent::_afterLoad($subscription); - } - - /** - * Perform actions after subscription save - * - * @param \Magento\Core\Model\AbstractModel $subscription - * @return \Magento\Core\Model\Resource\Db\AbstractDb - */ - protected function _afterSave(\Magento\Core\Model\AbstractModel $subscription) - { - $oldTopics = $this->_getTopics($subscription->getId()); - $this->_updateTopics($oldTopics, $subscription); - return parent::_afterSave($subscription); - } - - /** - * Gets list of topics for subscription - * - * @param int $subscriptionId - * @return string[] - */ - protected function _getTopics($subscriptionId) - { - $adapter = $this->_getReadAdapter(); - $select = $adapter->select() - ->from($this->getTable('webhook_subscription_hook'), 'topic') - ->where('subscription_id = ?', $subscriptionId); - return $adapter->fetchCol($select); - } - - /** - * Load topics of given subscription - * - * @param \Magento\Core\Model\AbstractModel $subscription - */ - public function loadTopics(\Magento\Core\Model\AbstractModel $subscription) - { - $subscription->setData('topics', $this->_getTopics($subscription->getId())); - } - /** - * Updates list of topics for subscription - * - * @param array $oldTopics - * @param \Magento\Core\Model\AbstractModel $subscription - * @return \Magento\Webhook\Model\Resource\Subscription - */ - protected function _updateTopics($oldTopics, \Magento\Core\Model\AbstractModel $subscription) - { - $newTopics = $subscription->getData('topics'); - $supportedTopics = $this->_getSupportedTopics(); - $subscriptionId = $subscription->getId(); - if (!empty($newTopics) && is_array($newTopics)) { - if (!empty($supportedTopics) && is_array($supportedTopics)) { - $newTopics = array_intersect($newTopics, $supportedTopics); - } - $intersection = array(); - if (!empty($oldTopics) && is_array($oldTopics)) { - $intersection = array_intersect($newTopics, $oldTopics); - $oldTopics = array_diff($oldTopics, $intersection); - } else { - $oldTopics = array(); - } - $newTopics = array_diff($newTopics, $intersection); - - $this->_performTopicUpdates($oldTopics, $newTopics, $subscriptionId); - } - return $this; - } - - /** - * Get list of webhook topics defined in webhook.xml - * - * @return string[] - */ - protected function _getSupportedTopics() - { - $availableHooks = array(); - foreach ($this->_webHookList as $key => $configData) { - foreach ($configData as $name => $hook) { - if (is_array($hook)) { - $availableHooks[] = $key . '/' . $name; - } - } - if (isset($configData['label'])) { - $availableHooks[] = $key; - } - } - return $availableHooks; - } - - /** - * Update topics for a specific subscription - * - * @param array $oldTopics - * @param array $newTopics - * @param string $subscriptionId - */ - protected function _performTopicUpdates($oldTopics, $newTopics, $subscriptionId) - { - $insertData = array(); - - foreach ($newTopics as $topic) { - $insertData[] = array( - 'subscription_id' => $subscriptionId, - 'topic' => $topic - ); - } - - if (count($oldTopics) > 0) { - $this->_getWriteAdapter()->delete( - $this->getTable('webhook_subscription_hook'), - array( - 'subscription_id = ?' => $subscriptionId, - 'topic in (?)' => $oldTopics - ) - ); - } - - if (count($insertData) > 0) { - $this->_getWriteAdapter()->insertMultiple( - $this->getTable('webhook_subscription_hook'), - $insertData - ); - } - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php b/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php deleted file mode 100644 index 77165d8b8e6a02690e3cd6bdd6738b36005a9eab..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Subscription/Collection.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * Subscription collection resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription; - -class Collection - extends \Magento\Core\Model\Resource\Db\Collection\AbstractCollection - implements \Magento\PubSub\Subscription\CollectionInterface -{ - /** - * @var \Magento\Webhook\Model\Resource\Endpoint - */ - protected $_endpointResource; - - /** - * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Logger $logger - * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Webhook\Model\Resource\Endpoint $endpointResource - * @param mixed $connection - * @param \Magento\Core\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\Webhook\Model\Resource\Endpoint $endpointResource, - $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null - ) { - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); - $this->_endpointResource = $endpointResource; - } - - /** - * Initialization here - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Subscription', 'Magento\Webhook\Model\Resource\Subscription'); - } - - - /** - * Return all subscriptions by topic - * - * @param string $topic - * @return \Magento\PubSub\SubscriptionInterface[] - */ - public function getSubscriptionsByTopic($topic) - { - return $this->clearFilters() - ->addTopicFilter($topic) - ->addIsActiveFilter(true) - ->clear() - ->getItems(); - } - - /** - * Returns all subscriptions that match a given alias - * - * @param string $alias - * @return \Magento\Webhook\Model\Subscription[] - */ - public function getSubscriptionsByAlias($alias) - { - return $this->clearFilters() - ->addAliasFilter($alias) - ->clear() - ->getItems(); - } - - /** - * Get subscriptions whose endpoint has no api user - * - * @return \Magento\Webhook\Model\Subscription[] - */ - public function getActivatedSubscriptionsWithoutApiUser() - { - $endpointIds = $this->_endpointResource->getEndpointsWithoutApiUser(); - - return $this->clearFilters() - ->addEndpointIdsFilter($endpointIds) - ->addNotInactiveFilter() - ->clear() - ->getItems(); - } - - /** - * Get api user subscriptions - * - * @param int|int[] $apiUserIds - * @return \Magento\Webhook\Model\Subscription[] - */ - public function getApiUserSubscriptions($apiUserIds) - { - $endpointIds = $this->_endpointResource->getApiUserEndpoints($apiUserIds); - - return $this->clearFilters() - ->addEndpointIdsFilter($endpointIds) - ->clear() - ->getItems(); - } - - /** - * Clear the select object - * - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function clearFilters() - { - $this->_select = $this->_conn->select(); - $this->_initSelect(); - return $this; - } - - /** - * Select subscriptions whose endpoint's id is in given array - * - * @param array $endpointIds - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function addEndpointIdsFilter($endpointIds) - { - $this->getSelect()->where('endpoint_id IN (?)', $endpointIds); - - return $this; - } - - /** - * Add filter by topic field to collection - * - * @param string $topic - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function addTopicFilter($topic) - { - $this->getSelect() - ->joinInner(array('hooks' => $this->getTable('webhook_subscription_hook')), - $this->getConnection() - ->quoteInto('hooks.subscription_id=main_table.subscription_id AND hooks.topic=?', $topic) - ); - return $this; - } - - /** - * Add filter by alias field to collection - * - * @param string|array $alias - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function addAliasFilter($alias) - { - $this->addFieldToFilter('alias', $alias); - return $this; - } - - /** - * Adds filter by status field to collection based on parameter - * - * @param bool $isActive - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function addIsActiveFilter($isActive) - { - if ($isActive) { - $this->addFieldToFilter('status', \Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE); - } else { - $this->addFieldToFilter('status', \Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE); - } - return $this; - } - - /** - * Filter out anything in the INACTIVE state - * - * @return \Magento\Webhook\Model\Resource\Subscription\Collection - */ - public function addNotInactiveFilter() - { - $this->getSelect()->where('status IN (?)', array( - \Magento\Webhook\Model\Subscription::STATUS_ACTIVE, - \Magento\Webhook\Model\Subscription::STATUS_REVOKED)); - - return $this; - } -} diff --git a/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php b/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php deleted file mode 100644 index 445f890b54d7c82ef0d26d938afdaa9502fd619a..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Resource/Subscription/Grid/Collection.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php -/** - * Subscription collection resource for subscription grid - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription\Grid; - -class Collection - extends \Magento\Webhook\Model\Resource\Subscription\Collection -{ - /** - * @param \Magento\Core\Model\EntityFactory $entityFactory - * @param \Magento\Logger $logger - * @param \Magento\Data\Collection\Db\FetchStrategyInterface $fetchStrategy - * @param \Magento\Event\ManagerInterface $eventManager - * @param \Magento\Webhook\Model\Resource\Endpoint $endpointResource - * @param \Magento\Webhook\Model\Subscription\Config $subscriptionConfig - * @param mixed $connection - * @param \Magento\Core\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\Webhook\Model\Resource\Endpoint $endpointResource, - \Magento\Webhook\Model\Subscription\Config $subscriptionConfig, - $connection = null, - \Magento\Core\Model\Resource\Db\AbstractDb $resource = null - ) { - parent::__construct( - $entityFactory, - $logger, - $fetchStrategy, - $eventManager, - $endpointResource, - $connection, - $resource - ); - $subscriptionConfig->updateSubscriptionCollection(); - } -} diff --git a/app/code/Magento/Webhook/Model/Source/Authentication.php b/app/code/Magento/Webhook/Model/Source/Authentication.php deleted file mode 100644 index 3f57f077da959828e3092778eefa874bb170a49d..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Source/Authentication.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -/** - * The list of available authentication types - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class Authentication implements \Magento\Core\Model\Option\ArrayInterface -{ - - /** @var array $_authenticationTypes */ - private $_authenticationTypes; - - - /** - * @param array $authenticationTypes - */ - public function __construct(array $authenticationTypes) - { - $this->_authenticationTypes = $authenticationTypes; - } - - /** - * Get available authentication types - * - * @return array - */ - public function toOptionArray() - { - return $this->_authenticationTypes; - - } - - /** - * Return authentications for use by a form - * - * @return array - */ - public function getAuthenticationsForForm() - { - $elements = array(); - foreach ($this->_authenticationTypes as $authName => $authentication) { - $elements[] = array( - 'label' => __($authentication), - 'value' => $authName, - ); - } - - return $elements; - } -} diff --git a/app/code/Magento/Webhook/Model/Source/Format.php b/app/code/Magento/Webhook/Model/Source/Format.php deleted file mode 100644 index bef1bf1a15572266dff3bff7c9a51de83874e3e6..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Source/Format.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * The list of available formats - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class Format implements \Magento\Core\Model\Option\ArrayInterface -{ - /** @var string[] $_formats */ - private $_formats; - - /** - * Cache of options - * - * @var null|array - */ - protected $_options = null; - - /** - * @param string[] $formats - */ - public function __construct(array $formats) - { - $this->_formats = $formats; - } - - /** - * Get available formats - * - * @return string[] - */ - public function toOptionArray() - { - return $this->_formats; - } - - /** - * Return non-empty formats for use by a form - * - * @return array - */ - public function getFormatsForForm() - { - $elements = array(); - foreach ($this->_formats as $formatName => $format) { - $elements[] = array( - 'label' => __($format), - 'value' => $formatName, - ); - } - - return $elements; - } -} diff --git a/app/code/Magento/Webhook/Model/Source/Hook.php b/app/code/Magento/Webhook/Model/Source/Hook.php deleted file mode 100644 index d450cfb56a9bc40eee1c6af3305dba407353abbb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Source/Hook.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/** - * The list of available hooks - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class Hook implements \Magento\Core\Model\Option\ArrayInterface -{ - /** - * Cache of options - * - * @var null|array - */ - protected $_options = null; - - /** - * @param \Magento\Webhook\Model\Config $config - */ - public function __construct(\Magento\Webhook\Model\Config $config ) - { - $this->_options = $config->getWebhooks(); - } - - /** - * Get available topics - * - * @return array - */ - public function toOptionArray() - { - return $this->_options; - } - - /** - * Scan config element to retrieve topics - * - * @return array - */ - public function getTopicsForForm() - { - $elements = array(); - - // process groups - $elements = $this->_getTopicsForForm($this->toOptionArray(), array(), $elements); - - return $elements; - } - - /** - * Recursive helper function to dynamically build topic information for our form. - * Seeks out nodes under 'webhook' stopping when it finds a leaf that contains 'label' - * The value is constructed using the XML tree parents. - * @param array $node - * @param array $path - * @param array $elements - * @return array - */ - protected function _getTopicsForForm($node, $path, $elements) - { - if (!empty($node['label'])) { - $value = join('/', $path); - - $label = __($node['label']); - - $elements[] = array( - 'label' => $label, - 'value' => $value, - ); - - return $elements; - } - - foreach ($node as $group => $child) { - $path[] = $group; - $elements = $this->_getTopicsForForm($child, $path, $elements); - array_pop($path); - } - - return $elements; - } -} diff --git a/app/code/Magento/Webhook/Model/Subscription.php b/app/code/Magento/Webhook/Model/Subscription.php deleted file mode 100644 index 577a752b8bd0a0370afd8b462700074340640cfd..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Subscription.php +++ /dev/null @@ -1,484 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webhook\Model; - -/** - * Represents a subscription to one or more topics - * - * @method string getName() - * @method \Magento\Webhook\Model\Subscription setName(string $value) - * @method \Magento\Webhook\Model\Subscription setEndpointId(string $value) - * @method string getEndpointId() - * @method string getUpdatedAt() - * @method \Magento\Webhook\Model\Subscription setUpdatedAt(string $value) - * @method \Magento\Webhook\Model\Subscription setStatus(int $value) - * @method string getAlias() - * @method \Magento\Webhook\Model\Subscription setAlias(string $value) - * @method \Magento\Webhook\Model\Subscription setTopics(array $value) - * @method \Magento\Webhook\Model\Subscription setRegistrationMechanism(string $value) - * @method string getRegistrationMechanism() - * @method bool hasRegistrationMechanism() - * @method bool hasStatus() - * @method int getSubscriptionId() - */ -class Subscription - extends \Magento\Core\Model\AbstractModel - implements \Magento\PubSub\SubscriptionInterface -{ - /** subscription fields */ - const FIELD_ENDPOINT_URL = 'endpoint_url'; - const FIELD_FORMAT = 'format'; - const FIELD_AUTHENTICATION_TYPE = 'authentication_type'; - const FIELD_API_USER_ID = 'api_user_id'; - const FIELD_TIMEOUT_IN_SECS = 'timeout_in_secs'; - - /** - * Registration mechanism - */ - const REGISTRATION_MECHANISM_MANUAL = 'manual'; - - /** - * @var \Magento\Webhook\Model\Endpoint - */ - private $_endpoint = null; - - /** - * @var \Magento\Stdlib\DateTime - */ - protected $_dateTime; - - /** - * Tracks whether or not we've already loaded endpoint data from the DB. - * - * @var bool - */ - private $_endpointLoaded = false; - - /** - * @param \Magento\Core\Model\Context $context - * @param \Magento\Core\Model\Registry $registry - * @param \Magento\Webhook\Model\Endpoint $endpoint - * @param \Magento\Stdlib\DateTime $dateTime - * @param \Magento\Core\Model\Resource\AbstractResource $resource - * @param \Magento\Data\Collection\Db $resourceCollection - * @param array $data - */ - public function __construct( - \Magento\Core\Model\Context $context, - \Magento\Core\Model\Registry $registry, - \Magento\Webhook\Model\Endpoint $endpoint, - \Magento\Stdlib\DateTime $dateTime, - \Magento\Core\Model\Resource\AbstractResource $resource = null, - \Magento\Data\Collection\Db $resourceCollection = null, - array $data = array() - ) { - /** set default status */ - if (!isset($data['status'])) { - $data['status'] = \Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE; - } - parent::__construct($context, $registry, $resource, $resourceCollection, $data); - $this->_dateTime = $dateTime; - $this->_endpoint = $endpoint; - } - - /** - * Initialize model - */ - public function _construct() - { - parent::_construct(); - $this->_init('Magento\Webhook\Model\Resource\Subscription'); - } - - /** - * Prepare data to be saved to database - * - * @return \Magento\Core\Model\AbstractModel - */ - protected function _beforeSave() - { - // TODO: Can this ever be set to anything else, is it being used? - if (!$this->hasRegistrationMechanism()) { - $this->setRegistrationMechanism(self::REGISTRATION_MECHANISM_MANUAL); - } - - if ($this->_endpoint->hasDataChanges()) { - $this->_endpoint->save(); - if ($this->getEndpointId() === null) { - $this->setEndpointId($this->_endpoint->getId()); - } - } - - if ($this->hasDataChanges()) { - $this->setUpdatedAt($this->_dateTime->formatDate(time())); - } - - return parent::_beforeSave(); - } - - /** - * Processing object after delete data - * - * We need to be sure that related objects like Endpoint are also deleted. - * - * @return \Magento\Core\Model\AbstractModel|void - */ - protected function _afterDelete() - { - $this->getEndpoint()->delete(); - - return parent::_afterDelete(); - } - - /** - * 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) - { - return in_array($topic, $this->getTopics()); - } - - - /** - * Mark this subscription status to activated - */ - public function activate() - { - $this->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE); - } - - /** - * Mark this subscription status as deactivated - */ - public function deactivate() - { - $this->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE); - } - - /** - * Mark this subscription status to revoked - */ - public function revoke() - { - $this->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_REVOKED); - } - - /** - * Checks that the subscription has access to all the resources/topics it has subscribed to. - * - * @return string[] array of all invalid topics - */ - public function findRestrictedTopics() - { - $restrictedTopics = array(); - $user = $this->getUser(); - if (null === $user) { - return $restrictedTopics; - } - foreach ($this->getTopics() as $topic) { - if (!$user->hasPermission($topic)) { - $restrictedTopics[] = $topic; - } - } - - return $restrictedTopics; - } - - /** - * Returns the endpoint to which messages will be sent - * - * @return \Magento\Webhook\Model\Endpoint - */ - public function getEndpoint() - { - if (!$this->_endpointLoaded && $this->getEndpointId() !== null) { - $this->_endpoint->load($this->getEndpointId()); - $this->_endpointLoaded = true; - } - return $this->_endpoint; - } - - /** - * Overwrite data in the object. - * - * If $key is string, the attribute value will be overwritten by $value - * - * If $key is an array, it will overwrite all the data in the object. - * - * @param string|array $key - * @param mixed $value - * @return \Magento\Webhook\Model\Subscription - */ - public function setData($key, $value = null) - { - parent::setData($key, $value); - - if (is_array($key)) { - $this->_setDataArray($key); - } else { - switch ($key) { - case self::FIELD_ENDPOINT_URL: - $this->setEndpointUrl($value); - break; - case self::FIELD_FORMAT: - $this->setFormat($value); - break; - case self::FIELD_AUTHENTICATION_TYPE: - $this->setAuthenticationType($value); - break; - case self::FIELD_API_USER_ID: - $this->setApiUserId($value); - break; - case self::FIELD_TIMEOUT_IN_SECS: - $this->setTimeoutInSecs($value); - break; - } - } - - return $this; - } - - /** - * Set the endpoint URL for this Subscription - * - * @param string $url - * @return \Magento\Webhook\Model\Subscription - */ - public function setEndpointUrl($url) - { - $this->getEndpoint()->setEndpointUrl($url); - $this->setDataChanges(true); - return $this; - } - - /** - * Set the endpoint timeout in seconds. - * - * @param int $timeout - * @return \Magento\Webhook\Model\Subscription - */ - public function setTimeoutInSecs($timeout) - { - $this->getEndpoint()->setTimeoutInSecs($timeout); - $this->setDataChanges(true); - return $this; - } - - /** - * Set the format in which data should be sent (json, xml) - * - * @param string $format - * @return \Magento\Webhook\Model\Subscription - */ - public function setFormat($format) - { - $this->getEndpoint()->setFormat($format); - $this->setDataChanges(true); - return $this; - } - - /** - * Set the api user id that this subscription is associated with - * - * @param string $userId - * @return \Magento\Webhook\Model\Subscription - */ - public function setApiUserId($userId) - { - $this->getEndpoint()->setApiUserId($userId); - $this->setDataChanges(true); - return $this; - } - - /** - * Set the authentication type for this subscription - * - * @param string $authType - * @return \Magento\Webhook\Model\Subscription - */ - public function setAuthenticationType($authType) - { - $this->getEndpoint()->setAuthenticationType($authType); - $this->setDataChanges(true); - return $this; - } - - /** - * 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() - { - return $this->getEndpoint()->getUser(); - } - - /** - * Returns the type of authentication to use when attaching authentication to a message - * - * @return string - */ - public function getAuthenticationType() - { - return $this->getEndpoint()->getAuthenticationType(); - } - - /** - * Returns the format this message should be sent in (JSON, XML, etc.) - * - * @return string - */ - public function getFormat() - { - return $this->getEndpoint()->getFormat(); - } - - /** - * Returns the api user id that this subscriptions endpoint is associated with. - * - * @return string - */ - public function getApiUserId() - { - return $this->getEndpoint()->getApiUserId(); - } - - /** - * Returns the endpoint URL of this subscription - * - * @return string - */ - public function getEndpointUrl() - { - return $this->getEndpoint()->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() - { - return $this->getEndpoint()->getTimeoutInSecs(); - } - - /** - * Returns a list of topics that this Subscription is subscribed to - * - * @return array string[] - */ - public function getTopics() - { - if (!isset($this->_data['topics'])) { - $this->_getResource()->loadTopics($this); - } - /** if subscription doesn't have topics, $this->_data['topics'] can still be null. - * Therefore it is better to call _getData() to avoid exception - */ - return $this->_getData('topics'); - } - - /** - * Get the status of this endpoint, which should match one of the constants in \Magento\PubSub\SubscriptionInterface - * - * @return int - */ - public function getStatus() - { - return $this->_getData('status'); - } - - /** - * Object data getter - * - * If $key is not defined, method will return all the data as an array. - * Otherwise it will return value of the element specified by $key. - * It is possible to use keys like a/b/c for access nested array data. - * - * If $index is specified it will treat data as an array and retrieve - * corresponding member. If data is a string - it will be exploded by - * new line character and converted to array. - * - * @param string $key - * @param string|int $index - * @return mixed - */ - public function getData($key = '', $index = null) - { - $data = parent::getData($key, $index); - - switch ($key) { - case self::FIELD_ENDPOINT_URL: - return $this->getEndpointUrl(); - case self::FIELD_FORMAT: - return $this->getFormat(); - case self::FIELD_AUTHENTICATION_TYPE: - return $this->getAuthenticationType(); - case self::FIELD_API_USER_ID: - return $this->getApiUserId(); - case self::FIELD_TIMEOUT_IN_SECS: - return $this->getTimeoutInSecs(); - case '': - $data[self::FIELD_ENDPOINT_URL] = $this->getEndpointUrl(); - $data[self::FIELD_FORMAT] = $this->getFormat(); - $data[self::FIELD_AUTHENTICATION_TYPE] = $this->getAuthenticationType(); - $data[self::FIELD_API_USER_ID] = $this->getApiUserId(); - $data[self::FIELD_TIMEOUT_IN_SECS] = $this->getTimeoutInSecs(); - return $data; - default: - return $data; - } - } - - /** - * Set data by calling setter functions - * - * @param array $data - */ - protected function _setDataArray(array $data) - { - if (isset($data[self::FIELD_ENDPOINT_URL])) { - $this->setEndpointUrl($data[self::FIELD_ENDPOINT_URL]); - } - if (isset($data[self::FIELD_FORMAT])) { - $this->setFormat($data[self::FIELD_FORMAT]); - } - if (isset($data[self::FIELD_AUTHENTICATION_TYPE])) { - $this->setAuthenticationType($data[self::FIELD_AUTHENTICATION_TYPE]); - } - if (isset($data[self::FIELD_API_USER_ID])) { - $this->setApiUserId($data[self::FIELD_API_USER_ID]); - } - if (isset($data[self::FIELD_TIMEOUT_IN_SECS])) { - $this->setTimeoutInSecs($data[self::FIELD_TIMEOUT_IN_SECS]); - } - } -} diff --git a/app/code/Magento/Webhook/Model/Subscription/Config.php b/app/code/Magento/Webhook/Model/Subscription/Config.php deleted file mode 100644 index 638168d7eb1ae2c2ae20417391f03296c27a5221..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Subscription/Config.php +++ /dev/null @@ -1,183 +0,0 @@ -<?php -/** - * Configures subscriptions based on information from config object - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription; - -class Config -{ - /** - * @var \Magento\Webhook\Model\Resource\Subscription\Collection - */ - protected $_subscriptionSet; - - /** - * @var \Magento\Webhook\Model\Config - */ - protected $_config; - - /** - * @var Factory - */ - protected $_subscriptionFactory; - - /** @var \Magento\Logger */ - private $_logger; - - /** - * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - * @param \Magento\Webhook\Model\Config $config - * @param \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory - * @param \Magento\Logger $logger - */ - public function __construct( - \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet, - \Magento\Webhook\Model\Config $config, - \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory, - \Magento\Logger $logger - ) { - $this->_subscriptionSet = $subscriptionSet; - $this->_config = $config; - $this->_subscriptionFactory = $subscriptionFactory; - $this->_logger = $logger; - } - - /** - * Checks if new subscriptions need to be generated from config files - * - * @return \Magento\Webhook\Model\Subscription\Config - */ - public function updateSubscriptionCollection() - { - foreach ($this->_config->getSubscriptions() as $alias => $subscriptionData) { - try { - $this->_validateConfigData($subscriptionData, $alias); - $subscriptions = $this->_subscriptionSet->getSubscriptionsByAlias($alias); - if (empty($subscriptions)) { - // add new subscription - $subscription = $this->_subscriptionFactory->create() - ->setAlias($alias) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE); - } else { - // get first subscription from array - $subscription = current($subscriptions); - } - - // update subscription from config - $this->_updateSubscriptionFromConfigData($subscription, $subscriptionData); - } catch (\LogicException $e){ - $this->_logger->logException(new \Magento\Webhook\Exception($e->getMessage())); - } - } - return $this; - } - - /** - * Validates config data by checking that $data is an array and that 'data' maps to some value - * - * @param mixed $data - * @param string $alias - * @throws \LogicException - */ - protected function _validateConfigData($data, $alias) - { - // We can't demand that every possible value be supplied as some of these can be supplied - // at a later point in time using the web API - if (!( is_array($data) && isset($data['name']))) { - throw new \LogicException(__( - "Invalid config data for subscription '%1'.", $alias - )); - } - } - - /** - * Configures a subscription - * - * @param \Magento\Webhook\Model\Subscription $subscription - * @param array $rawConfigData - * @return \Magento\Core\Model\AbstractModel - */ - protected function _updateSubscriptionFromConfigData( - \Magento\Webhook\Model\Subscription $subscription, - array $rawConfigData - ) { - // Set defaults for unset values - $configData = $this->_processConfigData($rawConfigData); - - $subscription->setName($configData['name']) - ->setFormat($configData['format']) - ->setEndpointUrl($configData['endpoint_url']) - ->setTopics($configData['topics']) - ->setAuthenticationType($configData['authentication_type']) - ->setRegistrationMechanism($configData['registration_mechanism']); - - return $subscription->save(); - } - - /** - * Sets defaults for unset values - * - * @param array $configData - * @return array - */ - private function _processConfigData($configData) - { - $defaultData = array( - 'name' => null, - 'format' => \Magento\Outbound\EndpointInterface::FORMAT_JSON, - 'endpoint_url' => null, - 'topics' => array(), - 'authentication_type' => \Magento\Outbound\EndpointInterface::AUTH_TYPE_NONE, - 'registration_mechanism' => \Magento\Webhook\Model\Subscription::REGISTRATION_MECHANISM_MANUAL, - ); - - if (isset($configData['topics'])) { - $configData['topics'] = $this->_getTopicsFlatList($configData['topics']); - } - - return array_merge($defaultData, $configData); - } - - /** - * Convert topics into acceptable form for subscription - * - * @param array $topics - * @return array - */ - protected function _getTopicsFlatList(array $topics) - { - $flatList = array(); - - foreach ($topics as $topicGroup => $topicNames) { - $topicNamesKeys = array_keys($topicNames); - foreach ($topicNamesKeys as $topicName) { - $flatList[] = $topicGroup . '/' . $topicName; - } - } - - return $flatList; - } -} diff --git a/app/code/Magento/Webhook/Model/Subscription/Options/Status.php b/app/code/Magento/Webhook/Model/Subscription/Options/Status.php deleted file mode 100644 index 92bba2a655493cbe82c2e0e43eb0da0c5a9c77cb..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Subscription/Options/Status.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * Webhook subscription Options Status - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription\Options; - -class Status implements \Magento\Core\Model\Option\ArrayInterface -{ - - /** - * @var \Magento\Core\Model\Translate - */ - protected $_translator; - - /** - * @param \Magento\Core\Model\Translate $translator - */ - public function __construct(\Magento\Core\Model\Translate $translator) - { - $this->_translator = $translator; - } - - /** - * Return statuses array - * - * @return array - */ - public function toOptionArray() - { - return array( - \Magento\Webhook\Model\Subscription::STATUS_ACTIVE => __('Active'), - \Magento\Webhook\Model\Subscription::STATUS_REVOKED => __('Revoked'), - \Magento\Webhook\Model\Subscription::STATUS_INACTIVE => __('Inactive'), - ); - } -} diff --git a/app/code/Magento/Webhook/Model/User.php b/app/code/Magento/Webhook/Model/User.php deleted file mode 100644 index 1cb0c47ee9404f671125615c5bd544fb6cb8d32e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/User.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * Representation of \Magento\PubSub\SubscriptionInterface with data from Magento database - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class User implements \Magento\Outbound\UserInterface -{ - /** @var \Magento\Webapi\Model\Acl\User */ - private $_user; - - /** - * Used to check that this user has proper permissions - * - * @var \Magento\Authorization - */ - private $_authorization; - - /** - * @param \Magento\Webapi\Model\Acl\User\Factory $userFactory - * @param \Magento\Webapi\Model\Authorization\Role\Locator\Factory $roleLocatorFactory - * @param \Magento\Webapi\Model\Authorization\Policy\Acl $aclPolicy - * @param \Magento\Authorization\Factory $authorizationFactory - * @param string $webapiUserId - */ - public function __construct( - \Magento\Webapi\Model\Acl\User\Factory $userFactory, - \Magento\Webapi\Model\Authorization\Role\Locator\Factory $roleLocatorFactory, - \Magento\Webapi\Model\Authorization\Policy\Acl $aclPolicy, - \Magento\Authorization\Factory $authorizationFactory, - $webapiUserId - ) { - $this->_user = $userFactory->create(); - $this->_user->load($webapiUserId); - $roleLocator = $roleLocatorFactory->create(array( - 'data' => array('roleId' => $this->_user->getRoleId()) - )); - - $this->_authorization = $authorizationFactory->create(array( - 'aclPolicy' => $aclPolicy, - 'roleLocator' => $roleLocator - )); - } - - /** - * 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() - { - return $this->_user->getSecret(); - } - - /** - * 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) - { - return $this->_authorization->isAllowed($topic); - } -} diff --git a/app/code/Magento/Webhook/Model/User/Factory.php b/app/code/Magento/Webhook/Model/User/Factory.php deleted file mode 100644 index 7754604e984261a07eeddd27db58174e39ec40e0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/User/Factory.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Creates new instances of \Magento\Outbound\UserInterface (via \Magento\Webhook\Model\User) - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\User; - -class Factory -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create a new instance of \Magento\Webhook\Model\User - * - * @param int $webapiUserId webapi user id - * @return \Magento\Webhook\Model\User - */ - public function create($webapiUserId) - { - return $this->_objectManager->create('Magento\Webhook\Model\User', array('webapiUserId' => $webapiUserId)); - } -} diff --git a/app/code/Magento/Webhook/Model/Webapi/EventHandler.php b/app/code/Magento/Webhook/Model/Webapi/EventHandler.php deleted file mode 100644 index e8039f0ff594433b57ca20a7d42b16e3513f6221..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Webapi/EventHandler.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * Webapi EventHandler that should be notified if any relevant webapi events are received. - * - * The event handler will decide what actions must be taken based on the 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi; - -class EventHandler -{ - /** @var \Magento\Webapi\Model\Resource\Acl\User */ - private $_resourceAclUser; - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection */ - private $_subscriptionSet; - - /** - * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - * @param \Magento\Webapi\Model\Resource\Acl\User $resourceAclUser - */ - public function __construct( - \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet, - \Magento\Webapi\Model\Resource\Acl\User $resourceAclUser - ) { - $this->_subscriptionSet = $subscriptionSet; - $this->_resourceAclUser = $resourceAclUser; - } - - /** - * Notifies the event handler that a webapi user has changed - * - * @param \Magento\Webapi\Model\Acl\User $user User object that changed - */ - public function userChanged($user) - { - // call helper that finds and notifies subscription (user_id) - $this->_validateSubscriptionsForUsers(array($user->getId())); - } - - /** - * Notifies the event handler that a webapi role has changed - * - * @param \Magento\Webapi\Model\Acl\Role $role Role object that changed - */ - public function roleChanged($role) - { - // get all users that contain this role (role_id) - $users = $this->_resourceAclUser->getRoleUsers($role->getId()); - - // for each user, call helper that finds and notifies subscription (user_id) - $this->_validateSubscriptionsForUsers($users); - } - - /** - * Finds all Subscriptions for the given users, and validates that these subscriptions are still valid. - * - * @param array $userIds users to check against - */ - protected function _validateSubscriptionsForUsers(array $userIds) - { - $subscriptions = $this->_subscriptionSet->getApiUserSubscriptions($userIds); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - foreach ($subscriptions as $subscription) { - if ($subscription->findRestrictedTopics()) { - $subscription->deactivate(); - $subscription->save(); - } - } - } -} diff --git a/app/code/Magento/Webhook/Model/Webapi/EventHandler/Factory.php b/app/code/Magento/Webhook/Model/Webapi/EventHandler/Factory.php deleted file mode 100644 index 6411effef8f9c798612efe9aa0f0218fdb49320c..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Webapi/EventHandler/Factory.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Factory for \Magento\Webhook\Model\Webapi\EventHandler 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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\EventHandler; - -class Factory -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * Initialize the class - * - * @param \Magento\ObjectManager $objectManager - */ - public function __construct(\Magento\ObjectManager $objectManager) - { - $this->_objectManager = $objectManager; - } - - /** - * Create a new instance of \Magento\Webhook\Model\Webapi\EventHandler - * - * @param array $arguments Fed into constructor - * @return \Magento\Webhook\Model\Webapi\EventHandler - */ - public function create(array $arguments = array()) - { - return $this->_objectManager->create('Magento\Webhook\Model\Webapi\EventHandler', $arguments); - } -} diff --git a/app/code/Magento/Webhook/Model/Webapi/User/Factory.php b/app/code/Magento/Webhook/Model/Webapi/User/Factory.php deleted file mode 100644 index 6283aa9f5a546f6cab0ab8dd94da9ff92ec7aa19..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Model/Webapi/User/Factory.php +++ /dev/null @@ -1,226 +0,0 @@ -<?php -/** - * Creates user with proper permissions for subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\User; - -class Factory -{ - /** Keys used in user context array */ - const CONTEXT_EMAIL = 'email'; - const CONTEXT_COMPANY = 'company'; - const CONTEXT_KEY = 'key'; - const CONTEXT_SECRET = 'secret'; - - /** name delimiter */ - const NAME_DELIM = ' - '; - - /** @var \Magento\Webapi\Model\Acl\Rule\Factory */ - private $_ruleFactory; - - /** @var \Magento\Webapi\Model\Acl\User\Factory */ - private $_userFactory; - - /** @var \Magento\Webapi\Model\Acl\Role\Factory */ - private $_roleFactory; - - /** @var array virtual resource to resource mapping */ - private $_topicMapping = array(); - - /** @var \Magento\Acl\CacheInterface */ - protected $_cache; - - /** - * @var \Magento\Math\Random - */ - protected $_mathRandom; - - /** - * @param \Magento\Webapi\Model\Acl\Rule\Factory $ruleFactory - * @param \Magento\Webapi\Model\Acl\User\Factory $userFactory - * @param \Magento\Webapi\Model\Acl\Role\Factory $roleFactory - * @param \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider - * @param \Magento\Webapi\Model\Acl\Cache $cache - * @param \Magento\Math\Random $mathRandom - */ - public function __construct( - \Magento\Webapi\Model\Acl\Rule\Factory $ruleFactory, - \Magento\Webapi\Model\Acl\User\Factory $userFactory, - \Magento\Webapi\Model\Acl\Role\Factory $roleFactory, - \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider, - \Magento\Webapi\Model\Acl\Cache $cache, - \Magento\Math\Random $mathRandom - ) { - $this->_ruleFactory = $ruleFactory; - $this->_userFactory = $userFactory; - $this->_roleFactory = $roleFactory; - $this->_cache = $cache; - $this->_mathRandom = $mathRandom; - $this->_initVirtualResourceMapping($resourceProvider); - } - - /** - * Creates a new user and role for the subscription associated with this Webapi. - * - * @param array $userContext Information needed to create a user: email, company, secret, key - * @param array $topics Resources the user should have access to - * @return int Webapi user id - * @throws \Exception If a new user can't be created (because of DB issues for instance) - */ - public function createUser(array $userContext, array $topics) - { - // Company is an optional variable - $userContext[self::CONTEXT_COMPANY] = isset($userContext[self::CONTEXT_COMPANY]) - ? $userContext[self::CONTEXT_COMPANY] - : null; - - $role = $this->_createWebapiRole($userContext[self::CONTEXT_EMAIL], $userContext[self::CONTEXT_COMPANY]); - - try { - $this->_createWebapiRule($topics, $role->getId()); - $user = $this->_createWebapiUser($userContext, $role); - } catch (\Exception $e) { - $role->delete(); - throw $e; - } - - return $user->getId(); - } - - /** - * Creates a new \Magento\Webapi\Model\Acl\Role role with a unique name - * - * @param string $email - * @param string $company - * @return \Magento\Webapi\Model\Acl\Role - */ - protected function _createWebapiRole($email, $company) - { - $roleName = $this->_createRoleName($email, $company); - $role = $this->_roleFactory->create()->load($roleName, 'role_name'); - - // Check if a role with this name already exists, we need a new role with a unique name - if ($role->getId()) { - $uniqString = $this->_mathRandom->getUniqueHash(); - $roleName = $this->_createRoleName($email, $company, $uniqString); - } - - $role = $this->_roleFactory->create() - ->setRoleName($roleName) - ->save(); - - return $role; - } - - /** - * Creates a rule and associates it with a role - * - * @param array $topics - * @param int $roleId - * @return null - */ - public function _createWebapiRule(array $topics, $roleId) - { - $resources = array(); - foreach ($topics as $topic) { - $resources[] = isset($this->_topicMapping[$topic]) ? $this->_topicMapping[$topic] : $topic; - } - array_unique($resources); - - $resources = array_merge($resources, array( - 'webhook/create', - 'webhook/get', - 'webhook/update', - 'webhook/delete', - )); - - $this->_ruleFactory->create() - ->setRoleId($roleId) - ->setResources($resources) - ->saveResources(); - - /* Updating the ACL cache so that new role appears there */ - $this->_cache->clean(); - } - - /** - * Creates a webapi User in the DB - * - * @param array $userContext - * @param \Magento\Webapi\Model\Acl\Role $role - * @return \Magento\Core\Model\AbstractModel - */ - protected function _createWebapiUser(array $userContext, $role) - { - $user = $this->_userFactory->create() - ->setRoleId($role->getId()) - ->setApiKey($userContext[self::CONTEXT_KEY]) - ->setSecret($userContext[self::CONTEXT_SECRET]) - ->setCompanyName($userContext[self::CONTEXT_COMPANY]) - ->setContactEmail($userContext[self::CONTEXT_EMAIL]) - ->save(); - return $user; - } - - /** - * Create unique role name - * - * @param string $email - * @param string $prefix - * @param string $suffix - * @return string - */ - protected function _createRoleName($email, $prefix = null, $suffix = null) - { - $result = ''; - if ($prefix) { - $result = $prefix . self::NAME_DELIM; - } - - $result .= $email; - - if ($suffix) { - $result .= self::NAME_DELIM . $suffix; - } - return $result; - } - - /** - * Initialize our virtual resource to merchant visible resource mapping array. - * - * @param \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider - */ - protected function _initVirtualResourceMapping( - \Magento\Webapi\Model\Acl\Resource\Provider $resourceProvider - ) { - $virtualResources = $resourceProvider->getAclVirtualResources(); - foreach ($virtualResources as $resource) { - $virtualResource = $resource['id']; - $parentResource = $resource['parent']; - $this->_topicMapping[$virtualResource] = $parentResource; - } - } -} diff --git a/app/code/Magento/Webhook/Service/SubscriptionV1.php b/app/code/Magento/Webhook/Service/SubscriptionV1.php deleted file mode 100644 index ed4e82d273430d7a058d7696ede27bcb4d214e65..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Service/SubscriptionV1.php +++ /dev/null @@ -1,329 +0,0 @@ -<?php -/** - * Webhook Subscription Service. - * - * This service is used to interact with webhooks 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Service; - -class SubscriptionV1 implements \Magento\Webhook\Service\SubscriptionV1Interface -{ - /** @var \Magento\Webhook\Model\Subscription\Factory $_subscriptionFactory */ - private $_subscriptionFactory; - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection $_subscriptionSet */ - private $_subscriptionSet; - - /** - * @param \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory - * @param \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - */ - public function __construct( - \Magento\Webhook\Model\Subscription\Factory $subscriptionFactory, - \Magento\Webhook\Model\Resource\Subscription\Collection $subscriptionSet - ) { - $this->_subscriptionFactory = $subscriptionFactory; - $this->_subscriptionSet = $subscriptionSet; - } - - /** - * Create a new Subscription - * - * @param array $subscriptionData - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function create(array $subscriptionData) - { - try { - $subscription = $this->_subscriptionFactory->create($subscriptionData); - - $this->_validateTopics($subscription); - - $subscription->save(); - - return $subscription->getData(); - } catch (\Magento\Core\Exception $exception) { - // These messages are already translated, we can simply surface them. - throw $exception; - } catch (\Exception $exception) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Get all Subscriptions associated with a given api user. - * - * @param int $apiUserId - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - * @return array of Subscription data arrays - */ - public function getAll($apiUserId) - { - try { - $result = array(); - $subscriptions = $this->_subscriptionSet->getApiUserSubscriptions($apiUserId); - - /** @var \Magento\Webhook\Model\Subscription $subscription*/ - foreach ($subscriptions as $subscription) { - $result[] = $subscription->getData(); - } - - return $result; - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Update a Subscription. - * - * @param array $subscriptionData - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function update(array $subscriptionData) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionData['subscription_id']); - $subscription->addData($subscriptionData); - - $this->_validateTopics($subscription); - - $subscription->save(); - - return $subscription->getData(); - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Get the details of a specific Subscription. - * - * @param int $subscriptionId - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function get($subscriptionId) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionId); - return $subscription->getData(); - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Delete a Subscription. - * - * @param int $subscriptionId - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function delete($subscriptionId) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionId); - $subscriptionData = $subscription->getData(); - - $subscription->delete(); - - return $subscriptionData; - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Activate a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function activate($subscriptionId) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionId); - - $subscription->activate(); - $subscription->save(); - return $subscription->getData(); - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * De-activate a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function deactivate($subscriptionId) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionId); - - $subscription->deactivate(); - $subscription->save(); - return $subscription->getData(); - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Revoke a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function revoke($subscriptionId) - { - try { - $subscription = $this->_loadSubscriptionById($subscriptionId); - - $subscription->revoke(); - $subscription->save(); - return $subscription->getData(); - } catch (\Magento\Core\Exception $e) { - // These messages are already translated, we can simply surface them. - throw $e; - } catch (\Exception $e) { - // These messages have no translation, we should not expose our internals but may consider logging them. - throw new \Magento\Webhook\Exception( - __('Unexpected error. Please contact the administrator.') - ); - } - } - - /** - * Returns trues if a given userId is associated with a subscription - * - * @param int $apiUserId - * @param int $subscriptionId - * @throws \Magento\Webhook\Exception - */ - public function validateOwnership($apiUserId, $subscriptionId) - { - $subscription = $this->_loadSubscriptionById($subscriptionId); - if ($subscription->getApiUserId() != $apiUserId) { - throw new \Magento\Webhook\Exception( - __("User with id %1 doesn't have permission to modify subscription %2", $apiUserId, $subscriptionId) - ); - } - } - - /** - * Validates all the topics for a Subscription are Authorized. - * - * If invalid topics exists, an exception will be thrown. - * - * @param \Magento\Webhook\Model\Subscription $subscription - * @throws \Magento\Webhook\Exception - */ - private function _validateTopics(\Magento\Webhook\Model\Subscription $subscription) - { - $invalidTopics = $subscription->findRestrictedTopics(); - if (!empty($invalidTopics)) { - $listOfTopics = implode(', ', $invalidTopics); - throw new \Magento\Webhook\Exception( - __('The following topics are not authorized: %1', $listOfTopics) - ); - } - } - - /** - * Load subscription by id. - * - * @param int $subscriptionId - * @throws \Magento\Webhook\Exception - * @return \Magento\Webhook\Model\Subscription - */ - protected function _loadSubscriptionById($subscriptionId) - { - $subscription = $this->_subscriptionFactory->create()->load($subscriptionId); - if (!$subscription->getId()) { - throw new \Magento\Webhook\Exception( - __("Subscription with ID '%1' doesn't exist.", $subscriptionId) - ); - } - return $subscription; - } - -} diff --git a/app/code/Magento/Webhook/Service/SubscriptionV1Interface.php b/app/code/Magento/Webhook/Service/SubscriptionV1Interface.php deleted file mode 100644 index 7c8596032832c4f6bf4e0c7189651ee31a5b1768..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/Service/SubscriptionV1Interface.php +++ /dev/null @@ -1,115 +0,0 @@ -<?php -/** - * Webhook Subscription Service - Version 1. - * - * This service is used to interact with webhooks 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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Service; - -interface SubscriptionV1Interface -{ - - /** - * Create a new Subscription - * - * @param array $subscriptionData - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function create(array $subscriptionData); - - /** - * Get all Subscriptions associated with a given api user. - * - * @param int $apiUserId - * @return array of Subscription data arrays - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function getAll($apiUserId); - - /** - * Update a Subscription. - * - * @param array $subscriptionData - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function update(array $subscriptionData); - - /** - * Get the details of a specific Subscription. - * - * @param int $subscriptionId - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function get($subscriptionId); - - /** - * Delete a Subscription. - * - * @param int $subscriptionId - * @return array Subscription data - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function delete($subscriptionId); - - /** - * Activate a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function activate($subscriptionId); - - /** - * De-activate a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function deactivate($subscriptionId); - - /** - * Revoke a subscription. - * - * @param int $subscriptionId - * @return array - * @throws \Exception|\Magento\Core\Exception - * @throws \Magento\Webhook\Exception - */ - public function revoke($subscriptionId); - -} diff --git a/app/code/Magento/Webhook/etc/adminhtml/acl.xml b/app/code/Magento/Webhook/etc/adminhtml/acl.xml deleted file mode 100644 index 8d598d5c6b505fd9b95b700b9fe1f53271deba00..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/adminhtml/acl.xml +++ /dev/null @@ -1,40 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <acl> - <resources> - <resource id="Magento_Adminhtml::admin"> - <resource id="Magento_Adminhtml::system"> - <resource id="Magento_Webapi::webapi"> - <resource id="Magento_Webhook::webhook" title="WebHook Subscriptions" sortOrder="15" /> - </resource> - </resource> - </resource> - </resources> - </acl> -</config> diff --git a/app/code/Magento/Webhook/etc/adminhtml/menu.xml b/app/code/Magento/Webhook/etc/adminhtml/menu.xml deleted file mode 100644 index 996ecfc759d112c7e6d0e5195741a4519f7dbb15..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/adminhtml/menu.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <menu> - <add id="Magento_Webhook::system_api_webapi_webhook" title="WebHook Subscriptions" module="Magento_Webhook" sortOrder="15" - parent="Magento_Webapi::system_webapi" action="adminhtml/webhook_subscription/index" resource="Magento_Webhook::webhook"/> - </menu> -</config> diff --git a/app/code/Magento/Webhook/etc/adminhtml/routes.xml b/app/code/Magento/Webhook/etc/adminhtml/routes.xml deleted file mode 100644 index 504fa4f315b3b0d9db5ec9acb892142b7aa664ea..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/adminhtml/routes.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <router id="admin"> - <route id="adminhtml"> - <module name="Magento_Webhook_Adminhtml" before="Magento_Adminhtml" /> - </route> - </router> -</config> \ No newline at end of file diff --git a/app/code/Magento/Webhook/etc/crontab.xml b/app/code/Magento/Webhook/etc/crontab.xml deleted file mode 100644 index 89e4e08a139335bbbbb7622b6038694ff916dbb9..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/crontab.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <job name="webhook_process_messages" instance="Magento\PubSub\Event\QueueHandler" method="handle"> - <schedule>* * * * *</schedule> - </job> - <job name="webhook_process_dispatchers" instance="Magento\PubSub\Job\QueueHandler" method="handle"> - <schedule>* * * * *</schedule> - </job> - <job name="webhook_events_revoke_idling" instance="Magento\Webhook\Model\Resource\Event\Collection" method="revokeIdlingInProgress"> - <schedule>*/15 * * * *</schedule> - </job> - <job name="webhook_jobs_revoke_idling" instance="Magento\Webhook\Model\Resource\Job\Collection" method="revokeIdlingInProgress"> - <schedule>*/15 * * * *</schedule> - </job> -</config> diff --git a/app/code/Magento/Webhook/etc/di.xml b/app/code/Magento/Webhook/etc/di.xml deleted file mode 100644 index 51dafbf59c88424462823521f019d44b1eff2b31..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/di.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <type name="Magento\Outbound\Formatter\Factory"> - <param name="formatterMap"> - <value> - <json>Magento\Outbound\Formatter\Json</json> - </value> - </param> - </type> - <type name="Magento\Webhook\Model\Source\Format"> - <param name="formats"> - <value> - <json>JSON</json> - </value> - </param> - </type> - <type name="Magento\Outbound\Authentication\Factory"> - <param name="authenticationMap"> - <value> - <hmac>Magento\Outbound\Authentication\Hmac</hmac> - </value> - </param> - </type> - <type name="Magento\Webhook\Model\Source\Authentication"> - <param name="authenticationTypes"> - <value> - <hmac>HMAC SHA256</hmac> - </value> - </param> - </type> - <type name="Magento\Webhook\Model\Endpoint" shared="false" /> - <preference for="Magento\PubSub\Event\QueueReaderInterface" type="Magento\Webhook\Model\Event\QueueReader" /> - <preference for="Magento\PubSub\Event\QueueWriterInterface" type="Magento\Webhook\Model\Event\QueueWriter" /> - <preference for="Magento\PubSub\Event\FactoryInterface" type="Magento\Webhook\Model\Event\Factory" /> - <preference for="Magento\PubSub\Job\FactoryInterface" type="Magento\Webhook\Model\Job\Factory" /> - <preference for="Magento\PubSub\Subscription\CollectionInterface" type="Magento\Webhook\Model\Resource\Subscription\Collection" /> - <preference for="Magento\Outbound\Message\FactoryInterface" type="Magento\Outbound\Message\Factory" /> - <preference for="Magento\PubSub\Job\QueueReaderInterface" type="Magento\Webhook\Model\Job\QueueReader" /> - <preference for="Magento\PubSub\Job\QueueWriterInterface" type="Magento\Webhook\Model\Job\QueueWriter" /> - <preference for="Magento\Outbound\TransportInterface" type="Magento\Outbound\Transport\Http" /> - <preference for="Magento\Outbound\MessageInterface" type="Magento\Outbound\Message" /> - <preference for="Magento\PubSub\Message\DispatcherAsyncInterface" type="Magento\PubSub\Message\DispatcherAsync" /> - <preference for="Magento\Webhook\Service\SubscriptionV1Interface" type="Magento\Webhook\Service\SubscriptionV1" /> -</config> diff --git a/app/code/Magento/Webhook/etc/events.xml b/app/code/Magento/Webhook/etc/events.xml deleted file mode 100644 index 94bf8bbb980880a92065d51a6f13ad250101fb79..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/events.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <event name="webapi_user_delete_after"> - <observer name="webhook_subscription_status_update" instance="Magento\Webhook\Model\Observer" method="afterWebapiUserDelete" /> - </event> - <event name="webapi_user_save_commit_after"> - <observer name="webhook_subscription_status_update" instance="Magento\Webhook\Model\Observer" method="afterWebapiUserChange" /> - </event> - <event name="webapi_role_save_commit_after"> - <observer name="webhook_subscription_status_update" instance="Magento\Webhook\Model\Observer" method="afterWebapiRoleChange" /> - </event> - <event name="webapi_role_delete_commit_after"> - <observer name="webhook_subscription_status_update" instance="Magento\Webhook\Model\Observer" method="afterWebapiRoleChange" /> - </event> -</config> diff --git a/app/code/Magento/Webhook/etc/frontend/routes.xml b/app/code/Magento/Webhook/etc/frontend/routes.xml deleted file mode 100644 index a6ea3884f04703c4e93f22113e024d99c909dae0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/frontend/routes.xml +++ /dev/null @@ -1,32 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <router id="standard"> - <route id="webhook" frontName="webhook"> - <module name="Magento_Webhook" /> - </route> - </router> -</config> \ No newline at end of file diff --git a/app/code/Magento/Webhook/etc/module.xml b/app/code/Magento/Webhook/etc/module.xml deleted file mode 100755 index b18c83866ff358e748ce068080a7af5056ae0aa7..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/module.xml +++ /dev/null @@ -1,39 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <module name="Magento_Webhook" version="1.0.0.0" active="true"> - <sequence> - <module name="Magento_Core"/> - <module name="Magento_Webapi"/> - </sequence> - <depends> - <module name="Magento_Core"/> - <module name="Magento_Webapi"/> - <module name="Magento_Backend"/> - <module name="Magento_Theme"/> - </depends> - </module> -</config> diff --git a/app/code/Magento/Webhook/etc/webapi.xml b/app/code/Magento/Webhook/etc/webapi.xml deleted file mode 100644 index 91337f8f30d88bb90ef1715d2916a4cea4f9c48b..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/webapi.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <service class="Magento\Webhook\Service\SubscriptionV1Interface" baseUrl="/V1/subscriptions"> - <rest-route httpMethod="GET" method="getAll" isSecure="true"/> - <rest-route httpMethod="POST" method="create" isSecure="true"/> - <rest-route httpMethod="PUT" method="update" isSecure="true">/:subscriptionId</rest-route> - <rest-route httpMethod="GET" method="get" isSecure="true">/:subscriptionId</rest-route> - <rest-route httpMethod="DELETE" method="delete" isSecure="true">/:subscriptionId</rest-route> - </service> -</config> diff --git a/app/code/Magento/Webhook/etc/webapi/acl.xml b/app/code/Magento/Webhook/etc/webapi/acl.xml deleted file mode 100644 index 985a39ed7a9d5aee46f1d8b434ca20030179cc78..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/etc/webapi/acl.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_User - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <acl> - <resources> - <resource id="Magento_Webapi"> - <resource id="webhook" title="Manage WebHooks"> - <resource id="webhook/create" title="Create" sortOrder="10" /> - <resource id="webhook/get" title="Retrieve" sortOrder="20" /> - <resource id="webhook/update" title="Update" sortOrder="30" /> - <resource id="webhook/delete" title="Delete" sortOrder="40" /> - </resource> - </resource> - </resources> - </acl> - <mapping> - <resource id="webhook/list" parent="webhook/get" /> - </mapping> -</config> diff --git a/app/code/Magento/Webhook/schema/service/SubscriptionV1.xsd b/app/code/Magento/Webhook/schema/service/SubscriptionV1.xsd deleted file mode 100644 index ab46c8a7b4962c6451757a86196b25636d9cac18..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/schema/service/SubscriptionV1.xsd +++ /dev/null @@ -1,190 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Webhooks subscription service description. - * - * Includes request and response data descriptions for all service methods. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema"> - - <xsd:element name="createRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="createResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="getAllRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="apiUserId" type="xsd:int"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="getAllResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData" minOccurs="0" maxOccurs="unbounded"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="updateRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="updateResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="getRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionId" type="xsd:int"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="getResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="deleteRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionId" type="xsd:int"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="deleteResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="deactivateRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionId" type="xsd:int"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="deactivateResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:element name="revokeRequest"> - <xsd:complexType> - <xs:sequence> - <xsd:element name="subscriptionId" type="xsd:int"/> - </xs:sequence> - </xsd:complexType> - </xsd:element> - - <xsd:complexType name="revokeResponse"> - <xs:sequence> - <xsd:element name="subscriptionData" type="subscriptionData"/> - </xs:sequence> - </xsd:complexType> - - <xsd:complexType name="subscriptionData"> - <xsd:sequence> - <xsd:element name="subscription_id" type="xsd:int" minOccurs="0"> - <xsd:annotation> - <xsd:documentation>Subscription ID</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="alias" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Alias</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="name" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Name</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="topics" type="topicList"> - <xsd:annotation> - <xsd:documentation>Subscription subscribed topics</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="status" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Status</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="endpoint_url" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Endpoint URL</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="timeout_in_secs" type="xsd:int"> - <xsd:annotation> - <xsd:documentation>Subscription Retry Timeout in Seconds</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="authentication_type" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Authentication Type</xsd:documentation> - </xsd:annotation> - </xsd:element> - <xsd:element name="format" type="xsd:string"> - <xsd:annotation> - <xsd:documentation>Subscription Format</xsd:documentation> - </xsd:annotation> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="topicList"> - <xsd:sequence> - <xsd:element name="topic" type="xsd:string" minOccurs="0" maxOccurs="unbounded"> - <xsd:annotation> - <xsd:documentation>Subscription Topic</xsd:documentation> - </xsd:annotation> - </xsd:element> - </xsd:sequence> - </xsd:complexType> - -</xsd:schema> diff --git a/app/code/Magento/Webhook/sql/webhook_setup/install-1.0.0.0.php b/app/code/Magento/Webhook/sql/webhook_setup/install-1.0.0.0.php deleted file mode 100644 index 5f261019d989074a5a616d3c0adadc6095fb3bd5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/sql/webhook_setup/install-1.0.0.0.php +++ /dev/null @@ -1,238 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/* @var \Magento\Core\Model\Resource\Setup $this */ -$this->startSetup(); - -/* @var $connection \Magento\DB\Adapter\AdapterInterface */ -$connection = $this->getConnection(); - -/** - * Create new table 'webhook_subscription' - */ -$subscriptionTable = $connection->newTable($this->getTable('webhook_subscription')) - ->addColumn('subscription_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Subscription Id') - ->addColumn('name', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, - array('nullable' =>false), - 'Subscription Name') - ->addColumn('registration_mechanism', \Magento\DB\Ddl\Table::TYPE_TEXT, 40, - array('nullable' =>false), - 'Registration Mechanism') - ->addColumn('status', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Status') - ->addColumn('alias', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, array(), - 'Alias') - ->addColumn('updated_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array(), - 'Updated At') - ->addColumn('endpoint_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, - array('nullable' => true,'default' => NULL,'unsigned' => true), - 'Subscription Endpoint') - ->addForeignKey( - $this->getFkName('webhook_subscription', 'endpoint_id', 'outbound_endpoint', 'endpoint_id'), - 'endpoint_id', - $this->getTable('outbound_endpoint'), - 'endpoint_id', - \Magento\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->addIndex( - $this->getIdxName('webhook_subscription', array('alias')), - array('alias') - ) - ->addIndex( - $this->getIdxName('webhook_subscription', array('status')), - array('status') - ) - ->setOption('collate', null) - ->setOption('comment', 'Subscription'); -$connection->createTable($subscriptionTable); - -/** - * Create table 'webhook_subscription_hook' - */ -$hookTable = $connection->newTable($this->getTable('webhook_subscription_hook')) - ->addColumn('hook_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, array( - 'identity' => true, - 'unsigned' => true, - 'nullable' => false, - 'primary' => true, - ), 'Hook Id') - ->addColumn('subscription_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, array( - 'unsigned' => true, - 'nullable' => false, - ), 'Subscription Id') - ->addColumn('topic', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, array( - ), 'Hook Topic') - ->addIndex( - $this->getIdxName('webhook_subscription_hook', array('topic')), - array('topic')) - ->addForeignKey( - $this->getFkName('webhook_subscription_hook', 'subscription_id', 'webhook_subscription', 'subscription_id'), - 'subscription_id', - $this->getTable('webhook_subscription'), - 'subscription_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE - ) - ->setOption('collate', null) - ->setOption('comment', 'Webhook'); -$connection->createTable($hookTable); - -/** - * Create table 'webhook_event' - */ -$eventTable = $connection->newTable($this->getTable('webhook_event')) - ->addColumn('event_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Event Id') - ->addColumn('topic', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, - array('nullable' => false), 'Hook Topic') - ->addColumn('body_data', \Magento\DB\Ddl\Table::TYPE_VARBINARY, '4M', - array('nullable' => false), - 'Serialized Data Array') - ->addColumn('headers', \Magento\DB\Ddl\Table::TYPE_TEXT, '16k', array(), - 'Headers') - ->addColumn('options', \Magento\DB\Ddl\Table::TYPE_TEXT, '16k', array(), - 'Options') - ->addColumn('status', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, array('nullable' => false), - 'Status') - ->addColumn('updated_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array('nullable' => false), - 'Updated At') - ->addColumn('created_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array('nullable' => false), - 'Created At') - ->addIndex($this->getIdxName('webhook_event', array('status')), array('status')) - ->setOption('collate', null) - ->setOption('comment', 'Queued Event Data'); -$connection->createTable($eventTable); - -/** - * Create table 'webhook_dispatch_job' - */ -$dispatchJobTable = $connection->newTable($this->getTable('webhook_dispatch_job')) - ->addColumn('dispatch_job_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, array( - 'identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Dispatch Job Id') - ->addColumn('event_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, - array('unsigned' => true, 'nullable' => false), - 'Event Id') - ->addColumn('subscription_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, - array('unsigned' => true, 'nullable' => false), - 'Subscription Id') - ->addColumn('status', \Magento\DB\Ddl\Table::TYPE_SMALLINT, null, - array('nullable' => false, 'default' => '0'), - 'Status') - ->addColumn('retry_count', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, - array('unsigned' => true, 'nullable' => false), - 'Retry Count') - ->addColumn('updated_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, - array('default' => \Magento\DB\Ddl\Table::TIMESTAMP_INIT_UPDATE, 'nullable' => false), - 'Updated At') - ->addColumn('created_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, - array('default' => '0000-00-00 00:00:00', 'nullable' => false), - 'Created At') - ->addColumn('retry_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, - array('default' => '0000-00-00 00:00:00', 'nullable' => false), - 'Retry At') - ->addForeignKey( - $this->getFkName('webhook_dispatch_job', 'subscription_id', 'webhook_subscription', 'subscription_id'), - 'subscription_id', - $this->getTable('webhook_subscription'), - 'subscription_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE - ) - ->addForeignKey( - $this->getFkName('webhook_dispatch_job', 'event_id', 'webhook_event', 'event_id'), - 'event_id', - $this->getTable('webhook_event'), - 'event_id', - \Magento\DB\Ddl\Table::ACTION_CASCADE, - \Magento\DB\Ddl\Table::ACTION_CASCADE - ) - ->addIndex( - $this->getIdxName('webhook_dispatch_job', array('status')), - array('status') - ) - ->addIndex( - $this->getIdxName('webhook_dispatch_job', array('retry_at')), - array('retry_at') - ) - ->setOption('collate', null) - ->setOption('comment', 'Dispatch Jobs'); -$connection->createTable($dispatchJobTable); - -/** - * Create table 'outbound_endpoint' * - */ -$outboundEndpointTbl = $connection->newTable($this->getTable('outbound_endpoint')) - ->addColumn('endpoint_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, 10, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Endpoint Id') - ->addColumn('name', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, - array('nullable' =>false), - 'Endpoint Name') - ->addColumn('endpoint_url', \Magento\DB\Ddl\Table::TYPE_TEXT, 255, - array('nullable' =>false), - 'Endpoint URL') - ->addColumn('authentication_type', \Magento\DB\Ddl\Table::TYPE_TEXT, 40, - array('nullable' =>false), - 'Authentication Type') - ->addColumn('format', \Magento\DB\Ddl\Table::TYPE_TEXT, 40, - array('nullable' =>false), - 'Data Format') - ->addColumn('status', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, - array('unsigned' => true, 'nullable' => false, 'default' => 0), - 'Status') - ->addColumn('api_user_id', \Magento\DB\Ddl\Table::TYPE_INTEGER, null, array( - 'unsigned' => true, 'nullable' => true), - 'Webapi User Id') - ->addColumn('updated_at', \Magento\DB\Ddl\Table::TYPE_TIMESTAMP, null, array(), - 'Updated At') - ->addColumn( - 'timeout_in_secs', - \Magento\DB\Ddl\Table::TYPE_INTEGER, - null, - array( 'nullable' => false, 'default' => 5), - 'Timeout in seconds') - ->addIndex( - $this->getIdxName('outbound_endpoint', array('endpoint_id'), - \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE), - array('endpoint_id'), - array('type' => \Magento\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE)) - ->addForeignKey( - $this->getFkName('outbound_endpoint', 'api_user_id', 'webapi_user', 'user_id'), - 'api_user_id', - $this->getTable('webapi_user'), - 'user_id', - \Magento\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\DB\Ddl\Table::ACTION_CASCADE) - ->setOption('collate', null) - ->setOption('comment', 'Endpoint for outbound messages'); -$connection->createTable($outboundEndpointTbl); - -$this->endSetup(); diff --git a/app/code/Magento/Webhook/view/adminhtml/css/boxes.css b/app/code/Magento/Webhook/view/adminhtml/css/boxes.css deleted file mode 100644 index 23fa8bf7f02d7d79e6cd0886f247f4765aa825b5..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/css/boxes.css +++ /dev/null @@ -1,1858 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -/***************** WIDGETS ****************** - Loading Indicator - Tables - Grid ( ubiquitous, massaction and dynamic) - Accordion - Tabs ( vertical and horizontal ) - Messages - Forms ( setter and elements) - Switcher - Space - Boxes - Scroller -*/ - -/**************** STRUCTURE ***************** - Layout - Header & Footer - Columns - Headings -*/ - -/************** PAGE-SPECIFIC *************** - Login - Sales - Catalog - Customers - Newsletter - System -*/ - -/********** ALIGNMENT AND CLEARS ***********/ - - -/******************************************************************/ -/**************************** WIDGETS *****************************/ -/******************************************************************/ - - -/* LOADING INDICATOR -*******************************************************************/ -#loading-process { - position:absolute; - top:45%; - left:50%; - margin-left:-60px; - border:2px solid #f1af73; - padding:15px 60px; - background:#fff4e9; - color:#d85909; - font-size:1.1em; - font-weight:bold; - text-align:center; - z-index:501; - } -#loading-mask, -.loading-mask { - background:background:url(../images/blank.gif) repeat; - position:absolute; - color:#d85909; - font-size:1.1em; - font-weight:bold; - text-align:center; - opacity:0.80; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; /* IE8 */ - z-index:500; - } -#loading-mask .loader, -.loading-mask .loader { - position:fixed; - top:45%; - left:50%; - width:150px; - margin-left:-105px; - padding:15px 30px; - background:#fff4e9; - border:2px solid #f1af73; - color:#d85909; - font-weight:bold; - text-align:center; - z-index:1000; - } -.loading-mask .loader { - position:absolute; - } -.loading-mask { - *filter:alpha(opacity=60); - -moz-opacity:.6; - opacity:.6; - -webkit-opacity:.6; - background: #ffffff; - } -#message-popup-window-mask { position:absolute; top:0; right:0; bottom:0; left:0; width:100%; height:100%; z-index:980; background-color:#efefef; opacity:.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";/*IE8*/ } -.message-popup { position:absolute; z-index:990; width:407px; top:-9999em; left:50%; margin:0 0 0 -203px; background:#f3bf8f; padding:0 4px 4px; } -.message-popup.show { top:280px; } -.message-popup .message-popup-head { padding:1px 0; } -.message-popup .message-popup-head h2 { padding:0 10px; margin:0; font:bold 12px/19px Arial, Helvetica, sans-serif; color:#644f3b; } -.message-popup .message-popup-head a { float:right; border:1px solid #ea7601; padding:0 12px 0 7px; background:url(../images/bkg_btn-close.gif) 0 50% repeat-x !important; font:normal 12px/17px Arial, Helvetica, sans-serif; color:#fff; text-decoration:none !important; cursor:pointer; } -.message-popup .message-popup-head a span { float:left; background:url(../images/bkg_btn-close2.gif) 0 50% no-repeat; padding-left:19px; } -.message-popup .message-popup-content { background:#fdf4eb; padding:21px 21px 10px; } -.message-popup .message-popup-content .message-icon { float:left; width:50px; padding:47px 0 0; background-position:50% 0; background-repeat:no-repeat; font-size:10px; line-height:12px; text-transform:uppercase; text-align:center; overflow:hidden; } -.message-popup .message-popup-content .message-critical { color:#e41101; } -.message-popup .message-popup-content .message-major { color:#f55600; } -.message-popup .message-popup-content .message-minor { color:#ff9e22; } -.message-popup .message-popup-content .message-notice { color:#659601; } -.message-popup .message-popup-content .message-text { float:right; width:295px; min-height:4.5em; overflow:hidden; color:#644f3b; } -.message-popup .message-popup-content .read-more { margin:7px 0 0; text-align:right; } -.message-popup .message-popup-content .read-more a { background:url(../images/more_arrow.gif) 0 50% no-repeat; padding-left:14px; text-decoration:underline; } -.message-popup .message-popup-content .read-more a:hover { text-decoration:none; } - -/* TABLES -*******************************************************************************/ - -/* Grid - General */ -.grid { border-bottom:0; padding-bottom:.5em; } -.grid table { width:100%; border:1px solid #cbd3d4; border-bottom:none; } -.grid table.border { border:1px solid #cbd3d4; } -.grid tbody { background:#fff; } /* Zebra odd-row */ -.grid tr.even, .grid tr.even tr { background:#f6f6f6; } /* Zebra even-row */ -.grid tr.on-mouse { background:#fcf5dd; cursor:pointer; } /* Rows mouse-over */ -.grid tr.invalid { background-color:#f5d6c7; } -.grid th, .grid td { padding:2px 4px 2px 4px; } -.grid th { white-space:nowrap; } -.grid td.editable input.input-text { width:50px !important; margin-left:4px !important; } -.grid td input.input-text { width:86%; } -.grid td input.input-text-export-filter { width:272px; } -.grid td input.input-text-range { width:104px; } -.grid td input.input-text-range-date { width:87px; } -.grid td input.input-inactive { background:#eee; } -.grid table td { border-width:0 1px 1px 0; border-color:#dadfe0; border-style:solid; } -.grid table.border td { background:#fff !important; } -.grid table td.first, -.grid table td.last { border-right:0; } -.grid table td.product { text-align:right; } -.grid table td.empty-text { padding:15px; } -.grid table td .action-select { width:100%; } -.grid .separator { padding:0 4px; color:#b9b9b9; } - -.grid tbody.odd tr { background:#fff !important; } -.grid tbody.even tr { background:#f6f6f6 !important; } -.grid tbody.odd tr td, -.grid tbody.even tr td { border-bottom:0; } -.grid tbody.odd tr.border td, -.grid tbody.even tr.border td { border-bottom:1px solid #dadfe0; } - - -/* Grid - Pager and Buttons row */ -table.actions { width:100%; margin:.5em 0; } -table.actions td { vertical-align:top; } -.pager select { width:4em!important; margin:0 4px; } -.pager input.page { width:2em !important; } -.pager .arrow { margin:0 3px; vertical-align:middle; } - - -/* Grid - Headings */ -.grid tr.headings { background:url(../images/sort_row_bg.gif) 0 50% repeat-x; } -.grid tr.headings th { border-width:1px; border-color:#f9f9f9 #d1cfcf #f9f9f9 #f9f9f9; border-style:solid; padding-top:1px; padding-bottom:0; font-size:.9em; } -.grid tr.headings th.last { border-right:0; } -.grid tr.headings th.no-link { /* Grid th with no sorting functionality */ padding-top:2px; padding-bottom:1px; color:#67767e; } -.grid tr.headings th span.nobr { display:block; /* FF3 fix */ } -.grid tr.headings th a { display:block; padding:2px 4px 1px 0; color:#2d444f; text-decoration:none; } -.grid tr.headings th a:hover { color:#d85909; text-decoration:none; } -.grid tr.headings th a.sort-arrow-desc, -.grid tr.headings th a.sort-arrow-asc { background:url(../images/sort_on_bg.gif) 0 0 no-repeat; border-bottom:1px solid #fff; border-right:1px solid #fff; padding-bottom:2px; } -.grid tr.headings th span.sort-title { display:block; padding:3px 12px 4px 0; line-height:1; } -.grid tr.headings th a.sort-arrow-desc span.sort-title, -.grid tr.headings th a.sort-arrow-asc span.sort-title { background-position:right 50%; background-repeat:no-repeat; padding:3px 12px 2px 8px; } -.grid tr.headings th a.sort-arrow-desc span.sort-title { background-image:url(../images/grid_sort_desc.gif); } -.grid tr.headings th a.sort-arrow-asc span.sort-title { background-image:url(../images/grid_sort_asc.gif); } - - -/* Grid - Mass Action */ -.massaction { width:100%; height:26px; border:1px solid #d1cfcf; border-bottom:none; background:url(../images/massaction_bg.gif) repeat-x 0 100% #ebebeb; font-size:.9em; } -.massaction td { width:50%; border-top:1px solid #fff; padding:1px 8px; vertical-align:middle; } -.massaction .entry-edit fieldset .select { width:auto; /*width:120px;*/ display:inline; } -.massaction .entry-edit fieldset select.validation-failed { border:1px dashed #eb340a !important; background:#faebe7 !important } -.massaction .entry-edit fieldset { margin:0; padding:0; background:none; border:none; } -.massaction .entry-edit fieldset .field-row { display:inline; } -.massaction .entry-edit .field-row label { float:none; width:auto; margin-left:13px; } -.massaction .entry-edit { margin:0 !important; padding:0; } -.massaction .entry-edit .validation-advice { display:none !important; } -.massaction a { text-decoration:none; } -.massaction .entry-edit fieldset span.form_row, -.massaction .entry-edit fieldset span.field-row { clear:none !important; display:inline; float:left !important; margin:0; padding:0 5px 0 0; } - -.massaction .entry-edit .outer-span { float:left; } - -/* Grid - Filter */ -.grid tr.filter { background:url(../images/filter_row_bg.gif) repeat-x #e3eff1; cursor:default; } -.grid tr.filter th { padding-top:5px; padding-bottom:5px; border:1px solid #bdbdbd; border-width:0 1px 1px 0; white-space:normal; } -.grid tr.filter th.last { border-right:0; } -.grid tr.filter input.input-text { width:85%; } -.grid tr.filter select { width:100%; } -.grid tr.filter .range .range-line { margin-bottom:3px; width:100px; } -.grid tr.filter .range div.date { min-width:121px; } -.grid tr.filter .range input { float:right; width:50px !important; margin-top:0; } -.grid tr.filter .range select { float:right; width:56px !important; margin-top:0; } -.grid tr.filter .range .label { display:block; width:36px; float:left; padding-left:2px; } -.grid tr.filter .date img { width:15px; height:15px; cursor:pointer; vertical-align:middle; } -.grid .head-massaction select { width:auto !important; max-width:90px; } -.grid select.select-export-filter, -.grid select.multiselect-export-filter { width:278px; } - -/* Grid Footer */ -.grid table tfoot tr { background:#D7E5EF; } -.grid table tfoot tr td { border-top:1px solid #9babb9; background:#e5ecf2; line-height:1.7em; } -.grid table.border tfoot tr td { background:#D7E5EF !important; } - - -/* Dynamic Grid */ /* Used in pages like Catalog -> Attributes */ -.dynamic-grid th { padding:2px;width:100px; } -.dynamic-grid td { padding:2px; } -.dynamic-grid td input { width:94px; } -tr.dynamic-grid td, -tr.dynamic-grid th { padding:2px 10px 2px 0; width:auto; } -tr.dynamic-grid input.input-text { width:154px; } -.available { color:#080; font-weight:bold; } -.not-available { color:#800; } - - -/* ACCORDION -*******************************************************************************/ -dl.accordion .grid { margin-bottom:0; } -dl.accordion dt, -.entry-edit .entry-edit-head { background:#6f8992; padding:2px 10px; } -dl.accordion dt, div.collapseable { margin-top:1px; } -dl.accordion dt a, div.collapseable a { background:url(../images/entry_edit_head_arrow_down.gif) 100% 50% no-repeat; color:#fff; display:block; font-weight:bold; text-decoration:none; } -div.disabled { background:#c6cbc9 !important; } -div.disabled a { background-image:url(../images/entry_edit_head_arrow_down2.gif) !important; color:#f6f6f6 !important; } - -.entry-edit fieldset.collapseable { margin-bottom:10px; } - -dl.accordion dt a:hover, div.collapseable a:hover { color:#fff; text-decoration:none; } -dl.accordion dt.open a, div.collapseable a.open { background:url(../images/entry_edit_head_arrow_up.gif) 100% 50% no-repeat; } -dl.accordion dd { display:none; } -dl.accordion dd.open { display:block; } -img.accordion-btn { float:right; margin-top:1px; margin-right:5px; } - -/* TABS -*******************************************************************************/ - -/* Vertical Tabs */ -ul.tabs { border-top:1px solid #bebebe; background-color:#e7efef; } -ul.tabs a, ul.tabs span { display:block; } -ul.tabs a, ul.tabs a:hover { text-decoration:none; } -/* ul.tabs a.notloaded { color:#999; } */ -ul.tabs a, ul.tabs a:hover { color:#000; } -ul.tabs, ul.tabs a { background:url(../images/tabs_link_bg.gif) repeat-y 100% #E7EFEF; } -ul.tabs a:hover { background-color:#D8E6E6; background-image:url(../images/tabs_link_over_bg.gif); } -ul.tabs a.active, -ul.tabs .ui-state-active a { padding:0; border-bottom:1px solid #bebebe; background:none; } -ul.tabs a:hover.active, -ul.tabs .ui-state-active a:hover { padding:0; } -ul.tabs span { background:url(../images/tabs_span_bg.gif) repeat-x 0 100%; padding:.3em 0.5em .28em 1.5em; cursor:pointer; } -ul.tabs span em { float:right; } -ul.tabs a.active span, -ul.tabs a:hover.active span, -ul.tabs .ui-state-active a span, -ul.tabs .ui-state-active a:hover span { background:#fff; font-weight:bold; } -ul.tabs a.subitem { padding-left:2.2em; } -ul.tabs span.changed, -ul.tabs span.error, -ul.tabs span.loading { float:right; background:0; padding:0; } -ul.tabs a.changed span.changed { background:url(../images/fam_bullet_disk.gif) 0 0 no-repeat !important; width:16px; height:16px; } -ul.tabs a.error span.error { background:url(../images/fam_bullet_error.gif) 0 0 no-repeat !important; width:16px; height:16px; } -ul.tabs a.ui-tabs-loading span.loading { background:url(../images/loader-small.gif) 0 0 no-repeat !important; width:16px; height:16px; } -ul.tabs a.changed { font-style:italic; } - -/* Horizontal Tabs */ -ul.tabs-horiz { margin:0 0 18px 0; background:url(../images/horiz_tabs_ul_bg.gif) repeat-x 0 100% #f8f8f8; padding:8px 0 0 5px; } -ul.tabs-horiz li { float:left; margin:0 4px; } -ul.tabs-horiz li a { display:block; background:#e2e2e2; border:1px solid #ccc; padding:2px 10px; color:#333 !important; text-decoration:none !important; } -ul.tabs-horiz li a.notloaded { /* not used for now */ } -ul.tabs-horiz li a.active, -ul.tabs-horiz .ui-state-active a { border-bottom:1px solid #fff; background:#fff; } - - -/* MESSAGES -*******************************************************************************/ -.notification-global { padding:5px 27px 5px 47px; background:#fff9e9 url(../images/error_msg_icon.gif) 27px 5px no-repeat; border-bottom:1px solid #eee2be; border-top:1px solid #eee2be; font-size:11px; line-height:16px; margin:0 0 -3px; color:#444; position:relative; } -.notification-global-notice { background-image:url(../images/note_msg_icon.gif); } -.notification-global .label { color:#eb5e00; } -.notification-global .clickable { cursor:pointer; } -.notification-global span.critical { color:#d20000; } -.notification-global a:hover { text-decoration:none; } - -.error, -a.error span, -.required, -.validation-advice, -label.mage-error { color:#D40707 !important; font-weight:bold !important; } -label.mage-error {width: auto !important; display: block;} -.notice { color:#ea7601} -.messages ul { border:0 !important; } -.messages li { min-height:23px !important; margin-bottom:11px !important; padding:8px 8px 2px 32px !important; font-size:.95em !important; font-weight:bold !important; } -.messages ul li { margin:0 0 3px 0 !important; border:0 !important; padding:0 !important; } -.error-msg { border:1px solid #f16048 !important; color:#df280a !important; background:#faebe7 url(../images/error_msg_icon.gif) no-repeat 10px 10px !important; } -.success-msg { border:1px solid #95a486 !important; color:#3d6611 !important; background:#eff5ea url(../images/success_msg_icon.gif) no-repeat 10px 10px !important; } -.notice-msg { border:1px solid #ffd967 !important; background:#fffbf0 url(../images/note_msg_icon.gif) no-repeat 10px 10px !important; color:#3d6611 !important; } -.warning-msg { border:1px solid #666e73 !important; background:#e6e6e6 url(../images/warning_msg_icon.gif) no-repeat 10px 10px !important; color:#000000 !important; } -.validation-advice, -label.mage-error { clear:both; min-height:15px; margin:3px 0 0 9px; background:url(../images/validation_advice_bg.gif) no-repeat 2px 1px; padding-left:16px; font-size:.95em; font-weight:bold; line-height:1.25em; } -input.validation-failed, textarea.validation-failed { background:#fef0ed; border:1px dashed #d6340e; } - -/* Noscript Notice */ -.noscript { border:1px solid #000; border-width:0 0 1px; background:#ffff90; font-size:12px; line-height:1.25; text-align:center; color:#2f2f2f; } -.noscript .noscript-inner { width:900px; margin:0 auto; padding:12px 0 12px; background:url(../images/i_notice.gif) 20px 50% no-repeat; } -.noscript p { margin:0; } - -/* For Demo store only */ -.demo-notice { margin:0; background:#d75f07; padding:5px 10px 6px 10px; color:#fff; line-height:1em; text-align:center; } - - -/* FORMS -*******************************************************************************/ -select.countries option { background-repeat:no-repeat; } -.entry-edit .fieldset .tree li, -.entry-edit .tree li { margin:0; } - - -/* Entry Edit */ /* Site-wide form fieldset */ -table.form-edit { width:100%; } -.box, -.entry-edit fieldset, -.entry-edit .fieldset { padding:10px 15px; margin-bottom:15px; } -.entry-edit .entry-edit-head h4 { float:left; padding:0; background:none; margin:0; color:#fff; font-size:1em; line-height:18px; min-height:0; } -.entry-edit .entry-edit-head .tools { float:right;} -.entry-edit .entry-edit-head strong, -.entry-edit .entry-edit-head a { color:#fff; font-size:1em; line-height:18px; min-height:0; font-weight:bold} -.entry-edit .entry-edit-head .entry-edit-head-link {height:41px; margin:-41px 0 0; position: absolute; visibility: hidden;} -.entry-edit .content { margin-left:0 !important; padding:10px 15px; } -.entry-edit fieldset li, -.entry-edit .fieldset li { margin:4px 0; } -.entry-edit fieldset span.form_row, -.entry-edit .fieldset span.form_row, -.entry-edit fieldset .field-row .hint, -.entry-edit .fieldset .field-row .hint { float:left; color:#999; padding-left:12em; } -.entry-edit .form-buttons { float:right; margin:2px -3px 2px 0pt; } -label.inline { float:none !important; width:auto !important; } -.nested-content .entry-edit { margin-left:2em; } -.nested-content .entry-edit .entry-edit { margin-left:0; } -#coupon_container .entry-edit { min-width:310px; } - -/* Form Elements */ -input.input-text,textarea,select { border-width:1px; border-style:solid; border-color:#aaa #c8c8c8 #c8c8c8 #aaa; background:#fff; font:12px arial, helvetica, sans-serif; } -select { min-height:17px; /* to set the height for empty selects */ } -input.input-text,textarea { padding:2px; } -input.qty { width:40px !important; } -input.item-qty { width:22px !important; } -input.price { width:50px !important; text-align:right; } -input[type=text].disabled { background:#eee; } -select optgroup { font-style:normal; } -select optgroup option { padding-left:10px; } -select optgroup option.even { background:#f6f6f6; } /* Zebra even-row */ -select.multiselect option { padding:3px 4px; border-bottom:1px solid #ddd; } -.checkboxes li { margin:0 0 5px !important; } -.field-100 { background-color:#fff; border-width:1px; border-style:solid; border-color:#aaa #c8c8c8 #c8c8c8 #aaa; padding:2px; } -.field-100 textarea, -.field-100 input.input-text { float:left; width:100% !important; border:0 !important; padding:0 !important; } -@media screen and (-webkit-min-device-pixel-ratio:0) { - select option:disabled, - select:disabled option { color:#c9c9c9!important;color:#cacaca!important; text-shadow:2px 2px 2px #000; } -} - -/* Form List */ /* Table for default form data */ -.form-list { width:auto; border:0 !important; } -.form-list td.label, -.form-list td.value, -.form-list td.value2, -.form-list td.note, -.form-list td.scope-label, -.form-list td.use-default { border:0 !important; padding-top:5px !important; padding-bottom:5px !important; padding-left:5px !important; background:0 !important; } -.form-list td.hidden { border:0 !important; padding:0 !important; background:0 !important; } -.form-list td.label { width:200px; } -.form-list td.label label { display:block; width:185px; padding-right:15px; } -.form-list td.value input.input-text, -.form-list td.value textarea { width:274px; } -.form-list td.value textarea { height:15em; } -.form-list td.value select { width:280px; } -.form-list td.value select.select-date { width:87px; } -.form-list td.note { background:url(../images/note_cell_bg.gif) 6px 10px no-repeat !important; padding-left:18px; } -.form-list td.scope-label { padding-left:5px; color:#6f8992; font-size:.9em; } -.form-list p.note { margin:0; padding:0 0 0 13px; background:url(../images/note_bg.gif) 1px 6px no-repeat; font-size:11px; } - -.columns .form-list { width:auto; } -.columns .form-list td.value { width:280px; padding-right:5px !important; } -.columns .form-list td.value .next-toinput { width:75px; display:inline; margin-right:5px; } -.columns .form-list td.value .next-toselect input.input-text { width:195px!important; display:inline; } - -.fieldset-wide .form-list { width:100% !important; } -.fieldset-wide .form-list td.value { width:auto !important; } -.fieldset-wide .form-list td.value input.input-text, -.fieldset-wide .form-list td.value textarea { width:98% !important; } -#weight {width: 110px !important; } -/*.fieldset-wide .form-list td.value select { display:block; }*/ -.fieldset-wide .form-list td.scope-label { white-space:nowrap; width:1px; } -.fieldset-wide .form-list td.note { width:120px; } - -.multi-input { margin-bottom:8px; } /* Example: Address fields with 2 input lines */ -.grid tr .form-list tr { background:#fff !important; } /* Follows grid row background-color */ -.grid tr.even .form-list tr { background:#f6f6f6 !important; } /* Follows grid row background-color */ -.grid tr.on-mouse .form-list tr { background:#fcf5dd !important; } /* Follows grid row background-color */ -.grid tr .form-list { margin:8px 0; } -.field-row { display:block; margin-bottom:5px; } -span.delete-image, -span.delete-file { display:block; white-space:nowrap; padding-left:25px; } -span.delete-file { padding:0; } - -/* Back compatibility with span forms */ -.entry-edit .field-row { display:block; } -.entry-edit .field-row label { float:left; width:150px; } - -/* Form Button */ -.content-buttons.form-buttons, -.content-header .form-buttons { text-align:right; margin-bottom:0; } -.content-header .content-buttons-placeholder { display:inline !important; } -.content-header .form-buttons { float:right; } -.content-header td.form-buttons { float:none; } -.content-header .form-buttons button { margin-bottom:3px; } -.sub-btn-set { border:1px solid #ddd; border-width:0 1px; background:url(../images/sub_button_bg.gif) repeat; padding:3px 10px; text-align:right; } -button, -.form-button { vertical-align:middle; border-width:1px; border-style:solid; border-color:#ed6502 #a04300 #a04300 #ed6502; padding:0 7px 1px 7px; background:#ffac47 url(../images/btn_bg.gif) repeat-x 0 100%; color:#fff; font:bold 12px arial, helvetica, sans-serif; cursor:pointer; text-align:center !important; white-space:nowrap; } -button:hover { background:#f77c16 url(../images/btn_over_bg.gif) repeat-x 0 0; } -button:active { background:#f77c16 url(../images/btn_on_bg.gif) repeat-x 0 0; } -button span { line-height:1.35em; background-repeat:no-repeat; background-position:0 50%; } -button span span { background:none !important; padding:0 !important; margin:0 !important; display:inline !important; } -button.delete, -button.save, -button.add { padding-left:6px; } -button.cancel span, -button.delete span, -button.save span, -button.add span, -button.back span, -button.add-image span, -button.add-widget span { padding-left:20px; } -/* Google Chrome specific fix for empty buttons */ -button.add span:after, -button.delete span:after { display:inline-block; clear:both; content:"."; font-size:0; line-height:0; height:0; overflow:hidden; } -button.back { border-color:#ccc #aaa #aaa #ccc; background-color:#fff; background-image:url(../images/btn_back_bg.gif); color:#555; } -button.back span { background-image:url(../images/icon_btn_back.gif); } -button.fail, -button.cancel, -button.delete { border-color:#d24403 #a92000 #a92000 #d24403; background-image:url(../images/cancel_btn_bg.gif); background-color:#fcaf81; color:#fff; } -button.fail:hover, -button.cancel:hover, -button.delete:hover { background-image:url(../images/cancel_btn_over_bg.gif); } -button.fail:active, -button.cancel:active, -button.delete:active { background-image:url(../images/cancel_btn_active_bg.gif); background-color:#e0612f; } -button.cancel span, -button.delete span { background-image:url(../images/cancel_btn_icon.gif); } -button.add span { background-image:url(../images/add_btn_icon.gif); } -button.save span { background-image:url(../images/save_btn_icon.gif); } -button.show-hide span { background-image:url(../images/btn_show-hide_icon.gif); padding-left:26px; } -button.add-image span { background-image:url(../images/btn_add-image_icon.gif); } -button.add-widget span { background-image:url(../images/btn_add-widget_icon2.gif); padding-left:24px; } -button.add-variable span { background-image:url(../images/btn_add-variable_icon.gif); padding-left:26px; } -button.go span { background-image:url(../images/btn_go.gif); padding-left:16px; } -button.btn-chooser { display:block; margin:0 0 10px; } -button.success { background-image:url(../images/btn_gr_bg.gif); border-color:#46745E; } -button.success:hover { background:url(../images/btn_gr_over.gif) #6cac46; } -button.success:active { background:url(../images/btn_gr_on.gif) repeat-x 0 0 #3fa05e; } - -button.disabled, -button.disabled:hover, -button.disabled:active { border-color:#777 #505050 #505050 #777; background:#919191 url(../images/btn_bg-disabled.gif) 0 0 repeat-x; color:#fff; cursor:default; opacity:.8; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; } -button.add.disabled span { background-image:url(../images/add_btn_icon-disabled.gif); } - -button.loading > span { padding-left:20px; background-image: url(../images/btn_loading-icon.gif) !important;} - -button.icon-btn { width:32px !important; } -button.icon-btn span { text-indent:-999em; display:block; width:16px; padding:0; overflow:hidden; } - -.buttons-set { margin:0 0 10px; } -.buttons-set button { margin-right:5px; } - - -/* Buttons group */ - -.btn-add { padding-left:6px; } -.btn-add span { - background-image:url(../images/add_btn_icon.gif); - padding-left:20px; -} -div.button { - border-width:1px; - border-style:solid; - order-color:#ed6502 #a04300 #a04300 #ed6502; - padding:1px 7px 3px 7px; - background:#ffac47 url(../images/btn_bg.gif) repeat-x 0 100%; - color:#fff; - font:bold 12px arial, helvetica, sans-serif; - cursor:pointer; - text-align:center !important; - white-space:nowrap; -} -div.button:hover { - background:#f77c16 url(../images/btn_over_bg.gif) repeat-x 0 0; -} -div.button:active { - background:#f77c16 url(../images/btn_on_bg.gif) repeat-x 0 0; -} -div.button span { - line-height:1.25em; - background-repeat:no-repeat; - background-position:0 50%; -} -div.button { - -webkit-touch-callout: none; - -webkit-user-select: none; - -khtml-user-select: none; - -moz-user-select: none; - -ms-user-select: none; - user-select: none; -} -.buttons-group { - position: relative; - display:inline-block; - vertical-align:middle; -} -.buttons-group:before, -.buttons-group:after { - display: table; - content: ""; -} -.buttons-group:after { - clear: both; -} -.buttons-group > .button { - position:relative; - float:left; - margin-left:-1px; - border-radius:0; -} -.buttons-group > .button:first-child { - margin-left:0; -} -.buttons-group > .button:last-child, -.buttons-group > [data-toggle="dropdown"] { -} - -/* Button toggle (with dropdown menu) */ -.dropdown-menu { - position:absolute; - display:none; - list-style:none; - margin:1px 0 0 0; - padding:0; - right:0; - top:100%; - min-width: 100%; - border-width:1px; border-style:solid; border-color:#ed6502 #a04300 #a04300 #ed6502; - box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2); - -webkit-box-sizing: border-box; - -moz-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - white-space: nowrap; -} -.dropdown-menu li { - background:#ffac47; - background:rgba(255, 172, 71, .95); - text-align: left;color:#fff; font:bold 12px arial, helvetica, sans-serif; cursor:pointer; - padding:0; - position: relative; - z-index: 1; -} -.dropdown-menu li .item { - display: block; - padding:4px 25px 4px 8px; -} -.dropdown-menu li > .tooltip { - position: absolute; top:5px; right:3px; -} -.dropdown-menu li.selected { -} -.dropdown-menu li:hover { - background:#f77c16; - z-index: 2; -} -.dropdown-menu li:active { - background:#f77c16; -} -.dropdown-menu li:last-child { - -} -.dropdown-menu-top { - margin:0 0 3px 0; - top:auto; - bottom:100%; -} -.buttons-group.active { - z-index:20; -} -.buttons-group.active .dropdown-menu { - display:block; -} -.btn-toggle span { - width:6px; overflow: hidden; display: block; -} -.active .btn-toggle { - background:#f77c16 url(../images/btn_on_bg.gif) repeat-x 0 0; -} -.btn-toggle span:before { - display: inline-block; - content:''; - margin-left:100px; - /*position: absolute;*/ - text-indent: 0; - margin-left:0; - width: 0; - height: 0; - border-right:3px solid transparent; - border-left:3px solid transparent; - border-top: 6px solid #fff; -} - -/* ============================================================================= - Tooltip - ========================================================================== */ - -/* Styles for simple "css" tooltip */ -.tooltip { - display:inline-block; - vertical-align:middle; - line-height:1.1; -} -.tooltip > .help { - width:15px; - height: 15px; - line-height: 15px; - text-indent: -999em; - overflow: hidden; - display: block; - background: url(../images/icon-tooltip.png) no-repeat 0 0; - position: relative; z-index: 111; - cursor:help; -} -.tooltip-content { - display:none; - position:absolute; - max-width:200px; - margin-top:5px; - margin-left:-18px; - padding:8px; - border-radius:3px; - background:#000; - background:rgba(0,0,0,.8); - color:#fff; - text-shadow:none; - z-index:20; - font-weight: normal; - font-size: 11px; -} -.tooltip-content:before { - content:''; - position:absolute; - width:0; - height:0; - top:-5px; - left:20px; - border-left: 5px solid transparent; - border-right: 5px solid transparent; - border-bottom: 5px solid #000; - opacity:.8; -} -.tooltip:hover { - z-index:20; -} -.tooltip:hover > .help { - background-position: 0 -15px; -} -.tooltip > .help:hover + .tooltip-content { - display:block; -} - - -/* SWITCHER -*******************************************************************************/ -.switcher { margin-bottom:10px; border:1px solid #cddddd; background:#e7efef; padding:10px; } -.side-col .switcher { padding-right:26px; } -.side-col .switcher label { display:block; } -.side-col .switcher .link-store-scope { float:right; margin-right:-19px; margin-left:3px; } -.side-col .switcher select { width:100%; float:left; } -/*.side-col .switcher { margin-right:20px; margin-bottom:20px; }*/ -.catalog-categories .side-col .switcher { margin-right:0; margin-bottom:15px; } -.link-store-scope { display:inline-block; vertical-align:middle; margin:0 0 1px; width:16px; height:16px; background:url(../images/i_question-mark.png) 0 0 no-repeat; text-decoration:none !important; text-indent:-999em; overflow:hidden; } -.store-scope .link-store-scope { float:left; margin-right:10px; } -.store-scope .tree-store-scope { float:left; padding:7px 10px; border:1px dotted #dedede; } -.store-scope table.stores-tree { float:left; width:auto !important; } -.form-list td.value .store-scope { white-space:nowrap; } -.form-list td.value .link-store-scope { float:none; margin-right:0; vertical-align:top; margin-top:6px; } - - -/* SPACE -*******************************************************************************/ -.box-left, .box-right { width:48.5%; } -.box-left { float:left; } -.box-right { float:right; } -.box-left .content, -.box-right .content { padding:6px 14px; } -.separator, .pipe { padding:0 6px; font-size:.9em; } /* vertical pipe */ -.divider { display:block; height:1px; margin:8px 0; background:#ddd; overflow:hidden; } /* horizontal pipe */ -td.divider { font-size:1px; line-height:0; } -.box, -.entry-edit fieldset, -.entry-edit .fieldset { border:1px solid #d6d6d6; background:#fafafa; } - - -/* SCOLLER */ /* Used primarily in Sales -> Order -> Create Order */ /* -*******************************************************************************/ -.scroll-cont { - position:absolute; - top:-25px; - left:503px; - width:16px; - height:265px; - background:transparent url(../images/db-scroll-bg.gif) no-repeat top; - z-index:10000; - } -.auto-scroll { overflow:auto; height:11em; } -.root { position:relative; height:260px; margin:0; width:1px; } -.thumb { position:absolute; height:40px; width:16px; margin-top:-28px; z-index:11000; } -.up { margin-top:254px; height:16px; } -.dn { margin-top:0; padding:0; height:15px; } -.up a, .up a img, -.dn a, .dn a img, -.thumb a , -.thumb a img { border:0; } -.up a:active, .dn a:active { outline:none; } -.scrollContainer { - position:absolute; - left:0; - top:19px; - clip:rect(0 467px 200px 0); - overflow:auto; - border:0; - } -.scrollContent { position:absolute; left:0; top:0; } - -/* Horizontal scroll */ -.hor-scroll { width:100%; padding-bottom:4px; margin-bottom:-4px; } /* IE has personal style, see iestyles.css */ - - -/**/ -.note-list { width:100%; overflow:hidden; } -.note-list li { border-top:1px solid #e3e3e3; margin-top:9px !important; background:url(../images/icon_note_list.gif) no-repeat 0 4px; padding-bottom:9px; padding-left:18px; } - - - -/******************************************************************************/ -/********************************** STRUCTURE *********************************/ -/******************************************************************************/ - -/* LAYOUT -*******************************************************************************/ -.wrapper { min-width:960px; } -.wrapper-popup { min-width:750px; } -.header { background:url(../images/header_top_bg.gif) repeat-x #425e66; text-align:right; } -.middle { min-height:450px; background:url(../images/simple_container_bg.gif) repeat-x #fff; padding:23px 27px 0 27px; } -.middle-popup { border-bottom:3px solid #fff; background:url(../images/middle_bg.gif) repeat-x 0 100% #fff; padding:0 0 0 0; background:yellow; } -.container-collapsed { padding:1.8em 2.2em 1.8em 2em; padding-top:0; } -.columns {background:url(../images/side_col_bg.gif) repeat-y 217px 0; } - -div.side-col { float:left; width:220px; margin-right:-220px; padding-bottom:25px; } -div.main-col { margin-left:220px; min-height:450px; padding:0 0 25px 25px; } -div.main-col-inner { float:left; /* Fixes some inner clears in the liquid main-col */ width:100%; } - -.footer { clear:both; background:url(../images/footer_bg.gif) repeat-x #e6e6e6; padding:105px 2.8em 2.8em 2.8em; font-size:.95em; text-align:center; } -.simple-container-popup { min-height:50px !important; padding:1.8em 2.3em 6em 2.3em; background:url(../images/simple_container_bg.gif) repeat-x; } - -.page-popup { background:#fff; } - - -/******************************************************************************/ -/************************************* BOXES **********************************/ -/******************************************************************************/ - -/* HEADER & FOOTER -*******************************************************************************/ - -.logo { float:left; margin:5px 20px 5px 27px; height:43px; } -.header-top { border-bottom:1px solid #5F767F; } - -/* Header right */ -.header-right { padding:10px 25px 0 15px; font-size:.95em; color:#fff; } -.header-right a, .header-right a:hover { color:#fcce77; } -.header-right .separator { color:#999; } -.header-right fieldset { display:inline; padding-left:10px; } -.header-right fieldset input.input-text { width:18em; } -.header-right .super { - float:right; - line-height:1.8em; - margin-bottom:14px; - margin-left:1.3em; - } - -/* Search autocomplete */ -div.autocomplete { - z-index:10000; - position:absolute; - width:250px; - background-color:white; - border:1px solid #888; - margin:0; - padding:0; - } -div.autocomplete ul { margin:0; padding:0; } -div.autocomplete ul li.selected { background-color:#dcebf0; } -div.autocomplete ul li { padding:.5em .7em; min-height:32px; cursor:pointer; text-align:left; color:#2f2f2f; line-height:1.3em; } - -/* Mage suggest */ -/*.mage-suggest { position:relative; display: inline-block; background: #fff; border-radius: 5px; box-shadow: 1px 0 2px #ddd; } -.mage-suggest .input-text { border-radius: 5px; margin: 7px; border: 1px solid #ddd; height: 20px; padding: 3px 25px 3px 10px; line-height: 26px; background: url(../images/bkg_search-magnifier.png) 98% 50% no-repeat; } -.mage-suggest-dropdown { overflow-x: hidden; position: absolute; top: 100%; margin-top:-4px; left: 0; min-width: 100%; background: #fff; border: solid #ddd; border-width: 0 1px 1px; padding: 10px 0; box-sizing: border-box; border-radius: 0 0 5px 5px; box-shadow: 1px 1px 2px #ddd; } -.mage-suggest-dropdown.overflow-y { overflow-y: scroll; } -.mage-suggest-dropdown .ui-menu-item a { display:block; padding: 0 10px; text-decoration: none; font:normal 12px/26px Arial, sans-serif; text-align: left; border-bottom: 1px solid #f2f2f2; color:#2d2d2d; } -.mage-suggest-dropdown .ui-state-active, -.mage-suggest-dropdown .ui-state-focus { background: #f2f2f2; color:#000; }*/ -.mage-suggest-inner {padding: 5px 0;} -.mage-suggest {position: relative;} -.mage-suggest-inner {position: absolute; background: #fff; top:0px; left:0px; border: 1px solid #ddd; border-radius: 5px; box-shadow: 1px 1px 2px #ddd;} -.mage-suggest-inner > input { - height: 22px; - margin: 0 5px; -} -.mage-suggest-dropdown > h2 { - font-size:0.8em; - text-transform: uppercase; - font-family:Arial, Helvetica, sans-serif; - color: #555555; - font-weight: normal; - padding: 0 8px; -} -.mage-suggest-dropdown .ui-menu-item a { display:block; padding: 0 10px; text-decoration: none; font:normal 12px/26px Arial, sans-serif; text-align: left; border-bottom: 1px solid #f2f2f2; color:#2d2d2d; } -.mage-suggest-dropdown .ui-state-active, -.mage-suggest-dropdown .ui-state-focus { background: #f2f2f2; color:#000; } -.mage-suggest-dropdown .ui-corner-all { - border-radius: 0px; -} -.mage-suggest-dropdown .ui-widget-content, .mage-suggest-dropdown .ui-menu .ui-menu-item a, .mage-suggest-dropdown .ui-menu .ui-menu-item a.ui-state-focus { - background: #ffffff; - border: none; - color: #000000; -} -.mage-suggest-dropdown .ui-menu .ui-menu-item a, .mage-suggest-dropdown .ui-menu .ui-menu-item a.ui-state-focus { - border-top: 1px solid #efefef; - margin: 0; - padding: 3px 8px; -} -.mage-suggest-dropdown .ui-menu { - padding: 0px; - width: 100%; -} -.mage-suggest-dropdown .ui-menu .ui-menu-item a.ui-state-focus { - background: #ebebeb; -} -.mage-suggest-dropdown .show-all { - padding: 5px 8px; - color: #555555; - font-family:Arial, Helvetica, sans-serif; - font-size: 0.8em; -} -.mage-suggest-dropdown { - overflow: auto; - max-height: 500px; - z-index: 1; -} -.mage-suggest.category-select .mage-suggest-inner {background: transparent; position: static; border: none; border-radius: 0px; box-shadow: none;} -.mage-suggest.category-select .mage-suggest-choices {background: #fff; border: 1px solid #ddd; border-radius: 5px; box-shadow: none; overflow: hidden;} -.mage-suggest.category-select .mage-suggest-choices li {float: left; margin: 5px 0 5px 7px;} -.mage-suggest.category-select .mage-suggest-search-field input { - background: none repeat scroll 0 0 transparent !important; - border: 0 none; - box-shadow: none; - font-family: sans-serif; - font-size: 100%; - height: 22px; - margin: 1px 0; - outline: 0 none; - padding: 0 5; -} -.mage-suggest.category-select .mage-suggest-dropdown { - position: absolute; - width: 100%; - background: #fff; border: 1px solid #ddd; border-radius: 5px; - margin-top: 2px; -} -.mage-suggest-dropdown .jstree-default.jstree-focused { - background: #ffffff; -} -.mage-suggest-dropdown .jstree li { - margin-left: 18px; -} -.mage-suggest-dropdown .jstree > ul > li { - margin-left: 0px; -} -.mage-suggest-dropdown .jstree a { - padding: 2px 3px; -} -.mage-suggest-dropdown .jstree .jstree-hovered { - border: none; - background: #efefef; -} -.mage-suggest-dropdown .jstree .jstree-clicked { - border: none; - background: #e5e5e5; -} -.mage-suggest-dropdown .category-path { - color: #777777; - margin-left: 7px; - font-size: 11px; -} -.mage-suggest-dropdown .ui-menu { - float: none; -} -.mage-suggest-dropdown .ui-menu .ui-menu-item{ - margin: 0px; -} - -/* Footer */ -.footer .bug-report { float:left; width:35%; text-align:left; } -.footer .legality { float:right; width:35%; min-height:19px; padding-left:22px; text-align:right; } - -/* COLUMNS -********************************************************************************************/ - -.catalog-categories .side-col { width:25em; padding-right:25px; } /* Catalog/Categories */ -.catalog-categories .main-col { padding-left:25px; margin-left:25em; } /* Catalog/Categories */ -.order-summary .side-col { padding-right:25px; } /* Order/Create */ -.order-summary .main-col { padding-left:25px; } /* Order/Create */ - - -/* HEADINGS -********************************************************************************************/ - -/* Content Header */ -.content-header { margin-bottom:18px; -webkit-box-sizing:border-box; -moz-box-sizing:border-box; box-sizing:border-box; border-bottom:4px solid #dfdfdf; padding-bottom:.25em; padding-top: 6px; } -.content-header table { width:100%; } -.content-header h3 { float:left; margin:.3em .5em 0 0; color:#eb5e00; font-size:1.25em; line-height:1.2em; } -.content-header .head h3 { float:none; } -.content-header .button-set { white-space:nowrap; text-align:right; } -.content-header .content-buttons { white-space:nowrap!important; margin:0; } -.content-header td.content-buttons { width:13%;white-space:nowrap!important; margin:0; } -.content-buttons button, -.content-header button, -.filter-actions button { margin:0 0 0 5px; } -.side-col .content-header { border-bottom:0; margin-right:12px; margin-bottom:.6em; } -.catalog-categories .side-col .content-header { margin-right:0; } /* Catalog/Categories */ - -.left-col-block { width:200px; } - -.content-header.fixed { padding:6px 8px; margin-bottom:0; border:0; position:fixed; left:0; top:0; width:100%; border-bottom:solid 1px #988753; z-index:100; z-index:auto\9; background:#fdfaa4; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=85)"; opacity:.85; z-index: 100; } -.content-header.fixed button { margin-top:3px; } -.content-header.fixed .content-buttons { float:right; } -.content-buttons { margin-bottom:5px; float:right; display:inline; white-space:nowrap; } -.content-header.fixed .form-buttons { padding-right:20px; } -.content-header.fixed h3 { margin: 0 0 0 20px; display:inline; } - - -/* Box Head */ -.box-head { margin-bottom:.6em; text-align:right; } -.box-head h4 { float:left; margin-bottom:0; } - - -/* Icon Head */ /* Headings with icon preceding text*/ -.icon-head { min-height:18px; background-repeat:no-repeat; background-position:0 0; padding-left:22px; } -.head-customer-address-list { background-image:url(../images/fam_house.gif); } -.head-edit-form { background-image:url(../images/fam_page_white.gif); } -.head-customer-view { background-image:url(../images/fam_status_online.gif); padding-left:18px; } -.head-customer, -.head-customer-groups { background-image:url(../images/fam_group.gif); } -.head-user { background-image:url(../images/fam_user.gif); } -.head-user-edit { background-image:url(../images/fam_user_edit.gif); } -.head-user-comment { background-image:url(../images/fam_user_comment.gif); } -.head-comment { background-image:url(../images/fam_comment.gif); } -.head-cart { background-image:url(../images/fam_cart.gif); } -.head-account { background-image:url(../images/fam_account.gif); } -.head-online-visitors { background-image:url(../images/fam_monitor.gif); } -.head-products { background-image:url(../images/fam_package.gif); } -.head-catalog-product { background-image:url(../images/fam_package.gif); } -.head-newsletter-queue { background-image:url(../images/fam_newspaper_go.gif); } -.head-newsletter-list { background-image:url(../images/fam_newspaper.gif); } -.head-newsletter-report { background-image:url(../images/fam_newspaper_error.gif); } -.head-tag, .head-tag-product { background-image:url(../images/fam_tag_orange.gif); } -.head-sales-order, -.head-sales-invoice { background-image:url(../images/fam_folder_table.gif); } -.head-categories { background-image:url(../images/fam_folder_database.gif); padding-left:20px; color:#253033 !important; } -.head-catalog-product-attribute { background-image:url(../images/fam_rainbow.gif); padding-left:24px; } -.head-product-attribute-sets { background-image:url(../images/fam_folder_palette.gif); padding-left:23px; } -.head-tax { background-image:url(../images/fam_money_add.gif); } -.head-cms-page, .head-cms-block { background-image:url(../images/application_view_tile.gif); } -.head-backups-control { background-image:url(../images/fam_server_database.gif); } -.head-money, .head-promo-quote { background-image:url(../images/fam_money.gif); } -.head-shipping-address, -.head-billing-address { background-image:url(../images/fam_house.gif); } -.head-shipping-method { background-image:url(../images/fam_lorry.gif); } -.head-payment-method { background-image:url(../images/fam_creditcards.gif); } -.head-order-date { background-image:url(../images/fam_calendar.gif); } -.head-customer-sales-statistics { background-image:url(../images/fam_money.gif); } -.head-notification { background-image:url(../images/fam_folder_table.gif); } -.head-compilation { background-image:url(../images/fam_package_go.gif); } - - - -/******************************************************************************/ -/********************************* PAGE SPECIFIC ******************************/ -/******************************************************************************/ - - -/* LOGIN -*******************************************************************************/ -#page-login { background:#f8f8f8; text-align:center; } -.login-container { width:581px; margin:170px auto; padding-left:32px; background:url(../images/login_logo.gif) no-repeat; } -.login-form { padding:27px 57px 35px 57px; background:url(../images/login_box_bg.jpg) no-repeat; text-align:left; } -.login-form .input-left { float:left; } -.login-form .input-right { float:right; } -.login-form .input-box input.input-text { width:224px; } -.login-form h2 { font-size:1.7em; font-weight:normal; } -.login-form label { font-weight:bold; } -.login-form .form-buttons { margin:12px 0 0 0; clear:both; text-align:right; } -.login-box .bottom { width:581px; height:5px; background:url(../images/login_box_bottom.jpg) no-repeat; overflow:hidden; } -.login-container .legal { margin:0; background:url(../images/login_box_legal_bg.gif) no-repeat; padding:8px 8px 5px 8px; font-size:.95em; } -.login-form .validation-advice, -.login-form label.mage-error { margin:3px 0 0 0; } -.login-form .forgot-link { margin:0 17px 0 0; text-align:right; } -.login-form .captcha { padding:10px 0 0; } -.login-form .captcha-image { border:1px solid #aaa; margin:1.5em 0 0; position:relative; } -.login-form .captcha-image img { vertical-align:bottom; } -.login-form .captcha-reload { cursor:pointer; position: absolute; top:2px; right:2px; } -.login-form .captcha-reload.refreshing { animation:rotate 1.5s infinite linear; -webkit-animation:rotate 1.5s infinite linear; -moz-animation:rotate 1.5s infinite linear; } - -@-webkit-keyframes rotate { - 0% { -webkit-transform:rotate(0); } - 0% { -webkit-transform:rotate(360deg); } -} -@-moz-keyframes rotate { - 0% { -moz-transform:rotate(0); } - 0% { -moz-transform:rotate(360deg); } -} -@keyframes rotate { - 0% { transform:rotate(0); } - 0% { transform:rotate(360deg); } -} - - -/* DASHBOARD -*******************************************************************************/ -.dashboard-container { border:1px solid #ccc; } -.dashboard-container .switcher { margin-bottom:0; border:0; } - -/* STORE MANAGEMENT -*******************************************************************************/ -.adminhtml-system-store-deletestore .content-footer .content-buttons, -.adminhtml-system-store-deletegroup .content-footer .content-buttons, -.adminhtml-system-store-deletewebsite .content-footer .content-buttons { float:left; } - - -/* SALES -*******************************************************************************/ - -/* Disabled block */ -.overlay span { display:block; width:100%; text-align:center; position:absolute; top:50%; margin:-5px 0 0; color:#000; } - -/* Prices */ -.price { white-space:nowrap !important; } - -/* Incl tax (for order tables) */ -.price-incl-tax { display:block; } -.price-incl-tax .label { display:block; white-space:nowrap; } -.price-incl-tax .price { /*display:block;*/ font-weight:bold; } - -/* Excl tax (for order tables) */ -.price-excl-tax { display:block; } -.price-excl-tax .label { display:block; white-space:nowrap; } -.price-excl-tax .price { /*display:block;*/ font-weight:bold; } - -/* Orders / Invoices / Shipments / Credit Memos Table */ -.order-tables td h5.title { font-size:1em; font-weight:bold; } -.order-tables td .option-label { font-weight:bold; font-style:italic; } -.order-tables td .option-value { padding-left:10px; } -.order-tables td .qty-table { border:0 !important; width:100% } -.order-tables td .qty-table td { border:0 !important; padding:0 4px !important; } - -dl.item-options dt { font-weight:bold; font-style:italic; } -dl.item-options dd { padding-left:10px; } - -ul.item-options li { padding-left:.7em; } - - -/* Create Order */ -.page-create-order .side-col { width:260px; background:none; padding:0; } -.page-create-order .main-col { padding-left:28px; } -.page-create-order .switcher { margin-bottom:25px; } -.create-order-sidebar-container { border:1px solid #d6d6d6; background:#fafafa; } -.create-order-sidebar-block .content { margin:0 !important; padding:4px 6px; } -.create-order-sidebar-block .head { border-top:1px solid #ddd; background:#ececec; padding:2px 6px 1px; font-size:.9em; text-align:right; } -.create-order-sidebar-block .head h5 { float:left; margin:0; color:#2c464f; text-align:left; } -.create-order-sidebar-block .content table td, -.create-order-sidebar-block table th { padding:0 3px 0 0; } -.create-order-sidebar-block select { width:170px; } -.create-order-sidebar-block ul { margin-left:20px; } -.order-choose-address { margin:0 0 10px 0;padding:8px 15px;background:#e7efef; } /*Address Selector */ -.order-save-in-address-book { margin:0 0 0 0;padding:8px 15px;background:#e7efef; } /* Save in Address Book Checkbox */ -.entry-edit .content .form-list { width:100%; } - -.entry-edit .order-address td.label label { width:100px; } -.entry-edit .order-address input.input-text, -.entry-edit .order-address .textarea { width:95% !important; } -.entry-edit .order-address .select { width:96.5%; } -.entry-edit .order-address .validate-vat { text-align:right; padding:10px 0 0; width:96%; } -.order-search-items .entry-edit .grid { height:610px; overflow:auto; } -.order-search-items .entry-edit .grid table { width:99.9%; } -/* .create-order-totals { background:url(../images/bg_create_order_totals.gif) repeat-y 50% 0 !important; } */ - -/* Product Configuration Popup */ -#popup-window-mask, -.popup-window-mask { background:url(../images/bg_window_mask.png) repeat 0 0; background:rgba(239, 239, 239, 0.5); position:absolute; top:0; right:0; bottom:0; left:0; width:100%; height:100%; z-index:399; } -.product-configure-popup { background:#fafafa; border:1px solid #d6d6d6; left:50%; margin:0 0 0 -271px; position:fixed; top:50%; width:540px; z-index:400; } -.product-configure-popup .validation-advice, -.product-configure-popup label.mage-error { margin-left:0; } -#product_composite_configure_messages { margin-left:0 !important; padding:10px 15px; } -.product-configure-popup .content { max-height:400px; overflow:auto; } -.product-configure-popup .content .grid { padding:0; } -.product-configure-popup .content .grid table { border-bottom:1px solid #CBD3D4; } -.product-configure-popup .product-options { border-bottom:1px solid #e7e7e7; margin:0 0 15px; padding:0 0 12px; } -.product-configure-popup .product-options .required { color:#333 !important; font-weight:normal !important; } -.product-configure-popup .product-options .required em { color:#d40707; } -.product-configure-popup .last-fieldset .product-options { border:0 none; margin-bottom:0; padding-bottom:0; } -.product-configure-popup .buttons-set { margin:0; padding:10px; } -.product-configure-popup .buttons-set button { margin:0 0 0 5px; } - -/* Gift Card Product */ -.giftcard-form .availability { font-weight:bold; margin-bottom:1em; } -.giftcard-form .in-stock { color:#1b6800; } -.giftcard-form .out-of-stock { color:#cf3a00; } -.giftcard-form .price-box { margin:1em 0; } -.giftcard-form label { float:left; width:25%; } - -.giftcard-amount-form { margin:0 0 10px; } -.giftcard-amount-form li { overflow:hidden; width:100%; } -.giftcard-amount-form .field { overflow:hidden; margin-bottom:10px; width:100%; } -.giftcard-amount-form .form-list .input-text { width:70px; } -.giftcard-amount-form .form-list select { width:150px; } -.giftcard-amount-form .form-list .input-box { float:left; width:75%; } -.giftcard-amount-form .form-list .input-box .v-fix { white-space:nowrap; } -.giftcard-amount-form .form-list .input-box p.notice { margin:5px 0 0; font-size:11px; white-space:nowrap; } -.giftcard-amount-form .form-list .input-box p.notice span { display:block; margin-right:5px; } - -.giftcard-send-form .field { overflow:hidden; margin-bottom:10px; width:100%; } -.giftcard-send-form .field .input-text { width:98%; } -.giftcard-send-form .form-list .input-box { float:left; width:75%; } -.giftcard-send-form .form-list textarea { height:100px; width:98%; } - -/* Product Options */ -.product-options { margin:10px 0 0; } -.product-options dt label { font-weight:bold; font-size:12px; } -.product-options dt .qty-holder { float:right; } -.product-options dt .qty-holder label { vertical-align:middle; } -.product-options dt .qty-disabled { background:none; border:0; padding:3px; color:#000; } -.product-options dd { margin:5px 0 15px; padding:0 0 12px; border-bottom:1px solid #e7e7e7; } -.product-options dd.last { border-bottom:0; margin-bottom:0; padding-bottom:0; } -.product-options dd .input-box { display:block; } -.product-options dd input.input-text { width:98%; } -.product-options dd input.datetime-picker { width:150px; } -.product-options dd .time-picker { display:-moz-inline-box; display:inline-block; padding:2px 0; vertical-align:middle; } -.product-options dd .time-picker select { vertical-align:middle; } -.product-options dd textarea { width:98%; height:8em; } -.product-options dd select { width:100%; } -.product-options .options-list {} -.product-options .options-list li { vertical-align:middle; margin:0; padding:2px 0; line-height:1.315; } -.product-options .options-list input.radio { float:left; margin:2px -18px 0 0; } -.product-options .options-list input.checkbox { float:left; margin:2px -20px 0 0; } -.product-options .options-list .label { display:block; margin-left:20px; } -.product-options li { margin:3px 0; } - -/* Wishlist Bundle Product Options */ -.bundle-product-options { padding:5px 0 0 13px; } -.bundle-product-options dl { padding:5px 0 0 15px; } -.bundle-product-options dt { color:#111; } -.bundle-product-options dd { color:#5b5b5b; margin-bottom:10px; } - -/* Order Totals */ -.order-totals { margin-left:auto; border:1px solid #d7c699 !important; padding:12px 0; background:#fcfac9; text-align:right; } -.order-totals table { border:none; background:none; margin-left:auto; } -.order-totals table td { padding:3px 20px 3px 10px; } -.order-totals table td.label { white-space:normal; padding:3px 10px 3px 20px; } -.order-totals table td.last { padding:2px 6px; } -.order-totals-bottom { padding:0 20px; } -.order-totals table .validation-advice, -.order-totals table label.mage-error { text-align:right; white-space:nowrap; background-position:100% 1px; padding-right:14px; padding-left:0; } -.grand-total, .grand_total { font-size:1.2em; font-weight:bold; color:#eb4d00 !important; } - -/* Shopping cart total summary row expandable to details */ -.summary-total { cursor:pointer; } -.summary-total td { padding-top:5px !important; padding-bottom:5px !important; } -.summary-total .summary-collapse { float:right; padding-left:20px; background:url(../images/bg_collapse.gif) 0 4px no-repeat; text-align:right; cursor:pointer; } -.show-details .summary-collapse { background-position:0 -52px; } -.show-details td { border-top:1px solid #eae1b2; } -.summary-details td { font-size:11px; background-color:#fdfcdf; } -.summary-details-first td { border-top:1px solid #eae1b2; } - -/* Order Constants */ -.payment-methods dt { margin-bottom:3px; } -.payment-methods dd { margin-left:20px; } -.payment-methods .validation-advice, -.payment-methods label.mage-error { margin-left:2px; } - -/* Cards List */ -.cards-list .offset { margin-left:10px; } -.cards-list .info-table td { padding:2px 7px 2px 0; text-align:left; vertical-align:top; } - -.release-amounts { margin:0.5em 0; } - -/* Centinel */ -.centinel .authentication { background:#fff; } -.centinel .authentication iframe { width:99%; height:400px; background:transparent !important; margin:0 0 7px !important; padding:0 !important; border:1px solid #ddd !important; } - -/* Gift Messages */ -.giftmessage-order-create .entire-order, -.giftmessage-order-create .each-order-item { background-color:#eee; padding:6px 14px; height:275px; } -.giftmessage-order-create .entire-order .entry-edit, -.giftmessage-order-create .each-order-item .scroll { height:250px; overflow:auto; } -.giftmessage-order-create .single { width:100%; float:left; padding:1.2em 1.5em; } -.giftmessage-order-create h5 { font-size:12px; font-weight:normal; line-height:1.5; margin-bottom:10px; } -.giftmessage-order-create h6 { font-size:11px; font-weight:normal; line-height:1.55; background-color:#cfcfcf; margin-bottom:10px; padding:2px 6px; width:95%; } -.giftmessage-order-create .fieldset { padding:0; } -.giftmessage-order-create .form-list { width:100%; } -.giftmessage-order-create .form-list td.label label { width:100px; } -.giftmessage-order-create .form-list td.value input.input-text, -.giftmessage-order-create .form-list td.value textarea { width:95%; } - -.giftmessage-single-item { padding:0 !important; } -.giftmessage-single-item .item-container { cursor:auto; } -.giftmessage-single-item .item-text { padding:2px 4px; } -.giftmessage-single-item .gift-form { margin-top:3px; background:#f7f6f4 url(../images/gift-message-grid-column-bg.gif) 0 0 repeat-x; } -.giftmessage-single-item .gift-form .entry-edit fieldset { border:none !important; margin-bottom:0; background:none !important; padding:15px; } -.giftmessage-single-item .gift-form .entry-edit fieldset .last { margin-bottom:0; } -.giftmessage-single-item .gift-form .entry-edit input.input-text { width:75% !important; } -.giftmessage-single-item .gift-form .entry-edit textarea { width:96% !important; } -.giftmessage-single-item .action-link-holder {} -.giftmessage-single-item .action-link { padding-right:10px; background:url(../images/gift-message-expand.gif) 100% 50% no-repeat; cursor:pointer; } -.giftmessage-single-item .open { background:url(../images/gift-message-collapse.gif) 100% 50% no-repeat; } - -.giftmessage-whole-order-container .entry-edit input.input-text { width:280px !important; } -.giftmessage-whole-order-container .entry-edit textarea { width:99% !important; padding:2px 3px; } -.giftmessage-whole-order-container .entry-edit label { width:121px; } - -/* PayPal */ -ul.tabs a.paypal-section, -ul.tabs a.paypal-section:hover { background:url(../images/tabs_span_bg.gif) repeat-x 0 100%; border-bottom:none; padding:0.5em 0.5em 0.28em 1.5em; } - -/* Packaging for Shipping Popup */ -#popup-window-mask, -.popup-window-mask { background:url(../images/bg_window_mask.png) repeat 0 0; background:rgba(239, 239, 239, 0.5); position:absolute; top:0; right:0; bottom:0; left:0; width:100%; height:100%; z-index:399; } -.packaging-window, -.packed-window { background:#fafafa; border:1px solid #d6d6d6; left:50%; margin:-200px 0 0 -471px; position:fixed; top:50%; width:1100px; z-index:400; -webkit-box-shadow: 0px 3px 5px #ccc; -moz-box-shadow:0px 3px 5px #ccc; box-shadow:0px 3px 5px #ccc; z-index:400; } -.packaging-window .entry-edit-head { padding:3px 5px; } -.packaging-window .entry-edit-head button { float:right; } -.packaging-window .messages { border:1px solid #f16048; color:#df280a; background:#faebe7 url(../images/error_msg_icon.gif) no-repeat 10px 10px; font-weight:bold; margin-bottom:10px; padding:10px 10px 10px 35px; } -.packaging-window .validation-failed { background:#fef0eD; border:1px dashed #D6340E; } -.packaging-window .packaging-content { overflow:auto; height:400px; height:auto !important; max-height:400px; margin:0 0 10px; padding:10px 10px 0; } -.packaging-window .package-block { background:#f6f6f6; border:2px solid #d4d4d4; margin:0 0 10px; padding:10px; } -.packaging-window .package-options { width:100%; border-top:1px solid #ccc; padding:10px 0 0; margin:3px 0 0; } -.packaging-window .package-options td { vertical-align:middle; } -.packaging-window .package-options select { width:130px; } -.packaging-window .package-options .input-text { width:50px; } -.packaging-window .package_prapare { margin-bottom:15px; } -.packaging-window .package-options .customs-value { width:80px; } -.packaging-window .package-options .options-weight { width:75px; } -.packaging-window .package-options .options-units-weight { width:45px; } -.packaging-window .package-options .options-units-dimensions { width:45px; } -.packaging-window .package-options .options-content-type { width:120px; } -.packaging-window .package-options input[type=text].disabled { background:#eee; } -.packaging-window .package-options select.disabled { background:#eee; } -.packaging-window .package-options-contents { border-top:0; } -.packaging-window .package-add-products { border-top:1px solid #ccc; padding:10px 0 0; margin:10px 0 0; } -.packaging-window .package-add-products .grid { padding:0; } -.packaging-window .package-add-products .grid button { vertical-align:middle; } -.packaging-window .package-number {font-weight: bold;} -.packaging-window .package-number span {margin-left: 5px;} - -.packed-window .entry-edit-head { padding:3px 5px; } -.packed-window .packed-content { padding:10px 10px 0; overflow:auto; max-height:400px; } -.packed-window .package { background:#fefefe; border:7px solid #d5d5d5; margin-bottom:10px; padding:10px; } -.packed-window .package h4 { background:#fefefe; border:solid #ccc; border-width:0 0 1px 1px; float:right; color:#222; font-size:12px; margin:-10px -10px 0 0; padding:5px 10px; position:relative; z-index:100; } -.packed-window .package strong{ display:block; padding:0 0 3px; } -.packed-window .package .grid { padding:0; } -.packed-window .package-info { background:#f3f3f3; border-bottom:1px solid #ccc; margin:-10px -10px 10px; padding:5px 10px; position:relative; } -.packed-window .package-options { width:60%; } -.packed-window .package-options td, -.packed-window .package-options th { padding:1px 0; } -.packed-window .buttons-set { padding-right:5px; } - - -/* CATALOG -*******************************************************************************/ - -/* Category */ -.categories-side-col .content-header { padding:0; } -.categories-side-col .content-header h3 { float:none; } -.categories-side-col .content-header button { margin:5px 0 0; } -.categories-side-col .switcher { margin:10px 20px 0 0; } -.categories-side-col .tree-actions { text-align:center; margin:10px 20px 10px 0; } -.categories-side-col .tree-holder { margin-right:20px; } - -.no-active-category a span { color:#aaa !important; } - -#tree-div { overflow:auto!important; padding-bottom:15px; width:200px; } - -.x-tree-node { margin:0 !important; } -.x-tree-node .leaf .x-tree-node-icon { background-image:url(../images/fam_leaf.png); } -.x-tree-node .system-leaf .x-tree-node-icon { background-image:url(../images/fam_application_form_delete.png); } -.x-tree-node-ct { overflow:hidden; } - -/* Product - Websites */ -.website-name .checkbox { vertical-align:top; margin-top:2px; } -.webiste-groups { padding:10px 20px; } -.group-stores { padding:2px 10px; } - -/* Products - Bundles */ -.bundle-option-row table tbody td { white-space:nowrap; } -.bundle-option-row table tbody td label { float:left; } -.bundle-option-row input.option-label { width:50% !important; } -.bundle-option-row input.option-position{ width:70px !important; } -.catalog-categories .side-col { width:240px; } - -/* Products - Tier Price */ -.tier-price-input { margin-bottom:8px; } -.tier-price-input input.price { width:80px; margin-right:10px; } -.tier-price-input input.qty { width:80px; } -.tier-price-input .tier-container { position:relative; clear:both; } -.tier-price-input .tier-container div { float:left; } -.tier-price-input .tier-container label { width:30px; margin:0; padding:0; } -.tier-price-input .validation-advice, -.tier-price-input label.mage-error { margin:0; height:25px; } -.tier-price-input .custgroup-div select { width:auto; padding:0; } -.tier-price-input .qty-div { padding-left:20px; } -.tier-price-input .price-div { padding-left:20px; } -.tier-price-input .price-div .validation-advice, -.tier-price-input .price-div label.mage-error { margin:0; } -.btn-remove-tier-group { float:right; right:24px; top:5px; } - -/* Product - Gallery */ -.image-preview { position:absolute; cursor:pointer; } - -/* Attributes */ -.edit-attribute-set .form-list td.label { width:105px; } -.edit-attribute-set .form-list td.label label { width:105px; } -.edit-attribute-set .entry-edit fieldset input.input-text { width:200px; } -/* Review & Ratings */ -.ratings { margin:0; } -.rating-box { - float:left; - position:relative; - width:69px; - height:16px; - margin:0 5px 3px 0; - background:url(../images/product_rating_blank_star.gif) repeat-x; - } -.rating-box .rating { - position:absolute; - top:0; - left:0; - height:16px; - background:url(../images/product_rating_full_star.gif) repeat-x; - } -.field-row .ratings { width:120px; float:left; clear:right; } -.field-row .ratings-container { width:250px; float:left; } -.product-review-box { width:450px; } -.product-review-box table { width:100%; } -.product-review-box td, -.product-review-box th { text-align:center; padding-right:5px; } -.product-review-box td.label { width:100px; text-align:left; } - - -/* Price Rules */ -.rule-tree ul { padding-left:16px !important; border-left:dotted 1px #888; } -.rule-tree .x-tree ul { padding-left:0 !important; border-left:none !important; } -.rule-param .label { font-weight:bold; color:black; } -.rule-param .label:hover { font-weight:bold; color:blue; } -.rule-param .label-disabled { color:black; cursor:default; text-decoration:none; } -.rule-param .label-disabled:hover { color:black;} -.rule-param .element { display:none; } -.rule-param input, -.rule-param select { width:auto !important; min-width:170px; } -.rule-param select.multiselect { vertical-align:top; } -.rule-param-edit .label { display:none; } -.rule-param-edit .element { display:inline; } -.rule-param-add { font-weight:normal; color:green; text-decoration:none; } -.rule-param-add:hover { font-weight:normal; color:blue; text-decoration:none; } -.rule-param-apply { font-weight:normal; color:green; text-decoration:none; } -.rule-param-apply:hover { font-weight:normal; color:blue; text-decoration:none; } -.rule-param-remove { font-weight:normal; color:red; text-decoration:none; } -.rule-param-remove:hover { font-weight:normal; color:blue; text-decoration:none; } -.rule-chooser { border:solid 1px #CCC; margin:5px; padding:5px; display:none; } -.rule-param-wait { padding-left:20px; background-image:url(../images/rule-ajax-loader.gif); background-repeat:no-repeat; background-position:0 50%; } - -/* Product Customer Defined options */ -.custom-options .box {padding:0 1.5em; } -.custom-options .option-box {border:1px solid #cddddd; padding:1em; background:#e7efef; margin:1.5em 0; } - -.custom-options .option-header {border:0; width:100%; background:#e7efef; border-bottom:1em solid #e7efef; } -.custom-options .option-header .input-text, -.custom-options .option-header .select {width:95%; } -.custom-options .option-header th {padding:2px; } -.custom-options .option-header td {padding:5px 2px; } - -.custom-options .opt-title {width:175px; } -.custom-options .opt-type {width:150px; } -.custom-options .opt-req {width:80px; } -.custom-options .opt-order {width:60px; } - -.custom-options .option-box .border {width:615px; } - -.custom-options th {white-space:nowrap; } -.custom-options .type-title {width:auto; } -.custom-options .type-price {width:60px; } -.custom-options .type-type {width:80px; } -.custom-options .type-uqty {width:100px; } -.custom-options .type-sku {width:150px; } -.custom-options .type-order {width:60px; } -.custom-options .type-butt {width:33px; } -.custom-options .type-last {width:auto; } - -.custom-options .option-box .border input.input-text, -.custom-options .option-box .border select.select { width:90% !important; } - -.custom-options .option-box .border .type-last input.input-text { width:60px !important; } -.custom-options .option-box .border input.type-sku {width:150px !important; } - -/* Bundle product */ -.bundle .option-box {padding-bottom:2em; } -.bundle .option-box .border {width:100%; border-bottom:0; } -.bundle .option-box .border td {border-bottom:1px solid #dce5e6!important; } -.bundle .option-title {padding:0 0 10px; border-bottom:1px solid #cddddd; } -.bundle .option-title button {float:right; } -.bundle .option-title label {font-weight:bold; line-height:21px; padding-right:1em; float:left; } -.bundle .option-title .input-text {float:left; width:260px; vertical-align:middle; } -.bundle .option-header {clear:both; margin-top:5px; } - -.bundle .border .last {width:33px; } - -/* Downloadable Product */ -.files { width:195px; } -.files input.input-text { float:left; width:134px !important; } -.files-wide { width:355px; } -.files-wide input.input-text { float:left; width:294px !important; } -.files label, -.files-wide label { float:left; width:55px; } -.files .row, -.files-wide .row { margin-bottom:5px; } -/* Files Uploader */ -.files .flex, -.files-wide .flex { float:right !important; position:static !important; } -.files .uploader, -.files-wide .uploader { float:left; overflow:hidden; } -.files .uploader { width:100px; } -.files-wide .uploader { width:260px; } -.files .uploader .file-row-info, -.files-wide .uploader .file-row-info, -.files .uploader .file-row-narrow, -.files-wide .uploader .file-row-narrow { margin:0 !important; } -.progressbar { height: 20px; } -.upload-progress { background-color: #fcffac; } -.upload-success { background-color: #E4FFB1; } -.upload-failure { background-color: #FF7E77; } - -td.input-price { white-space:nowrap; } -td.input-price .validation-advice, -td.input-price label.mage-error { white-space:normal; } -td.input-price input.input-text { width:4em !important; } - -input.sort { width:4em !important; } -input.downloads { width:6.5em !important; } - -/* CUSTOMER -*******************************************************************************/ - -/* Addresses */ -.address-list { width:28em; padding-right:22px; } -.address-list address { width:100%; overflow:hidden; } -.address-list .btn-edit-address, -.address-list .btn-remove-address { position:absolute; top:8px; } -.address-list .btn-edit-address { right:8px; } -.address-list .btn-remove-address { right:27px; } -.address-list li { position:relative; padding:12px 14px; cursor:pointer; border-top:1px solid #e6e6e6; background:url(../images/address_list_li.gif) repeat; } -.address-list li.on { background:#e7efef; } -.address-list li.over { background-color:#fcf5dd; } -.address-list li table { width:100%; } -.delete-address { float:right; margin:0 0 10px 10px; } -.address-type .address-type-line { display:block; margin:2px 0; } -.address-type .address-type-line input { margin-right:3px; } - - - -/* NEWSLETTER -*******************************************************************************/ -.template-preview { width:100%; height:200px; background-color:#fff; } - - -/* SYSTEM -*******************************************************************************/ -.stores-tree td { padding-top:3px !important; padding-bottom:3px !important; } -.stores-tree td.label label { display:inline; width:auto; padding-right:10px; } -.stores-tree td.website-label label { font-weight:bold; } -.stores-tree td.store-group-label label { font-weight:bold; padding-left:15px; } -.stores-tree td.store-label label { padding-left:30px; } -.stores-tree .buttons-set { margin:10px 0; } - -.log-details { border:1px solid #d6d6d6; padding:15px; background:#fafafa; margin:0 0 15px; } -.log-details table { width:100%; } -.log-details table th, -.log-details table td { padding-top:4px; padding-bottom:4px; vertical-align:middle; } -.log-details table th { font-weight:bold; padding-right:30px; white-space:nowrap; } - -.sync-indicator { margin-left:5px; margin-right:5px; position:absolute; white-space:nowrap; } -.sync-indicator img, -.sync-indicator span { vertical-align:middle; } - -/* Configuration */ -/*fieldset.config td { padding-top:5px; padding-bottom:5px; } -fieldset.config input.input-text { width:250px; } -fieldset.config select.select { width:256px; }*/ -div.tree_item, -div.tree_item_last { background-position:left; background-repeat:no-repeat; padding-left:20px; } -div.tree_item { background-image:url(../images/tree_icons/join.gif); } -div.tree_item_last { background-image:url(../images/tree_icons/joinbottom.gif); } -div.tree_line { position:absolute; left:0; background-image:url(../images/tree_icons/line.gif); } -img.attribute-global { width:16px; height:16px; vertical-align:middle; } - -ul.config-tabs { border-top:none; } -ul.config-tabs dt { - border-top:1px solid #849ba3; - background:#d1dedf url(../images/config_tab_dt_bg.gif) no-repeat 0 50%; - padding:2px 0 2px 1.5em; - font-weight:bold; - text-transform:uppercase; - color:#306375; - } -ul.config-tabs dl { margin-bottom:16px; } -ul.config-tabs a.last span { background-image:none; } - -.inline-table { border:0 !important; } -.inline-table td { border:0 !important; padding:0 5px 5px !important; } - -.system-fieldset-sub-head td { padding:20px 5px 5px 5px; } -.system-fieldset-sub-head h4 { border-bottom:1px solid #ccc; margin:0; } - -.system-tooltip-wrap { float:left; } -.system-tooltip-box { border-left:1px solid #ccc; float:left; line-height:16px; margin-left:5px; padding-left:5px; width:180px; } -.system-tooltip-small { clear:both; border:none; margin:0; padding:5px; width:100%; } - -.comment { padding:5px; } - -/* Import/export */ - -#profile-generator select { width:207px; } -#profile-generator input.input-text { width:200px; } -.field-row .with-tip {display:block; margin-left:150px; } -.field-row .with-tip input {float:none; } -.field-row .with-tip small {display:block;padding-top:2px; } - -#profile-generator .field-row button.delete {vertical-align:middle; } -#profile-generator fieldset button.add {display:inline; margin:0; } - -/** Product mass attribute update **/ - -.attribute-change-checkbox { white-space:nowrap; clear:none; margin-left:5px; } - -.attribute-change-checkbox label{ margin-left:5px; float:none !important; } - -/* PopUp Calendar */ -.calendar { z-index:105; } - -/** Order view **/ -.order-history { width:70%; margin-right:27px; } - -ul.super-product-attributes { padding-left:15px; } - -/** Media Library **/ -.uploader .file-row { width:600px; padding:0.5em 0.6em; margin:0.5em 0.6em; border:1px solid #ccc; background-color:#f9f9f9; /*vertical-align:middle;*/ } -.uploader .file-row-narrow { width: auto; margin: 0 0 2px 40px; } -.uploader .file-row .file-info { float:left; } -/*.uploader .file-row .file-info-name { with: 80%; overflow: hidden; } -.uploader .file-row .file-info-size { width: 20%; }*/ -.uploader .file-row-info { margin: 0 0 0 10px; } -.uploader .file-row-info .file-info-name { font-weight:bold; } -.uploader .file-row .progress-text { float:right; font-weight:bold; } -.uploader .file-row .delete-button { float:right; } -.uploader .buttons { float:left; } -.uploader .flex { float:right; } -.uploader .progress { border:1px solid #f0e6b7; background-color:#feffcc; } -.uploader .error { border:1px solid #aa1717; background-color:#ffe6de; } -.uploader .error .progress-text { padding-right:10px; } -.uploader .complete { border:1px solid #90c898; background-color:#e5ffed; } - -.grid tr.read { background:#fff !important; } -.grid tr.unread { background:#fcf6f5 !important; } -.grid-row-title { color:#444; font-weight:bold; } - -.grid-severity-critical, -.grid-severity-critical span, -.grid-severity-major, -.grid-severity-major span, -.grid-severity-minor, -.grid-severity-minor span, -.grid-severity-notice, -.grid-severity-notice span { display:block; height:16px; background-image:url(../images/bg_notifications.gif); background-repeat:no-repeat; font:bold 10px/16px Arial, Helvetica, sans-serif; text-transform:uppercase; text-align:center; padding:0 0 0 7px; margin:1px 0; white-space:nowrap; color:#fff; } -.grid-severity-critical { background-position:0 0; } -.grid-severity-critical span { background-position:100% 0; padding:0 7px 0 0; } -.grid-severity-major { background-position:0 -16px; } -.grid-severity-major span { background-position:100% -16px; padding:0 7px 0 0; } -.grid-severity-minor { background-position:0 -32px; } -.grid-severity-minor span { background-position:100% -32px; padding:0 7px 0 0; } -.grid-severity-notice { background-position:0 -48px; } -.grid-severity-notice span { background-position:100% -48px; padding:0 7px 0 0; } - -.super-attributes { margin:0; padding:0; } -.super-attributes li.attribute { border:1px solid #dfdfdf; background-color:#ededed; margin:1px 0; } -.super-attributes li.attribute ul.attribute-values { margin:0; padding:0; } -.super-attributes li.attribute div.values-container { width:80%; margin-top:2px; margin-bottom:2px; } -.super-attributes li.attribute-value { display:block; margin:1px 0; } -.super-attributes li.attribute-value .validation-advice, -.super-attributes li.attribute-value label.mage-error { margin:0; white-space:normal; } -.super-attributes li.attribute-value .attribute-value-label-container { width:200px; } - -.super-attributes div.attribute-name-container, -.super-attributes li.attribute div.values-container, -.configurable-simple-product div.values-container, -.super-attributes li.attribute-value .attribute-values-container, -.configurable-simple-product .attribute-values-container, -.super-attributes li.attribute-value .attribute-values-container-main, -.configurable-simple-product .attribute-values-container-main, -.super-attributes li.attribute-value .attribute-value-label-container { display:block; } - -.super-attributes li.attribute-value .attribute-price, -.configurable-simple-product .attribute-price { width:70px !important; } - -.super-attributes li.attribute-value .attribute-price-type, -.configurable-simple-product .attribute-price-type { width:70px !important; } - -.super-attributes div.attribute-name-container { - cursor:move; - background-image:url(../images/arrow_sort_move.gif); - background-repeat:no-repeat; - background-position:4px 50%; - font-weight:bold; - padding-left:15px; - margin-top:2px; - margin-bottom:2px; - } - - -/** Product Gallery Image Previews **/ -.preview .cell-image .place-holder { border:1px solid #AEAEAE; width:100px; height:100px; text-align:center; } -.preview .cell-image .place-holder span { margin-top:30px;display:block; } -.preview .cell-position input.input-text { width:90% !important; } -.fieldset-wide .data .preview .cell-position input.input-text { width:90% !important; } - -.tier .data { width:465px; } -.tier .data select { width:99%; } -.tier .data input.qty { width:20px !important; } - -.weee .data { width:465px; } -.weee .data select { width:99%; } - -.giftcard-amounts .data { width:465px; } -.giftcard-amounts .data select { width:99%; } - -/* Links */ -.link-feed { background:url(../images/icon_feed.gif) no-repeat left 2px; padding-left:18px; } - -#page-help-link { - line-height:26px; - padding-left:20px; - color:#ebebff; - background:url(../images/fam_help.gif) no-repeat 0 50%; - } -#page-help-link:link, #page-help-link:visited { text-decoration:none; } -#page-help-link:hover { color:white; } - -/* Magento Connect Package Extensions */ -.table-editable { border:solid 1px #ccc; background:#fafafa; padding:5px; margin-bottom:5px; } -.table-editable th { border-bottom:solid 1px #ccc; text-align:center; } -.table-editable th, .table-editable td { padding:1px 3px; vertical-align:middle; } -.table-editable select { height:19px; } - - -/* CMS -*******************************************************************************/ -.breadcrumbs { margin: 0 0 10px; } -.breadcrumbs li { display:inline; } -.breadcrumbs li span { margin:0 2px; } - -/*table.mceLayout { width:100% !important; }*/ - -.cms-revision-preview { height:100%; } -.cms-revision-preview iframe { width:100%; height:91%; border:0; } - -/* CMS Widgets Instance */ -.options-box .option-box { border:1px solid #cddddd; padding:1em; background:#e7efef; margin:1.5em 0; } -.options-box .option-title { padding:0 0 10px; border-bottom:1px solid #cddddd; } -.options-box .option-title button { float:right; } -.options-box .option-title label {font-weight:bold; line-height:21px; padding-right:1em; float:left; } -.options-box .option-title select { float:left; width:260px; vertical-align:middle; } -.options-box .option-header { margin:5px 0 0; width:100%; border:0; background:#e7efef; border-bottom:1em solid #e7efef; } -.options-box .option-header .input-text, -.options-box .option-header select { width:95%; } -.options-box .option-header th { padding:2px; } -.options-box .option-header td { padding:5px 2px; } -.options-box .option-header .tree { margin:5px 0 0; } - -/* CMS Popup Window */ -.popup-window .magento_message { padding:0 18px; } -.popup-window .content-header { font-family:Arial, Helvetica, sans-serif; padding-top:9px; } -.popup-window .content-header h3 { color:#eb5e00; padding:0; } -.popup-window { height:auto !important; } -.popup-window .grid { position:static; } -.popup-window .table_window td.value2 .grid td, -.popup-window .table_window td.value2 .grid th { padding:2px 4px !important; } -.popup-window .table_window td.value2 .grid tr.headings th { padding:1px 4px 2px !important; } -.popup-window .columns { background-image:none; } -.popup-window .middle { background:none; padding:10px 0; } - -.popup-window .uploader .file-row { margin:16px 0; width:auto; } -.popup-window #contents-uploader { margin-bottom:10px; background:#d7e5ef; padding:5px 10px; } -.popup-window #contents-uploader .flex { font-size:0; line-height:0; height:20px; } -.popup-window #contents { margin-left:-3px; height:400px; overflow:auto; position:relative; } -.popup-window #contents .filecnt { float:left; border:1px solid #ccc; cursor:pointer; padding:3px; display:inline; margin:0 0 15px 4px; overflow:hidden; position:relative; width:100px; } -.popup-window #contents .selected { border:1px solid #f1af73; background:#f0f0f0; cursor:default; } -.popup-window #contents .nm { text-align:center; } -.popup-window #contents .nm img { vertical-align:bottom; } - -/* Widget Insert */ -#widget_window .magento_content { height:auto !important; min-height:450px; } - -/* CMS Widget Chooser */ -#widget-chooser .columns { background-image:none; } -#widget-chooser .magento_message { padding:10px 18px; } -#widget-chooser .grid th, -#widget-chooser .grid td { padding:2px 4px 2px 4px; } -#widget-chooser .grid tr.filter th { padding-top:5px; padding-bottom:5px; } -#widget-chooser .side-col { padding-top:0.5em; } -#widget-chooser .main-col { padding-right:4px; } - -/* CMS Variables Popup */ -#variables-chooser .magento_message { padding:10px 18px; } - -/* Product description WYSIWYG editor */ -#catalog-wysiwyg-editor .buttons-set { margin-top:10px; } -#catalog-wysiwyg-editor .magento_content { height:auto !important; overflow:hidden; } -#catalog-wysiwyg-editor .textarea { width:930px !important; } -#catalog-wysiwyg-editor .magento_message { padding:0 7px; } -#catalog-wysiwyg-editor .magento_buttons { padding-left:7px; padding-right:7px; } - -/* Backups */ -.backup-dialog { background-color:#6f8992; background:rgba(111, 137, 146, 0.5); cursor:default; left:50%; margin:0 0 0 -271px; position:fixed; top:50%; width:470px; padding:8px; z-index:400; -moz-box-shadow:0 0 100px #ccc; -webkit-box-shadow:0 0 100px #ccc; box-shadow:0 0 100px #ccc; } -.backup-dialog .entry-edit { border:1px solid #6f8992; } -.backup-dialog .content { background:#fff; border-bottom:1px solid #ccc; max-height:400px; overflow:auto; } -.backup-dialog .question {margin-top: 15px;} -.backup-dialog .buttons-set { border-top:1px solid #ddd; background:#eee; margin:0; overflow:hidden; padding:7px 10px 8px; width:448px; } -.backup-dialog .buttons-set button { margin:0 0 0 5px; } -.backup-dialog #ftp-credentials-container {margin-top: 25px;} -.backup-dialog .password-box-container {margin-top: 15px;} -.backup-dialog #ftp-credentials-container fieldset {margin-bottom: 0;} -.backup-dialog input[type=text], .backup-dialog input[type=password] {width: 180px} -.backup-dialog .exclude-media-checkbox-container {margin-top: 15px;} -.backup-dialog td.maintenance-checkbox-container {margin-top: 0; padding-top: 4px;} - -/*****************************************/ -/******** ALIGNMENTS AND CLEARS **********/ -/*****************************************/ - -/* Directional and spacial */ -.f-left, .left { float:left; } -.f-right, .right { float:right; } -.v-top { vertical-align:top; } -.v-middle { vertical-align:middle !important; } -.v-bottom { vertical-align:bottom; } -.a-left { text-align:left !important; } -.a-center { text-align:center !important; } -.a-right { text-align:right !important; } -.nm { margin:0 !important; } -.np { padding:0 !important; } -.no-display { display:none; } -.no-show { display:none; } -.nowrap, .nobr { white-space:nowrap; } -.wrap { white-space:normal !important; } -.no-float { float:none !important; } -.pointer { cursor:pointer; } - -/* Color */ -.emph, .accent { color:#eb5e00 !important; } -.subdue { color:#306375; } - -/* Font */ -.bold { font-weight:bold !important; } -.normal { font-weight:normal !important; } - -/* Clear */ /* This keeps our HTML free of buncha clearing elements */ -.side-col .switcher:after, -.message-popup .message-popup-head:after, -.message-popup .message-popup-content .message:after, -.login-form .form-buttons:after, -.wrapper:after, -.option-title:after, -.columns:after, -.main-col:after, -.content-header-floating:after, -.entry-edit .entry-edit-head:after, -.content-header:after, -.login-box .button-set:after, -ul.tabs-horiz:after, -.header-top:after, -dl.accordion dt:after, -.field-100:after, -.entry-edit fieldset li:after, -.entry-edit fieldset span.field-row:after, -.content:after, -#topnav:after, -.main:after, -.container:after, -.footer:after, -.middle:after, -.header:after, -.box-head:after, -div.actions:after, -.tier-container:after, -.clear:after, -.notification-global:after, -.files .row:after, -.files-wide .row:after, -.grid tr.filter .range .range-line:after, -.store-scope:after { display:block; clear:both; content:"."; font-size:0; line-height:0; height:0; overflow:hidden; } diff --git a/app/code/Magento/Webhook/view/adminhtml/css/modal.css b/app/code/Magento/Webhook/view/adminhtml/css/modal.css deleted file mode 100644 index a8912c8fb62714738659c9f97c51c2143b10379e..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/css/modal.css +++ /dev/null @@ -1,110 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -@font-face { - font-family: 'Lucidia Sans Unicode'; - font-weight: normal; - font-style: normal; -} - -.inline { - display: inline-block; - vertical-align: middle; -} - -html, body { - height: 100%; -} - -.hide { - display: none !important; -} - -#activate-subscription>.sh { - background: transparent url("../images/ghost-dark.png") repeat 0% 0%; - padding: 10px; - border-radius: 15px; - -webkit-border-radius: 15px; - -moz-border-radius: 15px; - margin: 0 auto; - width: 450px; - height: 500px; - position: absolute; - z-index: 1000; -} - -#activate-subscription>.sh>.b { - height: 100%; - border-radius: 7px; - -webkit-border-radius: 7px; - -moz-border-radius: 7px; - /*position: relative;*/ -} - -#activate-subscription>.sh>.b>.top { - position: relative; - -webkit-border-top-left-radius: 7px; - -webkit-border-top-right-radius: 7px; - -moz-border-radius-topleft: 7px; - -moz-border-radius-topright: 7px; - border-top-left-radius: 7px; - border-top-right-radius: 7px; - height: 20px; - background: #425e66; - background: -moz-linear-gradient(top, #092023 0%, #425e66 100%); - background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #092023), color-stop(100%, #425e66)); - background: -webkit-linear-gradient(top, #092023 0%, #425e66 100%); - background: -o-linear-gradient(top, #092023 0%, #425e66 100%); - background: -ms-linear-gradient(top, #092023 0%, #425e66 100%); - filter: progid:DXImageTransform.Microsoft.gradient(GradientType = 0, startColorstr = '#092023', endColorstr = '#425e66'); - background: linear-gradient(top, #092023 0%, #425e66 100%); -} - -#activate-subscription>.sh>.b>.top>.close { - display: block; - position: absolute; - top: 4px; - right: 10px; - font-family: Arial, Helvetica, Verdana, sans-serif; - font-size: 0.8em; - color: #f7f7f7; - text-decoration: none; -} - -#activate-subscription>.sh>.b>.top>.close:hover { - color: #fff; - text-decoration: underline; -} - -#activate-subscription>.sh>.b>iframe { - border-radius: 0px 0px 7px 7px; - -webkit-border-radius: 0px 0px 7px 7px; - -moz-border-radius: 0px 0px 7px 7px; - background: #FFF; - width: 450px; - height: 480px; - display: block; -} - diff --git a/app/code/Magento/Webhook/view/adminhtml/css/webhook.css b/app/code/Magento/Webhook/view/adminhtml/css/webhook.css deleted file mode 100644 index a6c209656c2280a39271b22ba95a796494eb7cd3..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/css/webhook.css +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ - -html { - height: 100%; - overflow: hidden; -} - -body { - height: 100%; -} - -body>div:first-child { - height: 100%; -} - -div.outer { - height: 100%; -} - -.section.main { - padding: 1em; -} - -li { - margin-left: 1em; -} - -ul { - padding-left: 1em; -} - -em { - color: #EB5E00; -} - -.red { - color: #EB5E00; -} - -.section { - margin-top: 1em; -} - -div.center { - overflow: auto; - height: 90%; -} - -div.bottom { - border-top: 1px solid #2D444F; - background: #666E73; - width: 100%; - height: 10%; - position: absolute; - bottom: 0px; -} - -div.buttons { - width: 70%; - - margin: 1em auto; -} - -.buttons button { - margin-right: 2em; - margin-left: 2em; -} - -/*.buttons button:last-child,*/ -.buttons button.last-child { - margin-right: 25%; - float: right; -} - -.buttons button:first-child { - margin-left: 25%; - margin-right: 0px; - float: left; -} - -/* Using monospace to make it easier to see how long our keys/secrets really are */ -input.monospace { - font-family: Courier New, monospace; -} - -/* Need this so the form inputs look good in our modal window */ -.api_form input.input-text{ - width: 20em; -} - -.entry-edit .field-row label.error { - float: none; - width: auto; - margin-left: 2em; -} diff --git a/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.gif b/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.gif deleted file mode 100644 index 7463cfd06c6b55c8d4e5735ed22f75beb1e00012..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.png b/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.png deleted file mode 100644 index 17f2f42358d6432528e189f467be7a9c18716e21..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/accordion_close.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.gif b/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.gif deleted file mode 100644 index aaea5003490e3638d202f679caaa10f1797b1747..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.png b/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.png deleted file mode 100644 index 9d5259955e9201c195eb4f2270fbad52688c1837..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/accordion_open.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon-disabled.gif b/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon-disabled.gif deleted file mode 100644 index 213541cabff77b9f7fff02f77c0233097382e1c6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon-disabled.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon.gif deleted file mode 100644 index 0c7645a983d3a86c2c625aa65fc58573c07180dc..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/add_btn_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/address_list_li.gif b/app/code/Magento/Webhook/view/adminhtml/images/address_list_li.gif deleted file mode 100644 index 58776764860191f435315f9873db3a2389285102..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/address_list_li.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/address_list_on_arrow.gif b/app/code/Magento/Webhook/view/adminhtml/images/address_list_on_arrow.gif deleted file mode 100644 index a0afc67cfb248f90e64df258eb7b099a1c71e541..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/address_list_on_arrow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_arrow.gif b/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_arrow.gif deleted file mode 100644 index c7728c62082204672c45268fcdc1be0af9d37837..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_arrow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_bg.gif deleted file mode 100644 index d72815959aa3ade84e8c15a9f10931b36a4e27c3..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/address_list_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader-tr.gif b/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader-tr.gif deleted file mode 100644 index efb7ba77049448a34cd45c8509e5c63f8ac5fb5b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader-tr.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader.gif b/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader.gif deleted file mode 100644 index b525a23bdbb3fecbfac17c7d498decfa5b45f18b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ajax-loader.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/application_view_tile.gif b/app/code/Magento/Webhook/view/adminhtml/images/application_view_tile.gif deleted file mode 100644 index 8965c0e108e084cdf2b8e69d7fc854acb9368317..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/application_view_tile.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/arrow_sort_move.gif b/app/code/Magento/Webhook/view/adminhtml/images/arrow_sort_move.gif deleted file mode 100644 index 9dcb050136e8cf86e8a015525a88f6dcec6055d9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/arrow_sort_move.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bg_collapse.gif b/app/code/Magento/Webhook/view/adminhtml/images/bg_collapse.gif deleted file mode 100644 index 5d21686469609c21366b9fdf80e6bc92c65279fe..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bg_collapse.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bg_create_order_totals.gif b/app/code/Magento/Webhook/view/adminhtml/images/bg_create_order_totals.gif deleted file mode 100644 index 3852cfcd1ee3f0ec61782b7f5a57022ab9e0e909..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bg_create_order_totals.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bg_notifications.gif b/app/code/Magento/Webhook/view/adminhtml/images/bg_notifications.gif deleted file mode 100644 index fb47f6ea7a71bdba54e06b1f26cc5cf688d32cd6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bg_notifications.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bg_window_mask.png b/app/code/Magento/Webhook/view/adminhtml/images/bg_window_mask.png deleted file mode 100644 index 1824283aa64469e44d7104aa9ccc2c244635f0be..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bg_window_mask.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close.gif b/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close.gif deleted file mode 100644 index 11299fabad2143ea57c17ee0c9669245681ddaac..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close2.gif b/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close2.gif deleted file mode 100644 index 24f6252a98ecae743f826b0eb6ddc9b800c909a2..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bkg_btn-close2.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/bkg_search-magnifier.png b/app/code/Magento/Webhook/view/adminhtml/images/bkg_search-magnifier.png deleted file mode 100644 index cc7a26f8b8f7bf643a8ae437686ca8e96ded9f25..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/bkg_search-magnifier.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/blank.gif b/app/code/Magento/Webhook/view/adminhtml/images/blank.gif deleted file mode 100644 index d6e9b014cef6741099e49b0427b487030f3d224a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/blank.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/box_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/box_bg.gif deleted file mode 100644 index 8b51ee0882f8cb89a38f9b5493d4ae64ba61b185..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/box_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/breadcrumb_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/breadcrumb_bg.gif deleted file mode 100644 index 9e82a9099c0e63154a22f34d5bd7bcab71265737..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/breadcrumb_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-image_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_add-image_icon.gif deleted file mode 100644 index 85d971ade82a568d8d93d10f5d367a10be8be94d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-image_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-variable_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_add-variable_icon.gif deleted file mode 100644 index 7f50e6fd7731a2350159d96688cd973211780cfe..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-variable_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon.gif deleted file mode 100644 index 2c06933eebbc0db35ff3a6b2bfc5aea563e7e252..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon2.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon2.gif deleted file mode 100644 index 75055bb71450923311468f9384d57385c2a6e778..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_add-widget_icon2.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_back_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_back_bg.gif deleted file mode 100644 index 0824ca688214ff331a7bee26a4e9694b81de487a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_back_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_bare_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_bare_bg.gif deleted file mode 100644 index 24fc5ba5a63031e8feba479d1dc9d8fc5c48e699..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_bare_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg-disabled.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_bg-disabled.gif deleted file mode 100644 index 3ec0b3154e91aa06087ec36eecd180e03af0d54d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg-disabled.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.gif deleted file mode 100644 index 32d6ca84f3f541bf3a7bf29d9eb67b7f0b403d27..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.png deleted file mode 100644 index 09448f4ab3b0cb2f2b87d0c31fd883a99fa0c490..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_cancel_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_cancel_bg.gif deleted file mode 100644 index a3d92e461f740967cc32aab47fb157ad0b0a5756..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_cancel_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_delete_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_delete_bg.gif deleted file mode 100644 index b0cbd8337dba2f9d4f77169872ee13800895a8f7..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_delete_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_go.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_go.gif deleted file mode 100644 index 30f87d685dd3e9dc8bd02c619026c49200649d7e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_go.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_bg.gif deleted file mode 100644 index d91a78b537f489ee43baeef28397625dace4b425..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_on.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_on.gif deleted file mode 100644 index b9f7bdeedbf052964092bed39af7ceca9ed05e05..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_on.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_over.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_over.gif deleted file mode 100644 index 73afeb6200c4dd4752393730b631114da01382a0..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_gr_over.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_loading-icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_loading-icon.gif deleted file mode 100644 index 7735ef6e5798b95dff4bb9620eaf72c326b5037b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_loading-icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_login.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_login.gif deleted file mode 100644 index 93ed65b587745368989f298dc3720f56b2cfee97..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_login.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_on_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_on_bg.gif deleted file mode 100644 index fc478689f9aa37bd81ba1c457bed19265949a17a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_on_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_over_bg.gif deleted file mode 100644 index 294ff2bfcff1af226e139fb01eb5116b34e620fa..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_show-hide_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_show-hide_icon.gif deleted file mode 100644 index 6670833a4102376c32b151e2eccff5a32903e1b5..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_show-hide_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/btn_task_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/btn_task_bg.gif deleted file mode 100644 index 87280126cb087ad7bb2bd3a0c3d88bc86a49b78d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/btn_task_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/button-close.png b/app/code/Magento/Webhook/view/adminhtml/images/button-close.png deleted file mode 100644 index b02bc1d33bbb753badbf7399d20462dd1fe685c8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/button-close.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_active_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_active_bg.gif deleted file mode 100644 index add491809bafe88cf98604dc059328c7c1b3552c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_active_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_bg.gif deleted file mode 100644 index d52fb2562c179f483538b59f0433a257946b48ee..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_icon.gif deleted file mode 100644 index 976481765e1d64550717dd6ce8cdbadcddfdeeb6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_over_bg.gif deleted file mode 100644 index d24eb118385de13c4b91f7c0f362b6b01e7267eb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/cancel_btn_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/cancel_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/cancel_icon.gif deleted file mode 100644 index 1fd7cfd6a23b77660711f95400ae18e9495bf9d3..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/cancel_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/config_tab_dt_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/config_tab_dt_bg.gif deleted file mode 100644 index 376d898333859ae80ed830551245c8ffb64ccd65..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/config_tab_dt_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/dashboard-close.gif b/app/code/Magento/Webhook/view/adminhtml/images/dashboard-close.gif deleted file mode 100644 index c4b6bbc9f7fa4fda2c9fd2c98799fce3c5011a66..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/dashboard-close.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bg.gif deleted file mode 100644 index 5781f67e63c0fb4991fe8df7349e22e8a7fd1847..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bottom-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bottom-bg.gif deleted file mode 100644 index fca47802095681aacb2dbbeb9dec5f9b914bea8f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-bottom-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line-bg.gif deleted file mode 100644 index 17b2e7b23fb16fffaace705471bc25a40a0e68eb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line2-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line2-bg.gif deleted file mode 100644 index c10bde98dba48117836d15a93b08e165930d6e37..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-line2-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-x-bg.png b/app/code/Magento/Webhook/view/adminhtml/images/db-graph-x-bg.png deleted file mode 100644 index 1f983cd9f0786ba2b296ee512be51cd7fb8478a3..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-graph-x-bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-header-bg.png b/app/code/Magento/Webhook/view/adminhtml/images/db-header-bg.png deleted file mode 100644 index 1dd4993fd49bc5732a2cd3ee8fd691a0392dea6e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-header-bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-hov.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-hov.gif deleted file mode 100644 index ea7b7bd2d7a02287a4e7192ab654015d9b5d7c1f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-hov.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-up.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-up.gif deleted file mode 100644 index 59ca66db0b856aebb294a0a075616c75185efd50..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg-up.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg.gif deleted file mode 100644 index 5bba621a810b9c03e7d66acf5a082ffb786a1882..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep-last.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep-last.gif deleted file mode 100644 index 998916da9c8c4cea36fee440cecd5253103e842d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep-last.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep.gif deleted file mode 100644 index c8974d8ca4db39e972f0ec5e788090ecbcc6f893..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-sep.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-start.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-menu-start.gif deleted file mode 100644 index 11ef78430b8197e0d5307a42870b86b6f6cd22f5..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-menu-start.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-bg.gif deleted file mode 100644 index 2208140ec50f887a585949f72bea0755ed7a4687..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot-roll.png b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot-roll.png deleted file mode 100644 index b52d7868e4b375b1f5ae7cec5559a0306ca3b1db..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot-roll.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot.png b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot.png deleted file mode 100644 index 25f9da7ac20273a378fd48b0a10c4cbfc8816b54..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-bot.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top-roll.png b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top-roll.png deleted file mode 100644 index f3e5f229b82f9cf69f4a670dfb2782ea1dfca596..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top-roll.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top.png b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top.png deleted file mode 100644 index 51a1bcabcc0baeb84616ecae61b53e0d9a451c6a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-but-top.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-roller.png b/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-roller.png deleted file mode 100644 index 55d53b9225b76eb64508979a85e19630635f22cb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-scroll-roller.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-left-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-left-bg.gif deleted file mode 100644 index e8725966d7d2e8fe38580bd0a26ae92512b5b3df..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-left-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-mid-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-mid-bg.gif deleted file mode 100644 index 8464f9a18272673469b17dac2827319751f2d931..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-mid-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-right-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-right-bg.gif deleted file mode 100644 index d4cca0057dd7a01f3b31a6541098dbd22ef98431..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-bottom-right-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-footer.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-footer.gif deleted file mode 100644 index 615cb2ca21bd9197364cb534d9f91ec6c3a2ad86..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-footer.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header-sep.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header-sep.gif deleted file mode 100644 index 038f92c4a48190fd8cb039cf442ebd4ef22b325b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header-sep.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header.gif deleted file mode 100644 index 572aa19741ad550b3a0fbaf432a8dae9a3959d7f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-header.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-left.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-left.gif deleted file mode 100644 index cf39fda5a86ffb37bae798266e924fcb892ef2a6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-left.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-right.gif b/app/code/Magento/Webhook/view/adminhtml/images/db-tab-right.gif deleted file mode 100644 index 435a9e572b4783114932a72de12d309062d7fbd9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/db-tab-right.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_dark.gif b/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_dark.gif deleted file mode 100644 index b4f6c700caf1bc98066c5dc1cbdb4839c0e1a9ca..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_dark.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_light.gif b/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_light.gif deleted file mode 100644 index 538a9262ae8dd234af9e6f086985fe6a110c1f8c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/dotted_divider_light.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/edit_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/edit_icon.gif deleted file mode 100644 index 8b277aa621877b1cd10e1dddb8d57244334f60f1..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/edit_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down.gif b/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down.gif deleted file mode 100644 index ea3aba2a2c61869a2b69f2cae7c8c01fe210a9fa..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down2.gif b/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down2.gif deleted file mode 100644 index 47ff52de0c6bb3025d972fe99ba16be82bca7a43..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_down2.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_up.gif b/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_up.gif deleted file mode 100644 index 4f0f11cf45bd67e43b595c1f1a1a2114e06f6e20..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_arrow_up.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_bg.gif deleted file mode 100644 index 1f6d083278fbfe22c9c885eb7f20685fe41e6486..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/entry_edit_head_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/error-msg.png b/app/code/Magento/Webhook/view/adminhtml/images/error-msg.png deleted file mode 100644 index d9607f0e83875deb0dad0f93bea6301677960790..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/error-msg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/error_msg_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/error_msg_icon.gif deleted file mode 100644 index 9db2351303341d36bef063d1ca7a926be5981aac..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/error_msg_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_account.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_account.gif deleted file mode 100644 index 5ec10006ff2053cd14b81fc3ec169685801c0ae0..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_account.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_application_form_delete.png b/app/code/Magento/Webhook/view/adminhtml/images/fam_application_form_delete.png deleted file mode 100644 index cd305ec83b6a7560de21a287fa7a780bad893efe..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_application_form_delete.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_application_view_tile.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_application_view_tile.gif deleted file mode 100644 index 8965c0e108e084cdf2b8e69d7fc854acb9368317..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_application_view_tile.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_asterisk_orange.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_asterisk_orange.gif deleted file mode 100644 index 46d8baecbcc17c8899d6545c1779d367bee92167..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_asterisk_orange.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_bin.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_bin.gif deleted file mode 100644 index 3cf0aaf9be82f283fef99812ef18ac6ecb6555e9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_bin.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_disk.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_disk.gif deleted file mode 100644 index d72c413e8ef9454af8bb2fbf526bc9a8161979db..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_disk.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_error.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_error.gif deleted file mode 100644 index 0d3b48ab3d34d2633bf465d109c7c111402a4809..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_error.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_success.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_success.gif deleted file mode 100644 index f1be07354b50852cb2b845b034d5ef7637c99675..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_bullet_success.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_calendar.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_calendar.gif deleted file mode 100644 index 3721980f9effac8fab7d947f5f324324776bfa6c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_calendar.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_cart.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_cart.gif deleted file mode 100644 index 7612ea22cd3f66e09b17d706dfa1d260acff4e53..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_cart.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_comment.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_comment.gif deleted file mode 100644 index b2013a17f06ca25400f71973d6d25a190b1ac8b7..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_comment.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_creditcards.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_creditcards.gif deleted file mode 100644 index 86996b7b20425c48c7bff5feb24c25c85ad8cd30..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_creditcards.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_database.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_database.gif deleted file mode 100644 index 0d78a5a0cad0331b2c8719ccb4a4e61ca104fbef..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_database.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_palette.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_palette.gif deleted file mode 100644 index 9f170d1467acd993539cf9f6c16cf23f8d0c196a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_palette.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_table.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_table.gif deleted file mode 100644 index 13acdab3371e5bde473b3297358eb2ccf7491f31..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_folder_table.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_group.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_group.gif deleted file mode 100644 index bef3d22b9c7909ec88fd9b1b339dcff38481763a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_group.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_help.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_help.gif deleted file mode 100644 index b57481ff1bb85202f9653fb6a454471d34ea43de..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_help.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_house.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_house.gif deleted file mode 100644 index 3f9d5fc055343d146587cd8330862d5356ae660b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_house.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_layout.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_layout.gif deleted file mode 100644 index c2172ded0e10cc6e00c208c90acd2bdf9dc67366..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_layout.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_leaf.png b/app/code/Magento/Webhook/view/adminhtml/images/fam_leaf.png deleted file mode 100644 index 9cd988dfb177b2f344368a0a2c8a0e2b551f1cda..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_leaf.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_link.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_link.gif deleted file mode 100644 index 42467ac442ae26f1401e423e8e033c04b5b65dbe..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_link.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_lorry.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_lorry.gif deleted file mode 100644 index b902ce12c782b0bbb77844a736da011a98b9079d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_lorry.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_money.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_money.gif deleted file mode 100644 index ab0babcbfe58ca586a82f70ffb47099c63b78420..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_money.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_money_add.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_money_add.gif deleted file mode 100644 index 1f9dc6bf223a5510a25b134227bb699ab4798efa..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_money_add.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_monitor.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_monitor.gif deleted file mode 100644 index 299ec4fb3c47d7e5692cb45721ca36522d8759b6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_monitor.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper.gif deleted file mode 100644 index a0d25bb53601a303a26be755fef08ea991f3a685..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_delete.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_delete.gif deleted file mode 100644 index dd1fce9c454f3347c43aae563eb90db3f233677e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_delete.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_error.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_error.gif deleted file mode 100644 index 5a48a701cca2aa7427f9055c2bc646a07f4c7f60..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_error.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_go.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_go.gif deleted file mode 100644 index db3b7e32bdafe3ab6af710826489543215a625c7..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_newspaper_go.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_package.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_package.gif deleted file mode 100644 index b5d50708d8e80fa17ae19dfdad7e9ddb84ac18a8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_package.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_package_go.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_package_go.gif deleted file mode 100644 index 70f05046d8d74b31d50afb52024fdc9d786d930d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_package_go.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white.gif deleted file mode 100644 index a572f4589cee4941173e80c4481dd436e8def9de..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white_edit.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white_edit.gif deleted file mode 100644 index be24b456bc8122f6acfe0d6009403ac5d848e310..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_page_white_edit.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_rainbow.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_rainbow.gif deleted file mode 100644 index a0b0a53a48495543f808a0d17545655253936cd9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_rainbow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_refresh.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_refresh.gif deleted file mode 100644 index 14b878b452a210e9fce59948ae9714c24aa66928..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_refresh.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_server_database.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_server_database.gif deleted file mode 100644 index 6f4f4c7c04e259beec1482a2631137d870215ff4..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_server_database.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_status_online.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_status_online.gif deleted file mode 100644 index c77eb38b267f05d7281ce611c4b02c14ab19f2c6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_status_online.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_tag_orange.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_tag_orange.gif deleted file mode 100644 index e039fd2535cd66ad9074f119aa2e46ab0b46e53b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_tag_orange.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_user.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_user.gif deleted file mode 100644 index 3ff9b77784d71faf5e41d3f41487c4c8de0c9282..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_user.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_user_comment.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_user_comment.gif deleted file mode 100644 index eb244381421b04bac7d1963f6c6353a37437c557..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_user_comment.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/fam_user_edit.gif b/app/code/Magento/Webhook/view/adminhtml/images/fam_user_edit.gif deleted file mode 100644 index 338eed2173c6221d82f65ab99e2cedbf34f5103b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/fam_user_edit.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/filter_row_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/filter_row_bg.gif deleted file mode 100644 index d284f0f0a776a56a6e78b3cda0333f74e31e394b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/filter_row_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/footer_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/footer_bg.gif deleted file mode 100644 index d5b9d37c2d0d513ab5e1c8a518d479d408991e82..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/footer_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ghost-dark.png b/app/code/Magento/Webhook/view/adminhtml/images/ghost-dark.png deleted file mode 100644 index 502eb75d35397652b185884ffccc3ea5289be4c4..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ghost-dark.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ghost.png b/app/code/Magento/Webhook/view/adminhtml/images/ghost.png deleted file mode 100644 index 2fe0ecd61577ffe48520830075e42a078e415c6d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ghost.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-collapse.gif b/app/code/Magento/Webhook/view/adminhtml/images/gift-message-collapse.gif deleted file mode 100644 index 8270754504773d094fe4dd89003b375821f70ae5..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-collapse.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-expand.gif b/app/code/Magento/Webhook/view/adminhtml/images/gift-message-expand.gif deleted file mode 100644 index 888fde5f5ee7f54db215d8ff0e86baf5532cef1b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-expand.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-grid-column-bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/gift-message-grid-column-bg.gif deleted file mode 100644 index 7edcc8bb1a3937c6303cb4522bb749071b62803a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/gift-message-grid-column-bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/green_button.png b/app/code/Magento/Webhook/view/adminhtml/images/green_button.png deleted file mode 100644 index bb69b64a0f2575bc5f549f1611b0df4992a1417b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/green_button.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/green_circle_right.png b/app/code/Magento/Webhook/view/adminhtml/images/green_circle_right.png deleted file mode 100644 index a5a04e70a33efd7a30fe74e65bd9adc235f13981..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/green_circle_right.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grey_button.png b/app/code/Magento/Webhook/view/adminhtml/images/grey_button.png deleted file mode 100644 index 94138c5582ffcf3b81f3c2a99565a7324be0cdb1..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grey_button.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grey_circle_right.png b/app/code/Magento/Webhook/view/adminhtml/images/grey_circle_right.png deleted file mode 100644 index 3b143f063eddd8862736c897ede430e283203919..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grey_circle_right.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grid-cal.gif b/app/code/Magento/Webhook/view/adminhtml/images/grid-cal.gif deleted file mode 100644 index d0235c7e023cab8100e0916375dabeca2f4b478c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grid-cal.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_asc.gif b/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_asc.gif deleted file mode 100644 index 1136ddcfd69a98e88efe098c82e437b8428e6bf7..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_asc.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_desc.gif b/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_desc.gif deleted file mode 100644 index d6349fefe91c4c245e930d8d938375975cefcda9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grid_sort_desc.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grid_th_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/grid_th_bg.gif deleted file mode 100644 index 8ccc66e7ba9e92789d5d6fcc3fcb3cc32ba11a60..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grid_th_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grid_th_onclick_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/grid_th_onclick_bg.gif deleted file mode 100644 index 3bf5e263bdbfc5fbd858543ef93858101ec0d4f5..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grid_th_onclick_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/grouped_to_order_icon.png b/app/code/Magento/Webhook/view/adminhtml/images/grouped_to_order_icon.png deleted file mode 100644 index d7e92ab9935186870f484411e687d8802baae010..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/grouped_to_order_icon.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/header_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/header_bg.gif deleted file mode 100644 index 591ae51eee22207354caee6cccc661cab3982a09..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/header_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/header_top_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/header_top_bg.gif deleted file mode 100644 index 47e9a5762994c991dbac829d337d7399a16dc8ad..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/header_top_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/hor_arrow.png b/app/code/Magento/Webhook/view/adminhtml/images/hor_arrow.png deleted file mode 100644 index 177303f3646331b6b56522738c228bd639079f4c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/hor_arrow.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/horiz_tabs_ul_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/horiz_tabs_ul_bg.gif deleted file mode 100644 index 672fbfb34d24c16daef66c64920e91f06cc4c4e5..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/horiz_tabs_ul_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/i_notice.gif b/app/code/Magento/Webhook/view/adminhtml/images/i_notice.gif deleted file mode 100644 index 17733eff3fa73171ffbce8254fa0b368d940b74d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/i_notice.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/i_question-mark.png b/app/code/Magento/Webhook/view/adminhtml/images/i_question-mark.png deleted file mode 100644 index 889bf696e2fdac4c51300a90ef6a5dec6b09d7cd..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/i_question-mark.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ico_success.gif b/app/code/Magento/Webhook/view/adminhtml/images/ico_success.gif deleted file mode 100644 index f1bce8e97421cf082c0db06da3c9567fdf34c29f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ico_success.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon-tooltip.png b/app/code/Magento/Webhook/view/adminhtml/images/icon-tooltip.png deleted file mode 100644 index c9b1ce706b28e091341268307c7102206790f9a3..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon-tooltip.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_add.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_add.gif deleted file mode 100644 index 0c7645a983d3a86c2c625aa65fc58573c07180dc..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_add.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_back.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_back.gif deleted file mode 100644 index a59ed3984560b0b31b9cca8191f363cbfc808b7d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_back.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_delete.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_delete.gif deleted file mode 100644 index 458068dfaa73d48ebb73040317b1e74e399edafd..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_delete.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_save.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_save.gif deleted file mode 100644 index 87a9815b4975e0ddea63c6e57705e5196528fec8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_btn_save.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_edit_address.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_edit_address.gif deleted file mode 100644 index 78e7bbb1e50713fe0ef63ff626b7f8955707b86f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_edit_address.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_export.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_export.gif deleted file mode 100644 index e9fcf7cc93e0b1d7a036fa58f452b4b8c56d2f8b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_export.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_export.png b/app/code/Magento/Webhook/view/adminhtml/images/icon_export.png deleted file mode 100644 index 34a736f70261338c9bca98c38b78193740fa83a0..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_export.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.gif deleted file mode 100644 index 6ed34f093bbf7caf0a5d37a7e914a392cd7cf494..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.png b/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.png deleted file mode 100644 index c20804da936c01478d75e4b7a1031941ff420d66..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_feed.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_note_list.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_note_list.gif deleted file mode 100644 index 5327e200559188c20ab46c2489f76c60088eb5a4..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_note_list.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/icon_remove_address.gif b/app/code/Magento/Webhook/view/adminhtml/images/icon_remove_address.gif deleted file mode 100644 index e9e3b92c2eaf9ec4fd75c53853101db300d946ea..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/icon_remove_address.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/image-placeholder.png b/app/code/Magento/Webhook/view/adminhtml/images/image-placeholder.png deleted file mode 100644 index a355f94784148a0d626cae54c05423734b1a707e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/image-placeholder.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/loader-small.gif b/app/code/Magento/Webhook/view/adminhtml/images/loader-small.gif deleted file mode 100644 index 62feaa6c3c85d98a0d6f81d9a75fe837d6243bbb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/loader-small.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.gif deleted file mode 100644 index b15f180d93b760d4640d0f960cac0fe1c0e1772c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.jpg b/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.jpg deleted file mode 100644 index 3ad1f5d0928955529d285278f259f8435444bb0b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg.jpg and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg_auth.jpg b/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg_auth.jpg deleted file mode 100644 index 8f7f13689d0914ef2aa95b2de791e53308d76b0a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bg_auth.jpg and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bottom.jpg b/app/code/Magento/Webhook/view/adminhtml/images/login_box_bottom.jpg deleted file mode 100644 index 9db375bbe6d402e5a4d809964287804f33aa4170..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_box_bottom.jpg and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_box_legal_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/login_box_legal_bg.gif deleted file mode 100644 index 79b1ad4f0e626f7aaf3d6e750e17b0beb80b83dd..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_box_legal_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/login_logo.gif b/app/code/Magento/Webhook/view/adminhtml/images/login_logo.gif deleted file mode 100644 index 3141a687bc46c60891cd553e46655548e7061fd9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/login_logo.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/logo-large.gif b/app/code/Magento/Webhook/view/adminhtml/images/logo-large.gif deleted file mode 100644 index 1aefe01b5bb6038cba4b740d17495ade777309ad..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/logo-large.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/logo.gif b/app/code/Magento/Webhook/view/adminhtml/images/logo.gif deleted file mode 100644 index 822079d8fc66b8aead86e7ad90c74b1005d063ed..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/logo.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/massaction_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/massaction_bg.gif deleted file mode 100644 index 3c29ce38edbc950edccd668edcde3f52a8c52287..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/massaction_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/massaction_button_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/massaction_button_bg.gif deleted file mode 100644 index b45618a99a2dbd04722f71f256b3282a65d57367..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/massaction_button_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/massaction_links_delimiter.gif b/app/code/Magento/Webhook/view/adminhtml/images/massaction_links_delimiter.gif deleted file mode 100644 index 489fce6932f9444d07e179105f4875840a8a2e9e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/massaction_links_delimiter.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/middle_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/middle_bg.gif deleted file mode 100644 index f44ad896d43909b91aa8b89ea8487d444faaa7de..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/middle_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/more_arrow.gif b/app/code/Magento/Webhook/view/adminhtml/images/more_arrow.gif deleted file mode 100644 index 38274038067bcc9939437f77351cca250ab0597f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/more_arrow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_active.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_active.gif deleted file mode 100644 index cda58c6b3fdad22a1e1bb85af444013c29820b8b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_active.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_bg.gif deleted file mode 100644 index f04614925d0d42c6d481d31c5260325e7374f44d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_off.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_off.gif deleted file mode 100644 index 2284d977a6a1d115775932c639ca9b0f9becc08b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_off.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_on.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_on.gif deleted file mode 100644 index cda58c6b3fdad22a1e1bb85af444013c29820b8b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_on.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_over.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_over.gif deleted file mode 100644 index 2878e7fb750a2577234a4225d60230ce4fa22b63..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_over.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav1_sep.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav1_sep.gif deleted file mode 100644 index 2284d977a6a1d115775932c639ca9b0f9becc08b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav1_sep.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_bg.png deleted file mode 100644 index 9d116872d15b83ee9adee54d4a96bbd088d168e8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_over_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_over_bg.png deleted file mode 100644 index 7103bc834431337e59447137823ebbcf6eb65cca..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_last_li_over_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.gif deleted file mode 100644 index 7d89746e9679208d8a53813028d15b221eafe3fb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.png deleted file mode 100644 index c943091ad941751a5381c89ba603c2683877e04d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_over_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_over_bg.png deleted file mode 100644 index 06822f953b3c9e131caf5ee4e934c5ecd8704edd..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_li_over_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_link_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav2_link_bg.gif deleted file mode 100644 index 0af1f607e58017178caf50977560620be4f1499b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_link_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav2_parent_arrow.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav2_parent_arrow.gif deleted file mode 100644 index 591c49a3036bb7a33747437cac05dd376bca739b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav2_parent_arrow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav3_bg.png b/app/code/Magento/Webhook/view/adminhtml/images/nav3_bg.png deleted file mode 100644 index 96793a4007eb26a0da3e0165d09035c843dd656e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav3_bg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_bg.gif deleted file mode 100644 index e013b09f3bf4802513500b8a252818dbea14886b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_list_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_list_bg.gif deleted file mode 100644 index cf42c6543d5e51b0ff9f019dde08fdfd8095650b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_list_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_bg.gif deleted file mode 100644 index 7dac4f1ff7307b937fe91404215668dd379fe450..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_over_bg.gif deleted file mode 100644 index 8d808d18d56f41495ca7371e62ffef04d641a93c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_nest_link_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_on_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_on_bg.gif deleted file mode 100644 index 1ba0ba779557bea2861c1b8c315665f92b34d910..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_on_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/nav_parent_arrow.gif b/app/code/Magento/Webhook/view/adminhtml/images/nav_parent_arrow.gif deleted file mode 100644 index f790175fb94643ebedfde1f830594949038f5e79..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/nav_parent_arrow.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/note_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/note_bg.gif deleted file mode 100644 index 9b2d91ad9c5602859247271f013a565fac485834..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/note_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/note_cell_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/note_cell_bg.gif deleted file mode 100644 index b8786a7b9d6a4010a946b6b5b4b44cffa5aef1e6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/note_cell_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/note_msg_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/note_msg_icon.gif deleted file mode 100644 index c9cacc27ae2553a59993d9702953dc19c53c679b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/note_msg_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/notice-msg.png b/app/code/Magento/Webhook/view/adminhtml/images/notice-msg.png deleted file mode 100644 index 0bf433b7e7c1433f10e66992372799f8a126feba..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/notice-msg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left.gif b/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left.gif deleted file mode 100644 index c0bb54f39b37b842bfb92ab8cb914fc45119d197..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left_off.gif b/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left_off.gif deleted file mode 100644 index e057ce0e30cc45efc60e72ea4c53453e4854de8d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_left_off.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right.gif b/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right.gif deleted file mode 100644 index f464481ba14c88214a0c72a6d2b1daf7948279fa..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right_off.gif b/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right_off.gif deleted file mode 100644 index 95f17d5face7d7d8c00a9c56a00b8b1c4857b934..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/pager_arrow_right_off.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/process_spinner.gif b/app/code/Magento/Webhook/view/adminhtml/images/process_spinner.gif deleted file mode 100644 index 0ebe4d8430c58416a60a055eaf8ff7ec318ab653..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/process_spinner.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/product_rating_blank_star.gif b/app/code/Magento/Webhook/view/adminhtml/images/product_rating_blank_star.gif deleted file mode 100644 index 72d763388e2359238762f43000e74862cf460e3e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/product_rating_blank_star.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/product_rating_full_star.gif b/app/code/Magento/Webhook/view/adminhtml/images/product_rating_full_star.gif deleted file mode 100644 index ab252f8890a191fbcb3b977b5e62c955cd809340..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/product_rating_full_star.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/red_button.png b/app/code/Magento/Webhook/view/adminhtml/images/red_button.png deleted file mode 100644 index df5ed85a0d2d6af1fb99e82f02c520e7ecb0d037..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/red_button.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/red_circle_right.png b/app/code/Magento/Webhook/view/adminhtml/images/red_circle_right.png deleted file mode 100644 index 9f423c867355c304a409ef555294b2a72d363d0b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/red_circle_right.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/rule-ajax-loader.gif b/app/code/Magento/Webhook/view/adminhtml/images/rule-ajax-loader.gif deleted file mode 100644 index f077a0b27947e17af8fc5ab7bb53f28909622d8b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/rule-ajax-loader.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/rule_chooser_trigger.gif b/app/code/Magento/Webhook/view/adminhtml/images/rule_chooser_trigger.gif deleted file mode 100644 index 673d31ad5e03cb1627797ec84ff47a23bed086ff..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/rule_chooser_trigger.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_add.gif b/app/code/Magento/Webhook/view/adminhtml/images/rule_component_add.gif deleted file mode 100644 index 4032f76a2027f42b04aa0137bd904673092bf4fe..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_add.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_apply.gif b/app/code/Magento/Webhook/view/adminhtml/images/rule_component_apply.gif deleted file mode 100644 index 45c61c3247ae622451c924660b5e0cd19dea1ef8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_apply.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_remove.gif b/app/code/Magento/Webhook/view/adminhtml/images/rule_component_remove.gif deleted file mode 100644 index 9f2f4edf9ced7be6d4acc662d8730f3612623ffb..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/rule_component_remove.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/save_btn_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/save_btn_icon.gif deleted file mode 100644 index 87a9815b4975e0ddea63c6e57705e5196528fec8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/save_btn_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sec_nav_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/sec_nav_bg.gif deleted file mode 100644 index d1d4535534e1090d8e0cece56d225733fa131dcf..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sec_nav_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bg.gif deleted file mode 100644 index 53ac32a24706c9650b66bc0cd8c46be3d5e5d2e6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bottom.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bottom.gif deleted file mode 100644 index 640214713f5dd983abc157642dceb45dbe53e92d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_bottom.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_bg.gif deleted file mode 100644 index 4f5b1e1f4305b9a03628943016cd5a398f300b50..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_over_bg.gif deleted file mode 100644 index be6bc4eefa3476282d9fdfd48e8400fb53ca59b6..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_link_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_over_span_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_over_span_bg.gif deleted file mode 100644 index 9f06882b424f433bac8f6d3f1dde2c276467b1f8..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_over_span_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_span_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_span_bg.gif deleted file mode 100644 index 627e9ec35ea28069e2c145439730643903065c3e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_span_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_ul_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/section_menu_ul_bg.gif deleted file mode 100644 index d1b4d718bd9043805ad8fb6a854838cd7d784ef1..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/section_menu_ul_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/side_col_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/side_col_bg.gif deleted file mode 100644 index 33801a6aec488b94f6e9443a1f85d8b2f3d5d633..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/side_col_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/simple_container_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/simple_container_bg.gif deleted file mode 100644 index 933999856de941409869a654365812bd7695a20e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/simple_container_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.gif b/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.gif deleted file mode 100644 index 825e492e761b368a980bb35e27d8e11c6971ba34..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.png b/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.png deleted file mode 100644 index 74288ad241171966d184847de65e3dfac4a1d7ca..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-down.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.gif b/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.gif deleted file mode 100644 index ea2ee5ef595016fd77f88d70b259995531c366b9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.png b/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.png deleted file mode 100644 index 2863a05111d4aac943777bbd30c5b7fb07d5821f..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort-arrow-up.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort_heading_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/sort_heading_bg.gif deleted file mode 100644 index c9642dfdaa9bcc634c18d60612f92b492f99c04e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort_heading_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort_on_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/sort_on_bg.gif deleted file mode 100644 index be9ef00458c5c5b7f8bc864128e0b2026739d816..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort_on_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sort_row_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/sort_row_bg.gif deleted file mode 100644 index a02c2c0205be6131ce43f1663568e2f08d0e9242..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sort_row_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/spacer.gif b/app/code/Magento/Webhook/view/adminhtml/images/spacer.gif deleted file mode 100644 index 5bfd67a2d6f72ac3a55cbfcea5866e841d22f5d9..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/spacer.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/sub_button_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/sub_button_bg.gif deleted file mode 100644 index 17d1bf74d4a3efaf233face6d1507eb236f48bf7..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/sub_button_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/success-msg.png b/app/code/Magento/Webhook/view/adminhtml/images/success-msg.png deleted file mode 100644 index 24bfc750a218f5b78a8c3bff6ecb0459db63593d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/success-msg.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/success_msg_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/success_msg_icon.gif deleted file mode 100644 index 611faffbc5f4254d54bd031f87470be3b32b28cf..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/success_msg_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_bg.gif deleted file mode 100644 index 94506909fef67d0cae48ac0a1790836e04ad271a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_over_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_over_bg.gif deleted file mode 100644 index 185af722bb46dfc396892708afdd024b6c2a2354..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tabs_link_over_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tabs_span_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/tabs_span_bg.gif deleted file mode 100644 index 4f5b1e1f4305b9a03628943016cd5a398f300b50..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tabs_span_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tag_blue_edit.gif b/app/code/Magento/Webhook/view/adminhtml/images/tag_blue_edit.gif deleted file mode 100644 index 6a9d3700b71250c23501f0c03c71a7f9009de31c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tag_blue_edit.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tn_cancel_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/tn_cancel_bg.gif deleted file mode 100644 index a3d92e461f740967cc32aab47fb157ad0b0a5756..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tn_cancel_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/tooltip_bg.gif deleted file mode 100644 index e4d9e99348ea72d4105793b9702701c1e6a7263a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_corner.gif b/app/code/Magento/Webhook/view/adminhtml/images/tooltip_corner.gif deleted file mode 100644 index f49f64f7fa41b9505fa2699681f04110e85b7e5a..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_corner.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_top.gif b/app/code/Magento/Webhook/view/adminhtml/images/tooltip_top.gif deleted file mode 100644 index 0e7fd0fa283bff6d0feeaf9a0a3ffd8890788e60..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tooltip_top.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/join.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/join.gif deleted file mode 100644 index 34dd47610a5d7c3580dedc342683559bf77abce2..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/join.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/joinbottom.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/joinbottom.gif deleted file mode 100644 index 48b81c80a9e25f6f29e2614aaa33bdf4a4d2881b..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/joinbottom.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/line.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/line.gif deleted file mode 100644 index 1a259eea00c330eee85fb18aa64e2e232d5410b1..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/line.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minus.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minus.gif deleted file mode 100644 index 3d212a97ae0d8f83aa39836c5a85d442f8602553..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minus.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minusbottom.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minusbottom.gif deleted file mode 100644 index dc3198be275d3da71011a6cb4fa59b8b94656c8d..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/minusbottom.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_minus.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_minus.gif deleted file mode 100644 index 2592ac20f3f4c28e38f789309ec52f08505bdf6e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_minus.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_plus.gif b/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_plus.gif deleted file mode 100644 index f258ce211a0a19c2ecbcb11170b9a8b35ae2436c..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/tree_icons/nolines_plus.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/validation_advice_bg.gif b/app/code/Magento/Webhook/view/adminhtml/images/validation_advice_bg.gif deleted file mode 100644 index 46b1a2267ba5ad31f59a9c6cd8eaac9ee3b0f8ce..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/validation_advice_bg.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/varien_logo.gif b/app/code/Magento/Webhook/view/adminhtml/images/varien_logo.gif deleted file mode 100644 index f24f00c36ddf0018d827dd4b5735987fa2a7b67e..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/varien_logo.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/ver_arrow.png b/app/code/Magento/Webhook/view/adminhtml/images/ver_arrow.png deleted file mode 100644 index 9841f050b1b3b49b249c0cfb3f190afa6dad5d40..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/ver_arrow.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/warning_msg_icon.gif b/app/code/Magento/Webhook/view/adminhtml/images/warning_msg_icon.gif deleted file mode 100644 index c29d6cfcbf7482cdf8a600a3d96c8ca47540a6b0..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/warning_msg_icon.gif and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/window_close.png b/app/code/Magento/Webhook/view/adminhtml/images/window_close.png deleted file mode 100644 index 6e2b6dfb1d098287e6f7f87f1d2acefcd4a074ec..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/window_close.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/window_content.png b/app/code/Magento/Webhook/view/adminhtml/images/window_content.png deleted file mode 100644 index db3c448660b828cfba275f9536f4abb80ab68e03..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/window_content.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/images/window_top.png b/app/code/Magento/Webhook/view/adminhtml/images/window_top.png deleted file mode 100644 index d30bc1c89e0827a2873a8804144f648a2cedf883..0000000000000000000000000000000000000000 Binary files a/app/code/Magento/Webhook/view/adminhtml/images/window_top.png and /dev/null differ diff --git a/app/code/Magento/Webhook/view/adminhtml/js/validate_form.js b/app/code/Magento/Webhook/view/adminhtml/js/validate_form.js deleted file mode 100644 index c9ed76e087d5bd131ff99ca7eedfdb772666d0f0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/js/validate_form.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -$j = jQuery.noConflict(); -$j(document).ready(function(){ - jQuery.validator.addClassRules("required-entry", { - required: true - }); -}) \ No newline at end of file diff --git a/app/code/Magento/Webhook/view/adminhtml/js/webhook.js b/app/code/Magento/Webhook/view/adminhtml/js/webhook.js deleted file mode 100644 index 8e18d9a6431eeb5a59693f9b4034741db5c8f7bc..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/js/webhook.js +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -function activateSubscription(url) -{ - $j = jQuery.noConflict(); - var activateSubscriptionDiv = $j('#activate-subscription'); - if (undefined === activateSubscriptionDiv[0]) { - activateSubscriptionDiv = $j('<div id="activate-subscription"/>'); - $j('body').append(activateSubscriptionDiv); - } - activateSubscriptionDiv.html(''); - - activateSubscriptionDiv.append('<div id="popup-window-mask" style="width: 1665px; height: 719px;"/>'); - var modal = activateSubscriptionDiv.append('<div id="modal" class="popup-window-mask hide" style="height: 100%; width: 100%;"></div>'); - modal.append('<div class="sh hide"><div class="b"><div class="top"><a class="close" href="#">close</a></div><iframe id="ifr" frameborder="0"/></div></div>'); - // activateSubscriptionDiv.append('<div id="modal" class="wr hide"> <div class="sh"><div class="b"><a href="#" class="close"></a><iframe id="ifr" frameborder="0"/></div></div></div>'); - openLoaderPopup(); - - $j('#ifr').on('load', function() { - closeLoaderPopup(); - $j("#modal").removeClass("hide"); - $j("#activate-subscription > .sh").removeClass("hide"); - }); - $j('#ifr').attr('src', url); - - // Close Modal - $j("#activate-subscription > .sh > .b").on("click","a.close",function(){ - $j("#modal").addClass("hide"); - $j("#activate-subscription > .sh").addClass("hide"); - return false; - }); - /* Handle overlay */ - $j(window).on("resize",function(){ - var top = ($j(window).height() - $j("#activate-subscription > .sh").height()) / 2; - var left = ($j(window).width() - $j("#activate-subscription > .sh").width()) / 2; - /* Taking scrolling under consideration */ - if ($j(window).scrollTop()) { - top += $j(window).scrollTop(); - } - if ($j(window).scrollLeft()) { - left += $j(window).scrollLeft(); - } - if (top < 0) { - top = 0; - } - if (left < 0) { - left = 0; - } - $j("#activate-subscription > .sh").css("top", top + "px"); - $j("#activate-subscription > .sh").css("left", left + "px"); - $j("#modal ") - .css("width",$j(document).width() + "px") - .css("height",$j(document).height() + "px"); - }); - /* Handle scrolling */ - $j(document).scroll(function() { - $j(window).trigger("resize"); - }); - /* Trigger initial resize to position loading box */ - $j(window).trigger("resize"); -} - -function openLoaderPopup() -{ - // Prototype code - var height = $('html-body').getHeight(); - $('popup-window-mask').setStyle({'height':height + 'px'}); - Element.show('popup-window-mask'); - $('loading-mask').show(); -} - -function closeLoaderPopup() -{ - // Prototype code - Element.hide('popup-window-mask'); - $('loading-mask').hide(); -} - -function closeIframe(url) -{ - document.location.href = url; - return false -} - diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_integration_activate_permissions_webhook.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_integration_activate_permissions_webhook.xml deleted file mode 100644 index aa1363b0862656fc62fbc81a1dc639b4289cbdbd..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_integration_activate_permissions_webhook.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Tab for integration activation permissions popup. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="integration.activate.permissions.tabs"> - <block class="Magento\Webhook\Block\Adminhtml\Integration\Activate\Permissions\Tab\Webhook" name="integration_activate_permissions_tabs_webhook"/> - <action method="addTab"> - <argument name="name" xsi:type="string">integration_activate_permissions_tabs_webhook</argument> - <argument name="block" xsi:type="string">integration_activate_permissions_tabs_webhook</argument> - </action> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_activate.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_activate.xml deleted file mode 100644 index 1a1f6c161aa2a4099307f62b9ac5444e70a398e0..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_activate.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Theme\Block\Html" name="root" output="1" template="empty.phtml"> - <block class="Magento\Backend\Block\Page\Head" name="head" as="head" template="page/head.phtml"> - <block class="Magento\Theme\Block\Html\Head\Css" name="mui-reset-css"> - <arguments> - <argument name="file" xsi:type="string">mui/reset.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-boxes-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/boxes.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-webhook-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/webhook.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-prototype-js"> - <arguments> - <argument name="file" xsi:type="string">prototype/prototype.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/translate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-tools-js"> - <arguments> - <argument name="file" xsi:type="string">mage/adminhtml/tools.js</argument> - </arguments> - </block> - </block> - <block class="Magento\Webhook\Block\Adminhtml\Registration\Activate" name="content" template="Magento_Webhook::registration/activate.phtml"/> - </block> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_failed.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_failed.xml deleted file mode 100644 index 22f174b3596c2483ca1e7ec325758f285ef50e53..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_failed.xml +++ /dev/null @@ -1,62 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Theme\Block\Html" name="root" output="1" template="empty.phtml"> - <block class="Magento\Backend\Block\Page\Head" name="head" as="head" template="page/head.phtml"> - <block class="Magento\Theme\Block\Html\Head\Css" name="mui-reset-css"> - <arguments> - <argument name="file" xsi:type="string">mui/reset.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-boxes-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/boxes.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-webhook-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/webhook.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-prototype-js"> - <arguments> - <argument name="file" xsi:type="string">prototype/prototype.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/translate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-tools-js"> - <arguments> - <argument name="file" xsi:type="string">mage/adminhtml/tools.js</argument> - </arguments> - </block> - </block> - <block class="Magento\Webhook\Block\Adminhtml\Registration\Failed" name="content" template="Magento_Webhook::registration/failed.phtml"/> - </block> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_succeeded.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_succeeded.xml deleted file mode 100644 index 0b5f63b08e1ade01d902720879b2e133fa5d5f0f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_succeeded.xml +++ /dev/null @@ -1,67 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Theme\Block\Html" name="root" output="1" template="empty.phtml"> - <block class="Magento\Backend\Block\Page\Head" name="head" as="head" template="page/head.phtml"> - <block class="Magento\Theme\Block\Html\Head\Css" name="mui-reset-css"> - <arguments> - <argument name="file" xsi:type="string">mui/reset.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-boxes-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/boxes.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-webhook-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/webhook.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-prototype-js"> - <arguments> - <argument name="file" xsi:type="string">prototype/prototype.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/translate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-tools-js"> - <arguments> - <argument name="file" xsi:type="string">mage/adminhtml/tools.js</argument> - </arguments> - </block> - </block> - <block class="Magento\Backend\Block\Template" name="content" template="Magento_Webhook::registration/succeeded.phtml"/> - </block> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_user.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_user.xml deleted file mode 100644 index a31415ba405cd849ca4062a514c391a92de56739..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_registration_user.xml +++ /dev/null @@ -1,79 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <block class="Magento\Theme\Block\Html" name="root" output="1" template="empty.phtml"> - <block class="Magento\Backend\Block\Page\Head" name="head" as="head" template="page/head.phtml"> - <block class="Magento\Theme\Block\Html\Head\Css" name="mui-reset-css"> - <arguments> - <argument name="file" xsi:type="string">mui/reset.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-boxes-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/boxes.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-webhook-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/webhook.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="jquery-jquery-validate-js"> - <arguments> - <argument name="file" xsi:type="string">jquery/jquery.validate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-webhook-js-validate-form-js"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::js/validate_form.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="prototype-prototype-js"> - <arguments> - <argument name="file" xsi:type="string">prototype/prototype.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-translate-js"> - <arguments> - <argument name="file" xsi:type="string">mage/translate.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-adminhtml-tools-js"> - <arguments> - <argument name="file" xsi:type="string">mage/adminhtml/tools.js</argument> - </arguments> - </block> - </block> - <block class="Magento\Webhook\Block\Adminhtml\Registration\Create\Form\Container" name="content" template="Magento_Webhook::registration/create/container.phtml"> - <block class="Magento\Webhook\Block\Adminhtml\Registration\Create\Form" name="api_form"/> - </block> - </block> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_edit.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_edit.xml deleted file mode 100644 index aec7fe80856a0fdb8e650c429cab19dca2a96fed..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_edit.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceContainer name="content"> - <block class="Magento\Webhook\Block\Adminhtml\Subscription\Edit" name="webhook.subscriptions.edit"/> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_grid.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_grid.xml deleted file mode 100644 index 00839c556ca28a131dc32ede278f0bf47707ba15..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_grid.xml +++ /dev/null @@ -1,96 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="webhook.subscriptions.list"> - <block class="Magento\Backend\Block\Widget\Grid" name="adminhtml_subscription.grid" as="grid"> - <arguments> - <argument name="dataSource" xsi:type="object">Magento\Webhook\Model\Resource\Subscription\Grid\Collection</argument> - <argument name="id" xsi:type="string">subscriptionGrid</argument> - <argument name="default_sort" xsi:type="string">subscription_id</argument> - <argument name="default_dir" xsi:type="string">ASC</argument> - <argument name="SaveParametersInSession" xsi:type="string">1</argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\ColumnSet" as="grid.columnSet" name="Magento_Webhook_Block_Adminhtml_Subscription_Grid.columnSet"> - <arguments> - <argument name="rowUrl" xsi:type="array"> - <item name="path" xsi:type="string">*/*/edit</item> - <item name="extraParamsTemplate" xsi:type="array"> - <item name="id" xsi:type="string">getId</item> - </item> - </argument> - <argument name="empty_text" xsi:type="string" translate="true">No Items Found</argument> - </arguments> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="id"> - <arguments> - <argument name="header" xsi:type="string" translate="true">ID</argument> - <argument name="align" xsi:type="string">right</argument> - <argument name="width" xsi:type="string">50px</argument> - <argument name="id" xsi:type="string">id</argument> - <argument name="index" xsi:type="string">subscription_id</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="name"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Name</argument> - <argument name="index" xsi:type="string">name</argument> - <argument name="id" xsi:type="string">name</argument> - <argument name="align" xsi:type="string">left</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="endpoint_url"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Endpoint URL</argument> - <argument name="index" xsi:type="string">endpoint_url</argument> - <argument name="align" xsi:type="string">left</argument> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="status"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Status</argument> - <argument name="index" xsi:type="string">status</argument> - <argument name="align" xsi:type="string">left</argument> - <argument name="width" xsi:type="string">100px</argument> - <argument name="id" xsi:type="string">status</argument> - <argument name="type" xsi:type="string">options</argument> - <argument name="options" xsi:type="options" model="Magento\Webhook\Model\Subscription\Options\Status"/> - </arguments> - </block> - <block class="Magento\Backend\Block\Widget\Grid\Column" as="action"> - <arguments> - <argument name="header" xsi:type="string" translate="true">Action</argument> - <argument name="index" xsi:type="string">action</argument> - <argument name="align" xsi:type="string">left</argument> - <argument name="width" xsi:type="string">80px</argument> - <argument name="renderer" xsi:type="string">Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\Action</argument> - <argument name="sortable" xsi:type="string">0</argument> - <argument name="filter" xsi:type="string">0</argument> - <argument name="id" xsi:type="string">action</argument> - </arguments> - </block> - </block> - </block> - </referenceBlock> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_index.xml b/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_index.xml deleted file mode 100644 index 2ff17af732fded3847b365c4ffbe8bcac469e116..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/layout/adminhtml_webhook_subscription_index.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Css" name="magento-webhook-css-modal-css"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::css/modal.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="magento-webhook-js-webhook-js"> - <arguments> - <argument name="file" xsi:type="string">Magento_Webhook::js/webhook.js</argument> - </arguments> - </block> - </referenceBlock> - <update handle="adminhtml_webhook_subscription_grid"/> - <referenceContainer name="content"> - <block class="Magento\Webhook\Block\Adminhtml\Subscription" name="webhook.subscriptions.list"/> - </referenceContainer> -</layout> diff --git a/app/code/Magento/Webhook/view/adminhtml/registration/activate.phtml b/app/code/Magento/Webhook/view/adminhtml/registration/activate.phtml deleted file mode 100644 index 9cf7cc8b565fcd1e32b03d6c310fa0ba3aea396f..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/registration/activate.phtml +++ /dev/null @@ -1,56 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="outer"> - <div class="center"> - <div class="section main"> - <h3><?php echo __('The <em>%1</em> subscription is requesting permissions to the following:', $this->getSubscriptionName()) ?> </h3> - - - <div class="section hooks"> - <h4><?php echo __('Events') ?></h4> - - <ul> - <?php foreach ($this->getSubscriptionTopics() as $hook) : ?> - <li><code><?php echo $hook ?></code></li> - <?php endforeach; ?> - </ul> - </div> - </div> - </div> - <div class="bottom"> - <div class="buttons"> - <button id="allowActivateSubscription" onclick="document.location = '<?php echo $this->getAcceptUrl() ?>'; return false;"> - <span> - <?php echo __('Allow') ?> - </span> - </button> - <button id="denyActivateSubscription" onclick="window.parent.location.reload(); return false;"> - <span> - <?php echo __('Deny') ?> - </span> - </button> - </div> - </div> -</div> diff --git a/app/code/Magento/Webhook/view/adminhtml/registration/create/container.phtml b/app/code/Magento/Webhook/view/adminhtml/registration/create/container.phtml deleted file mode 100644 index 29048f366808dd4ad8434f7da71ed4498f2d20de..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/registration/create/container.phtml +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="outer"> - <div class="center"> - <div class="section main"> - <h3> - <?php echo __('Creating API User for ') ?> - <em><?php echo $this->getSubscriptionName() ?></em> - </h3> - - <div class="api_form"> - <?php echo $this->getChildHtml('api_form') ?> - </div> - - </div> - </div> - <div class="bottom"> - <div class="buttons"> - <button id='createWebhookSubscriptionApiUser' onclick="jQuery('form').validate();jQuery('.api_form form').submit();"> - <span> - <?php echo __('Create') ?> - </span> - </button> - <button id='cancelWebhookSubscriptionApiUser' onclick="window.parent.location.reload(); return false;"> - <span> - <?php echo __('Cancel') ?> - </span> - </button> - </div> - </div> -</div> diff --git a/app/code/Magento/Webhook/view/adminhtml/registration/failed.phtml b/app/code/Magento/Webhook/view/adminhtml/registration/failed.phtml deleted file mode 100644 index a221bc82f77bd2d7ce00b10baf54cf23363975ba..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/registration/failed.phtml +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<h3><?php echo __('Subscription registration failed!') ?></h3> -<div class="error-message"> - <?php echo $this->getSessionError() ?> -</div> diff --git a/app/code/Magento/Webhook/view/adminhtml/registration/succeeded.phtml b/app/code/Magento/Webhook/view/adminhtml/registration/succeeded.phtml deleted file mode 100644 index 95ee0677eed1b18798041665e1514c07f2a7b949..0000000000000000000000000000000000000000 --- a/app/code/Magento/Webhook/view/adminhtml/registration/succeeded.phtml +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="outer"> - <div class="center"> - <div class="section main"> - <h3><?php echo __('Subscription registration succeeded.') ?></h3> - </div> - </div> - <div class="bottom"> - <div class="buttons"> - <button id='closeActivateSubscription' onclick="window.parent.location.reload(); return false;"> - <span> - <?php echo __('Close') ?> - </span> - </button> - </div> - </div> -</div> 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 ecf5d17de3dabe3ee9f6e7492d6a69a81467716e..5dfd7593abf1473d409108da50a62a060eeeef41 100644 --- a/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php +++ b/app/code/Magento/Weee/Model/Attribute/Backend/Weee/Tax.php @@ -45,20 +45,20 @@ class Tax extends \Magento\Catalog\Model\Product\Attribute\Backend\Price /** * @param \Magento\Logger $logger - * @param \Magento\Directory\Helper\Data $directoryHelper - * @param \Magento\Catalog\Helper\Data $catalogData - * @param \Magento\Core\Model\Config $config * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Core\Model\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Helper\Data $catalogData + * @param \Magento\Core\Model\Config $config + * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax */ public function __construct( \Magento\Logger $logger, - \Magento\Directory\Helper\Data $directoryHelper, - \Magento\Catalog\Helper\Data $catalogData, - \Magento\Core\Model\Config $config, \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Core\Model\StoreManagerInterface $storeManager, + \Magento\Catalog\Helper\Data $catalogData, + \Magento\Core\Model\Config $config, + \Magento\Directory\Helper\Data $directoryHelper, \Magento\Weee\Model\Resource\Attribute\Backend\Weee\Tax $attributeTax ) { $this->_directoryHelper = $directoryHelper; diff --git a/app/code/Magento/Weee/Model/Total/Quote/Weee.php b/app/code/Magento/Weee/Model/Total/Quote/Weee.php index feb83c26ef335b59115af3c76982f837a37e6d6c..500a40bc57e1890698169a88107a9c8846a6b507 100644 --- a/app/code/Magento/Weee/Model/Total/Quote/Weee.php +++ b/app/code/Magento/Weee/Model/Total/Quote/Weee.php @@ -48,18 +48,16 @@ class Weee extends \Magento\Tax\Model\Sales\Total\Quote\Tax protected $_isTaxAffected; /** - * Initialize Weee totals collector - * - * @param \Magento\Weee\Helper\Data $weeeData * @param \Magento\Tax\Helper\Data $taxData * @param \Magento\Tax\Model\Calculation $calculation * @param \Magento\Tax\Model\Config $taxConfig + * @param \Magento\Weee\Helper\Data $weeeData */ public function __construct( - \Magento\Weee\Helper\Data $weeeData, \Magento\Tax\Helper\Data $taxData, \Magento\Tax\Model\Calculation $calculation, - \Magento\Tax\Model\Config $taxConfig + \Magento\Tax\Model\Config $taxConfig, + \Magento\Weee\Helper\Data $weeeData ) { $this->_weeeData = $weeeData; parent::__construct($taxData, $calculation, $taxConfig); diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php index 27535e6c3f1ca008a87e2bcae9bc81933f0cb96a..82fe67a694a99b234c022bca57fdfadec70c173e 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Chooser.php @@ -171,7 +171,7 @@ class Chooser extends \Magento\Backend\Block\Template )); $hiddenHtml = ''; if ($this->getHiddenEnabled()) { - $hidden = $this->_elementFactory->create('hidden', array('attributes' => $element->getData())); + $hidden = $this->_elementFactory->create('hidden', array('data' => $element->getData())); $hidden->setId("{$chooserId}value")->setForm($element->getForm()); if ($element->getRequired()) { $hidden->addClass('required-entry'); diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstraction.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstraction.php index 2424951442a0d44ae8362b8852360f93cbb3711e..877ca11fcdee856c7114b4932026b7366f705675 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstraction.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstraction.php @@ -131,13 +131,12 @@ class DesignAbstraction extends \Magento\View\Element\Html\Select // Group the layout options $customLayouts = array(); $pageLayouts = array(); - + /** @var $layoutProcessor \Magento\View\Layout\ProcessorInterface */ + $layoutProcessor = $this->_layoutProcessorFactory->create(); foreach ($designAbstractions as $pageTypeName => $pageTypeInfo) { - if ($pageTypeInfo['design_abstraction'] === - \Magento\Core\Model\Layout\Merge::DESIGN_ABSTRACTION_PAGE_LAYOUT) { + if ($layoutProcessor->isPageLayoutDesignAbstraction($pageTypeInfo)) { $pageLayouts[] = array('value' => $pageTypeName, 'label' => $pageTypeInfo['label']); - } - else { + } else { $customLayouts[] = array('value' => $pageTypeName, 'label' => $pageTypeInfo['label']); } } diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php index 0ed066fb3c6e2ffea8b1b164f9072d745462079c..206e1921029c15956211f9a63476cf7ea8eb7fc0 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/Layout.php @@ -35,18 +35,18 @@ namespace Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser; class Layout extends \Magento\View\Element\Html\Select { /** - * @var \Magento\Core\Model\Layout\PageType\Config + * @var \Magento\View\Layout\PageType\Config */ protected $_config; /** * @param \Magento\View\Element\Context $context - * @param \Magento\Core\Model\Layout\PageType\Config $config + * @param \Magento\View\Layout\PageType\Config $config * @param array $data */ public function __construct( \Magento\View\Element\Context $context, - \Magento\Core\Model\Layout\PageType\Config $config, + \Magento\View\Layout\PageType\Config $config, array $data = array() ) { $this->_config = $config; diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Form.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Form.php index 06c17a54dff26ac8e5263780b39afd48ba3ec56c..4b35afe05cb6f0b8937c9e6e78e9df5ee8a0f126 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Form.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Form.php @@ -44,7 +44,7 @@ class Form extends \Magento\Backend\Block\Widget\Form\Generic { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php index 552c946c98fd8abea21f55217d4de8dbe27c91a9..cfec34947857fba1a8baf2d5a3da097bec76d5cb 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Main.php @@ -43,7 +43,7 @@ class Main protected $_store; /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_themeLabelFactory; @@ -52,7 +52,7 @@ class Main * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory * @param \Magento\Core\Model\System\Store $store - * @param \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory + * @param \Magento\View\Design\Theme\LabelFactory $themeLabelFactory * @param array $data */ public function __construct( @@ -60,7 +60,7 @@ class Main \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, \Magento\Core\Model\System\Store $store, - \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory, + \Magento\View\Design\Theme\LabelFactory $themeLabelFactory, array $data = array() ) { $this->_store = $store; @@ -139,7 +139,7 @@ class Main /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', @@ -167,7 +167,7 @@ class Main 'disabled' => true )); - /** @var $label \Magento\Core\Model\Theme\Label */ + /** @var $label \Magento\View\Design\Theme\Label */ $label = $this->_themeLabelFactory->create(); $options = $label->getLabelsCollection(__('-- Please Select --')); $fieldset->addField('theme_id', 'select', array( diff --git a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php index 83122797394553a427821dce42412a3001273f03..f1060f72ff1592e5053a8c4778f19eca7962badd 100644 --- a/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php +++ b/app/code/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Tab/Settings.php @@ -45,7 +45,7 @@ class Settings protected $_coreRegistry; /** - * @var \Magento\Core\Model\Theme\LabelFactory + * @var \Magento\View\Design\Theme\LabelFactory */ protected $_themeLabelFactory; @@ -53,14 +53,14 @@ class Settings * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Core\Model\Registry $registry * @param \Magento\Data\FormFactory $formFactory - * @param \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory + * @param \Magento\View\Design\Theme\LabelFactory $themeLabelFactory * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Core\Model\Registry $registry, \Magento\Data\FormFactory $formFactory, - \Magento\Core\Model\Theme\LabelFactory $themeLabelFactory, + \Magento\View\Design\Theme\LabelFactory $themeLabelFactory, array $data = array() ) { $this->_themeLabelFactory = $themeLabelFactory; @@ -132,7 +132,7 @@ class Settings { /** @var \Magento\Data\Form $form */ $form = $this->_formFactory->create(array( - 'attributes' => array( + 'data' => array( 'id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', @@ -153,7 +153,7 @@ class Settings 'values' => $this->getTypesOptionsArray() )); - /** @var $label \Magento\Core\Model\Theme\Label */ + /** @var $label \Magento\View\Design\Theme\Label */ $label = $this->_themeLabelFactory->create(); $options = $label->getLabelsCollection(__('-- Please Select --')); $fieldset->addField('theme_id', 'select', array( diff --git a/app/code/Magento/Widget/Model/Config/Reader.php b/app/code/Magento/Widget/Model/Config/Reader.php index 85ff294a1d47fc3dfe04b2e04a66d59ad90b3919..b4ef3c1715a7e704791ecab1f7e5b29823652c29 100644 --- a/app/code/Magento/Widget/Model/Config/Reader.php +++ b/app/code/Magento/Widget/Model/Config/Reader.php @@ -46,6 +46,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -54,7 +55,8 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'widget.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( $fileResolver, @@ -63,7 +65,8 @@ class Reader extends \Magento\Config\Reader\Filesystem $validationState, $fileName, $idAttributes, - $domDocumentClass + $domDocumentClass, + $defaultScope ); } diff --git a/app/code/Magento/Wishlist/Controller/Index.php b/app/code/Magento/Wishlist/Controller/Index.php index 55d8ad606030248eda81b4ecf041721b3713e4ff..f8e648249225c8c7243a97478010b174592eb64c 100644 --- a/app/code/Magento/Wishlist/Controller/Index.php +++ b/app/code/Magento/Wishlist/Controller/Index.php @@ -613,7 +613,7 @@ class Index $item = $cart->getQuote()->getItemById($itemId); if (!$item) { throw new \Magento\Core\Exception( - __("The requested cart item doesn\'t exist.") + __("The requested cart item doesn't exist.") ); } diff --git a/app/code/Magento/Wishlist/view/frontend/item/list.phtml b/app/code/Magento/Wishlist/view/frontend/item/list.phtml index 0acbe76248f4b3216ebfc7be575ee0c7c7947788..c7e98f07708f5759427a42294707e7c0ce6ebc13 100644 --- a/app/code/Magento/Wishlist/view/frontend/item/list.phtml +++ b/app/code/Magento/Wishlist/view/frontend/item/list.phtml @@ -26,30 +26,32 @@ <?php $columns = $this->getColumns(); ?> -<table class="table data wishlist" id="wishlist-table"> - <thead> - <tr> - <?php foreach ($columns as $column): ?> - <th class="col <?php echo $column->getColClass(); ?>"><?php echo $column->getTitle();?></th> - <?php endforeach; ?> - </tr> - </thead> - <tbody> - <?php if (count($this->getItems())): ?> - <?php foreach ($this->getItems() as $item): ?> - <tr id="item_<?php echo $item->getId();?>"> - <?php foreach ($columns as $column): ?> - <td class="col <?php echo $column->getColClass(); ?>"> - <?php $column->setItem($item); echo $column->toHtml($item);?> - </td> - <?php endforeach; ?> - </tr> - <?php endforeach ?> - <?php else: ?> - <td colspan="<?php echo count($columns);?>" class="col empty"><?php echo __('This Wish List has no Items');?></td> - <?php endif; ?> - </tbody> -</table> +<div class="wishlist table wrapper"> + <table class="table data wishlist" id="wishlist-table"> + <thead> + <tr> + <?php foreach ($columns as $column): ?> + <th class="col <?php echo $column->getColClass(); ?>"><?php echo $column->getTitle();?></th> + <?php endforeach; ?> + </tr> + </thead> + <tbody> + <?php if (count($this->getItems())): ?> + <?php foreach ($this->getItems() as $item): ?> + <tr id="item_<?php echo $item->getId();?>"> + <?php foreach ($columns as $column): ?> + <td class="col <?php echo $column->getColClass(); ?>"> + <?php $column->setItem($item); echo $column->toHtml($item);?> + </td> + <?php endforeach; ?> + </tr> + <?php endforeach ?> + <?php else: ?> + <td colspan="<?php echo count($columns);?>" class="col empty"><?php echo __('This Wish List has no Items');?></td> + <?php endif; ?> + </tbody> + </table> +</div> <?php foreach ($columns as $column): ?> <?php echo $column->getAdditionalHtml();?> <?php endforeach; ?> diff --git a/app/code/Magento/Wishlist/view/frontend/shared.phtml b/app/code/Magento/Wishlist/view/frontend/shared.phtml index 2d3ab568ec3e72fe69b31a18db3b53fa43238102..47ad941d459a3d873098e1512e3ee6a558a17a54 100644 --- a/app/code/Magento/Wishlist/view/frontend/shared.phtml +++ b/app/code/Magento/Wishlist/view/frontend/shared.phtml @@ -28,50 +28,53 @@ $imageBlock = $this->getLayout()->createBlock('Magento\Catalog\Block\Product\Im <?php if ($this->hasWishlistItems()): ?> <form class="form shared wishlist" action="<?php echo $this->getUrl('*/*/update') ?>" method="post"> - <table class="table data wishlist" id="wishlist-table"> - <thead> - <tr> - <th class="col product"><?php echo __('Product') ?></th> - <th class="col comment"><?php echo __('Comment') ?></th> - <th class="col actions"><?php echo __('Add to Cart') ?></th> - </tr> - </thead> - <tbody> - <?php foreach($this->getWishlistItems() as $item): ?> - <?php - $product = $item->getProduct(); - $isVisibleProduct = $product->isVisibleInSiteVisibility(); - ?> + <div class="wishlist table wrapper"> + <table class="table data wishlist" id="wishlist-table"> + <thead> <tr> - <td class="col product"> - <a class="product photo" href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->escapeHtml($product->getName()) ?>"> - <?php echo $imageBlock->init($product, 'customer_shared_wishlist')->toHtml() ?> - </a> - <strong class="product name"> - <a href="<?php echo $this->getProductUrl($item) ?>"> - <?php echo $this->escapeHtml($product->getName()) ?> - </a> - </strong> - <?php echo $this->getPriceHtml($product) ?> - <?php echo $this->getDetailsHtml($item) ?> - </td> - <td class="col comment"><?php echo $this->getEscapedDescription($item) ?></td> - <td class="col actions"> - <?php if ($product->isSaleable()): ?> - <?php if ($isVisibleProduct): ?> - <button type="button" title="<?php echo __('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getSharedItemAddToCartUrl($item) ?>')" class="action tocart"> - <span><?php echo __('Add to Cart') ?></span> - </button> - <?php endif ?> - <?php endif; ?> - <a href="<?php echo $this->getAddToWishlistUrl($item) ?>" onclick="setLocation(this.href); return false;" class="action towishlist" data-action="add-to-wishlist"> - <span><?php echo __('Add to Wishlist') ?></span> - </a> - </td> + <th class="col product"><?php echo __('Product') ?></th> + <th class="col comment"><?php echo __('Comment') ?></th> + <th class="col actions"><?php echo __('Add to Cart') ?></th> </tr> - <?php endforeach ?> - </tbody> - </table> + </thead> + <tbody> + <?php foreach($this->getWishlistItems() as $item): ?> + <?php + $product = $item->getProduct(); + $isVisibleProduct = $product->isVisibleInSiteVisibility(); + ?> + <tr> + <td class="col product"> + <a class="product photo" href="<?php echo $this->getProductUrl($item) ?>" title="<?php echo $this->escapeHtml($product->getName()) ?>"> + <?php echo $imageBlock->init($product, 'customer_shared_wishlist')->toHtml() ?> + </a> + <strong class="product name"> + <a href="<?php echo $this->getProductUrl($item) ?>"> + <?php echo $this->escapeHtml($product->getName()) ?> + </a> + </strong> + <?php echo $this->getPriceHtml($product) ?> + <?php echo $this->getDetailsHtml($item) ?> + </td> + <td class="col comment"><?php echo $this->getEscapedDescription($item) ?></td> + <td class="col actions"> + <?php if ($product->isSaleable()): ?> + <?php if ($isVisibleProduct): ?> + <button type="button" title="<?php echo __('Add to Cart') ?>" onclick="setLocation('<?php echo $this->getSharedItemAddToCartUrl($item) ?>')" class="action tocart"> + <span><?php echo __('Add to Cart') ?></span> + </button> + <?php endif ?> + <?php endif; ?> + <a href="<?php echo $this->getAddToWishlistUrl($item) ?>" onclick="setLocation(this.href); return false;" class="action towishlist" data-action="add-to-wishlist"> + <span><?php echo __('Add to Wishlist') ?></span> + </a> + </td> + </tr> + <?php endforeach ?> + </tbody> + </table> + </div> + <div class="actions"> <?php if($this->isSaleable()):?> <div class="primary"> diff --git a/app/code/Magento/Wishlist/view/frontend/view.phtml b/app/code/Magento/Wishlist/view/frontend/view.phtml index b91458225084173b1dd3e4c52a1ef9d0816d2759..e564596675f8f74ec2b232cae95b526095fd4d39 100644 --- a/app/code/Magento/Wishlist/view/frontend/view.phtml +++ b/app/code/Magento/Wishlist/view/frontend/view.phtml @@ -38,7 +38,7 @@ <?php $this->getChildBlock('items')->setItems($this->getWishlistItems()); ?> <?php echo $this->getChildHtml('items');?> <?php else: ?> - <p class="empty"><?php echo __('You have no items in your wish list.') ?></p> + <div class="message info empty"><span><?php echo __('You have no items in your wish list.') ?></span></div> <?php endif ?> <?php echo $this->getChildHtml('bottom'); ?> <div class="actions"> diff --git a/app/design/adminhtml/magento_backend/css/styles.css b/app/design/adminhtml/magento_backend/css/styles.css index a3d6613096f21acc00710b659b6476671088d56d..faccd991c812bec0cbc7ed73c52d36aaf65042cb 100644 --- a/app/design/adminhtml/magento_backend/css/styles.css +++ b/app/design/adminhtml/magento_backend/css/styles.css @@ -155,7 +155,6 @@ button.primary, .adminhtml-system-variable-index .page-actions .add, .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, -.adminhtml-webhook-subscription-index .page-actions .add, .adminhtml-integration-index .page-actions .add, .adminhtml-system-design-theme-index .page-actions .add, .adminhtml-system-design-index .page-actions .add, @@ -317,9 +316,6 @@ button.primary:active, .adminhtml-user-role-index .page-actions .add:hover, .adminhtml-user-role-index .page-actions .add:focus, .adminhtml-user-role-index .page-actions .add:active, -.adminhtml-webhook-subscription-index .page-actions .add:hover, -.adminhtml-webhook-subscription-index .page-actions .add:focus, -.adminhtml-webhook-subscription-index .page-actions .add:active, .adminhtml-integration-index .page-actions .add:hover, .adminhtml-integration-index .page-actions .add:focus, .adminhtml-integration-index .page-actions .add:active, @@ -424,7 +420,6 @@ button.primary:active, .adminhtml-system-variable-index .page-actions .add:active, .adminhtml-user-index .page-actions .add:active, .adminhtml-user-role-index .page-actions .add:active, -.adminhtml-webhook-subscription-index .page-actions .add:active, .adminhtml-integration-index .page-actions .add:active, .adminhtml-system-design-theme-index .page-actions .add:active, .adminhtml-system-design-index .page-actions .add:active, @@ -488,7 +483,6 @@ button.primary:visited, .adminhtml-system-variable-index .page-actions .add:visited, .adminhtml-user-index .page-actions .add:visited, .adminhtml-user-role-index .page-actions .add:visited, -.adminhtml-webhook-subscription-index .page-actions .add:visited, .adminhtml-integration-index .page-actions .add:visited, .adminhtml-system-design-theme-index .page-actions .add:visited, .adminhtml-system-design-index .page-actions .add:visited, @@ -593,8 +587,6 @@ button.primary.disabled, .adminhtml-user-index .page-actions .add.disabled, .adminhtml-user-role-index .page-actions .add[disabled], .adminhtml-user-role-index .page-actions .add.disabled, -.adminhtml-webhook-subscription-index .page-actions .add[disabled], -.adminhtml-webhook-subscription-index .page-actions .add.disabled, .adminhtml-integration-index .page-actions .add[disabled], .adminhtml-integration-index .page-actions .add.disabled, .adminhtml-system-design-theme-index .page-actions .add[disabled], @@ -803,10 +795,6 @@ button.primary.disabled:active, .adminhtml-user-role-index .page-actions .add.disabled:hover, .adminhtml-user-role-index .page-actions .add[disabled]:active, .adminhtml-user-role-index .page-actions .add.disabled:active, -.adminhtml-webhook-subscription-index .page-actions .add[disabled]:hover, -.adminhtml-webhook-subscription-index .page-actions .add.disabled:hover, -.adminhtml-webhook-subscription-index .page-actions .add[disabled]:active, -.adminhtml-webhook-subscription-index .page-actions .add.disabled:active, .adminhtml-integration-index .page-actions .add[disabled]:hover, .adminhtml-integration-index .page-actions .add.disabled:hover, .adminhtml-integration-index .page-actions .add[disabled]:active, @@ -925,7 +913,6 @@ button.primary, .adminhtml-system-variable-index .page-actions .add, .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, -.adminhtml-webhook-subscription-index .page-actions .add, .adminhtml-integration-index .page-actions .add, .adminhtml-system-design-theme-index .page-actions .add, .adminhtml-system-design-index .page-actions .add, @@ -979,7 +966,6 @@ button.primary, .adminhtml-system-variable-index .page-actions .add, .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, -.adminhtml-webhook-subscription-index .page-actions .add, .adminhtml-integration-index .page-actions .add, .adminhtml-system-design-theme-index .page-actions .add, .adminhtml-system-design-index .page-actions .add, @@ -1072,8 +1058,6 @@ button.primary:hover, .adminhtml-user-index .page-actions .add:hover, .adminhtml-user-role-index .page-actions .add:focus, .adminhtml-user-role-index .page-actions .add:hover, -.adminhtml-webhook-subscription-index .page-actions .add:focus, -.adminhtml-webhook-subscription-index .page-actions .add:hover, .adminhtml-integration-index .page-actions .add:focus, .adminhtml-integration-index .page-actions .add:hover, .adminhtml-system-design-theme-index .page-actions .add:focus, @@ -1152,7 +1136,6 @@ button.primary:active, .adminhtml-system-variable-index .page-actions .add:active, .adminhtml-user-index .page-actions .add:active, .adminhtml-user-role-index .page-actions .add:active, -.adminhtml-webhook-subscription-index .page-actions .add:active, .adminhtml-integration-index .page-actions .add:active, .adminhtml-system-design-theme-index .page-actions .add:active, .adminhtml-system-design-index .page-actions .add:active, @@ -1211,7 +1194,6 @@ button.primary:visited, .adminhtml-system-variable-index .page-actions .add:visited, .adminhtml-user-index .page-actions .add:visited, .adminhtml-user-role-index .page-actions .add:visited, -.adminhtml-webhook-subscription-index .page-actions .add:visited, .adminhtml-integration-index .page-actions .add:visited, .adminhtml-system-design-theme-index .page-actions .add:visited, .adminhtml-system-design-index .page-actions .add:visited, @@ -1370,10 +1352,6 @@ button.primary.disabled:active, .adminhtml-user-role-index .page-actions .add.disabled:hover, .adminhtml-user-role-index .page-actions .add[disabled]:active, .adminhtml-user-role-index .page-actions .add.disabled:active, -.adminhtml-webhook-subscription-index .page-actions .add[disabled]:hover, -.adminhtml-webhook-subscription-index .page-actions .add.disabled:hover, -.adminhtml-webhook-subscription-index .page-actions .add[disabled]:active, -.adminhtml-webhook-subscription-index .page-actions .add.disabled:active, .adminhtml-integration-index .page-actions .add[disabled]:hover, .adminhtml-integration-index .page-actions .add.disabled:hover, .adminhtml-integration-index .page-actions .add[disabled]:active, @@ -1484,7 +1462,6 @@ button.primary.disabled:active, .adminhtml-system-variable-index .page-actions .add, .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, -.adminhtml-webhook-subscription-index .page-actions .add, .adminhtml-integration-index .page-actions .add, .adminhtml-system-design-theme-index .page-actions .add, .adminhtml-system-design-index .page-actions .add, @@ -1527,7 +1504,6 @@ button.primary.disabled:active, .adminhtml-system-variable-index .page-actions .add, .adminhtml-user-index .page-actions .add, .adminhtml-user-role-index .page-actions .add, -.adminhtml-webhook-subscription-index .page-actions .add, .adminhtml-integration-index .page-actions .add, .adminhtml-system-design-theme-index .page-actions .add, .adminhtml-system-design-index .page-actions .add, @@ -1578,7 +1554,6 @@ button.primary.disabled:active, .adminhtml-system-variable-index .page-actions .add:focus, .adminhtml-user-index .page-actions .add:focus, .adminhtml-user-role-index .page-actions .add:focus, -.adminhtml-webhook-subscription-index .page-actions .add:focus, .adminhtml-integration-index .page-actions .add:focus, .adminhtml-system-design-theme-index .page-actions .add:focus, .adminhtml-system-design-index .page-actions .add:focus, @@ -1624,7 +1599,6 @@ button.primary.disabled:active, .adminhtml-system-variable-index .page-actions .add > span, .adminhtml-user-index .page-actions .add > span, .adminhtml-user-role-index .page-actions .add > span, -.adminhtml-webhook-subscription-index .page-actions .add > span, .adminhtml-integration-index .page-actions .add > span, .adminhtml-system-design-theme-index .page-actions .add > span, .adminhtml-system-design-index .page-actions .add > span, @@ -1673,7 +1647,6 @@ button.primary.disabled:active, .adminhtml-system-variable-index .page-actions .add > span:before, .adminhtml-user-index .page-actions .add > span:before, .adminhtml-user-role-index .page-actions .add > span:before, -.adminhtml-webhook-subscription-index .page-actions .add > span:before, .adminhtml-integration-index .page-actions .add > span:before, .adminhtml-system-design-theme-index .page-actions .add > span:before, .adminhtml-system-design-index .page-actions .add > span:before, @@ -1733,7 +1706,6 @@ button.primary.disabled:active, .eq-ie9 .adminhtml-system-variable-index .page-actions .add > span:before, .eq-ie9 .adminhtml-user-index .page-actions .add > span:before, .eq-ie9 .adminhtml-user-role-index .page-actions .add > span:before, -.eq-ie9 .adminhtml-webhook-subscription-index .page-actions .add > span:before, .eq-ie9 .adminhtml-integration-index .page-actions .add > span:before, .eq-ie9 .adminhtml-system-design-theme-index .page-actions .add > span:before, .eq-ie9 .adminhtml-system-design-index .page-actions .add > span:before, @@ -6696,7 +6668,6 @@ table .col-draggable .draggable-handle { .adminhtml-system-variable-index .col-1-layout, .adminhtml-user-index .col-1-layout, .adminhtml-user-role-index .col-1-layout, -.adminhtml-webhook-subscription-index .col-1-layout, .adminhtml-integration-index .col-1-layout, .adminhtml-system-design-theme-index .col-1-layout, .adminhtml-system-design-index .col-1-layout, @@ -6780,7 +6751,6 @@ table .col-draggable .draggable-handle { .adminhtml-system-variable-index .grid-actions, .adminhtml-user-index .grid-actions, .adminhtml-user-role-index .grid-actions, -.adminhtml-webhook-subscription-index .grid-actions, .adminhtml-integration-index .grid-actions, .adminhtml-system-design-theme-index .grid-actions, .adminhtml-system-design-index .grid-actions, @@ -6825,7 +6795,6 @@ table .col-draggable .draggable-handle { .adminhtml-system-variable-index .page-actions.fixed, .adminhtml-user-index .page-actions.fixed, .adminhtml-user-role-index .page-actions.fixed, -.adminhtml-webhook-subscription-index .page-actions.fixed, .adminhtml-integration-index .page-actions.fixed, .adminhtml-system-design-theme-index .page-actions.fixed, .adminhtml-system-design-index .page-actions.fixed, @@ -6871,7 +6840,6 @@ table .col-draggable .draggable-handle { .adminhtml-system-variable-index .page-actions, .adminhtml-user-index .page-actions, .adminhtml-user-role-index .page-actions, -.adminhtml-webhook-subscription-index .page-actions, .adminhtml-integration-index .page-actions, .adminhtml-system-design-theme-index .page-actions, .adminhtml-system-design-index .page-actions, diff --git a/app/design/adminhtml/magento_backend/less/styles/admin.less b/app/design/adminhtml/magento_backend/less/styles/admin.less index 7c81ffd765f8541b652f1fb9b10d1467fa4496f7..a3ae1bf4600245410a958d5b7e6ab6f317017e30 100644 --- a/app/design/adminhtml/magento_backend/less/styles/admin.less +++ b/app/design/adminhtml/magento_backend/less/styles/admin.less @@ -5595,7 +5595,6 @@ button, .adminhtml-system-variable-index, .adminhtml-user-index, .adminhtml-user-role-index, -.adminhtml-webhook-subscription-index, .adminhtml-integration-index, // content .adminhtml-system-design-theme-index, @@ -5629,7 +5628,8 @@ button, // Primary Add Split Button or Primary Split Button .catalog-product-new, .catalog-product-edit, -.catalog-product-index { +.catalog-product-index, +.adminhtml-integration-new { .actions-split { &:extend(.PrimarySplitButton all); } diff --git a/app/design/frontend/magento_plushe/Magento_Bundle/layout/review_product_list.xml b/app/design/frontend/magento_plushe/Magento_Bundle/layout/review_product_list.xml deleted file mode 100644 index db29516ed066db65ec89958b86f21dc0a5534529..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Bundle/layout/review_product_list.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <remove name="customize.button"/> -</layout> diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml b/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml index 1efc4fc24a7dc7ff68cc9d4773e8977a18440e89..59e97c215458145e6e2ba1362eacf9766c5edb9b 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml +++ b/app/design/frontend/magento_plushe/Magento_Catalog/layout/catalog_product_view.xml @@ -26,6 +26,5 @@ <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <move element="product.info" destination="product.info.main" after="product.tierprices"/> <move element="page.main.title" destination="product.info.main" before="-"/> - <!-- <remove name="product.info.sku"/> --> <move element="product.info.overview" destination="product.info.details" before="-" as="product_overview"/> </layout> diff --git a/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml b/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml index 1af97e55c26e786a99b0929655d7c71591aed612..d1ba45194582e9b1294b10c86ed0203a788acdca 100644 --- a/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml +++ b/app/design/frontend/magento_plushe/Magento_Catalog/layout/default.xml @@ -24,7 +24,6 @@ */ --> <layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <!-- <block class="Magento\Catalog\Block\Product\Compare\Sidebar" name="catalog.compare.link" template="Magento_Catalog::product/compare/link.phtml"/> --> <referenceBlock name="header.links"> <block class="Magento\View\Element\Template" name="catalog.compare.link" before="-" template="Magento_Catalog::product/compare/link.phtml"/> </referenceBlock> diff --git a/app/design/frontend/magento_plushe/Magento_Cms/default/footerbanners.phtml b/app/design/frontend/magento_plushe/Magento_Cms/default/footerbanners.phtml deleted file mode 100644 index 5c3641cab134036f2ee294a7249b98b9eaa117ce..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Cms/default/footerbanners.phtml +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="widget widget-static-block"> - <div class="place locator"> - <strong>plushe Near You:</strong> <a class="link locator" href="#">Find stores and retailers.</a> - </div> - <div class="place blog"> - <a class="link blog" href="#">Blog</a> - </div> - <div class="place info"> - <img src="<?php echo $this->getViewFileUrl('images/info_photo.jpg')?>" alt="plushe" align="left" /> <strong>Our Story:</strong> - <p>Use this space to tell customers a little about your business, such as when you opened. And why.</p> - </div> -</div> diff --git a/app/design/frontend/magento_plushe/Magento_Cms/default/home.phtml b/app/design/frontend/magento_plushe/Magento_Cms/default/home.phtml deleted file mode 100644 index 781ecd46d401388c2db786fc5bd3f551930f3569..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Cms/default/home.phtml +++ /dev/null @@ -1,53 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<div class="home main slider"> - <div class="banner main"> - <img class="banner image" alt="plushe" src="<?php echo $this->getViewFileUrl('images/main_image1.jpg') ?>" /> - <div class="banner content"> - <span contenteditable="true" class="banner text">NEW ARRIVALS</span> - <a class="action banner" href="#"><span contenteditable="true">Shop now</span></a> - </div> - </div> -</div> - -<div class="home banners"> - <a href="#" class="banner link style1"> - <img class="banner image" alt="plushe" src="<?php echo $this->getViewFileUrl('images/banner1.jpg') ?>" /> - <span contenteditable="true" class="banner text">MY plushe</span> - </a> - <a href="#" class="banner link style2"> - <img class="banner image" alt="plushe" src="<?php echo $this->getViewFileUrl('images/banner2.jpg') ?>" /> - <span contenteditable="true" class="banner text">FOOTWEAR</span> - </a> - <a href="#" class="banner link style3"> - <img class="banner image" alt="plushe" src="<?php echo $this->getViewFileUrl('images/banner3.jpg') ?>" /> - <span contenteditable="true" class="banner text">SPRING <b>SALE</b></span> - </a> - <a href="#" class="banner link style4"> - <img class="banner image" alt="plushe" src="<?php echo $this->getViewFileUrl('images/banner4.jpg') ?>" /> - <span contenteditable="true" class="banner text">ITEM OF THE WEEK</span> - </a> -</div> diff --git a/app/design/frontend/magento_plushe/Magento_Contacts/layout/contacts_index_index.xml b/app/design/frontend/magento_plushe/Magento_Contacts/layout/contacts_index_index.xml deleted file mode 100644 index 58a124e9c1548c48d2f9940eb8fde0d14e697d6c..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Contacts/layout/contacts_index_index.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="page_one_column"/> -</layout> diff --git a/app/design/frontend/magento_plushe/Magento_Customer/layout/customer_account.xml b/app/design/frontend/magento_plushe/Magento_Customer/layout/customer_account.xml deleted file mode 100644 index e8fc444df24a708e6667fc38d6db5982d1ec93a1..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Customer/layout/customer_account.xml +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="page_two_columns_left"/> - <referenceBlock name="root"> - <action method="addBodyClass"> - <argument name="class" xsi:type="string">account</argument> - </action> - </referenceBlock> -</layout> diff --git a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml b/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml index fe3e588b0c88abc0a969a275538e588fc47af046..f4023d945d8af6511b2eaa0fa993ca183e2f61e5 100644 --- a/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml +++ b/app/design/frontend/magento_plushe/Magento_Customer/layout/default.xml @@ -33,6 +33,7 @@ </block> <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link-login"/> </referenceBlock> + <move element="register-link" destination="header.links"/> <move element="top.links" destination="customer"/> <move element="authorization-link" destination="top.links" after="-"/> </layout> diff --git a/app/design/frontend/magento_plushe/Magento_PageCache/layout/default.xml b/app/design/frontend/magento_plushe/Magento_PageCache/layout/default.xml deleted file mode 100644 index f3514857ff87e750cf19a2ca59e176a5ddc38462..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_PageCache/layout/default.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <move element="external.pagecache.cookie" destination="content.bottom" after="-"/> -</layout> diff --git a/app/design/frontend/magento_plushe/Magento_Rating/detailed.phtml b/app/design/frontend/magento_plushe/Magento_Rating/detailed.phtml deleted file mode 100644 index e0321a261957cff4d4a8216c53e1ab8eb555d2dd..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Rating/detailed.phtml +++ /dev/null @@ -1,45 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category design - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ -?> -<?php if(!empty($collection) && $collection->getSize()): ?> - <table class="ratings-table data-table review-summary-table"> - <col width="1" /> - <col /> - <tbody> - <?php foreach ($collection as $_rating): ?> - <?php if($_rating->getSummary()): ?> - <tr> - <th class="label"><?php echo __($this->escapeHtml($_rating->getRatingCode())) ?></th> - <td class="value"> - <div class="rating-box"> - <div class="rating" style="width:<?php echo ceil($_rating->getSummary()) ?>%;"></div> - </div> - </td> - </tr> - <?php endif; ?> - <?php endforeach; ?> - </tbody> - </table> -<?php endif; ?> diff --git a/app/design/frontend/magento_plushe/Magento_Review/layout/review_product_view.xml b/app/design/frontend/magento_plushe/Magento_Review/layout/review_product_view.xml deleted file mode 100644 index 58a124e9c1548c48d2f9940eb8fde0d14e697d6c..0000000000000000000000000000000000000000 --- a/app/design/frontend/magento_plushe/Magento_Review/layout/review_product_view.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <update handle="page_one_column"/> -</layout> diff --git a/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml b/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml index f5b5eb31ee764e6f883452bb9e2df89ca80546b3..53f96ed101a69c60bb2b5e8e66ed46df90154532 100644 --- a/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml +++ b/app/design/frontend/magento_plushe/Magento_Theme/layout/default.xml @@ -29,56 +29,7 @@ <argument name="theme_name" xsi:type="string">plushe</argument> </arguments> </referenceBlock> - <referenceBlock name="head"> - <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-css"> - <arguments> - <argument name="file" xsi:type="string">css/styles.css</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-matchmedia-js"> - <arguments> - <argument name="file" xsi:type="string">js/matchMedia.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-responsive-js"> - <arguments> - <argument name="file" xsi:type="string">js/responsive.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-head-js"> - <arguments> - <argument name="file" xsi:type="string">js/head.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-jquery-dropdowns-js"> - <arguments> - <argument name="file" xsi:type="string">js/jquery.dropdowns.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-tabs-js"> - <arguments> - <argument name="file" xsi:type="string">js/tabs.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-navigation-menu-js"> - <arguments> - <argument name="file" xsi:type="string">js/navigation-menu.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-theme-js"> - <arguments> - <argument name="file" xsi:type="string">js/theme.js</argument> - </arguments> - </block> - <block class="Magento\Theme\Block\Html\Head\Script" name="js-selectivizr-js"> - <arguments> - <argument name="file" xsi:type="string">js/selectivizr.js</argument> - <argument name="properties" xsi:type="array"> - <item name="ie_condition" xsi:type="string">lt IE 9</item> - </argument> - </arguments> - </block> - </referenceBlock> + <referenceContainer name="header"> <block class="Magento\View\Element\Html\Links" name="header.links" after="minicart"> <arguments> diff --git a/app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml b/app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml new file mode 100644 index 0000000000000000000000000000000000000000..4a00a90071c9b6398bb84ac17ee516c2f81d4e4c --- /dev/null +++ b/app/design/frontend/magento_plushe/Magento_Theme/layout/default_head_blocks.xml @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<!-- +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ +--> +<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <referenceBlock name="head"> + <block class="Magento\Theme\Block\Html\Head\Css" name="css-styles-css"> + <arguments> + <argument name="file" xsi:type="string">css/styles.css</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-matchmedia-js"> + <arguments> + <argument name="file" xsi:type="string">js/matchMedia.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-responsive-js"> + <arguments> + <argument name="file" xsi:type="string">js/responsive.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-head-js"> + <arguments> + <argument name="file" xsi:type="string">js/head.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-jquery-dropdowns-js"> + <arguments> + <argument name="file" xsi:type="string">js/jquery.dropdowns.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-tabs-js"> + <arguments> + <argument name="file" xsi:type="string">js/tabs.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-navigation-menu-js"> + <arguments> + <argument name="file" xsi:type="string">js/navigation-menu.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-theme-js"> + <arguments> + <argument name="file" xsi:type="string">js/theme.js</argument> + </arguments> + </block> + <block class="Magento\Theme\Block\Html\Head\Script" name="js-selectivizr-js"> + <arguments> + <argument name="file" xsi:type="string">js/selectivizr.js</argument> + <argument name="properties" xsi:type="array"> + <item name="ie_condition" xsi:type="string">lt IE 9</item> + </argument> + </arguments> + </block> + </referenceBlock> +</layout> diff --git a/app/design/frontend/magento_plushe/css/styles.css b/app/design/frontend/magento_plushe/css/styles.css index 850ec7b1f98fb1013f65b1dc43c5e93d13d7090b..019d1f28a4a9d6a3de5fd408ac54d3b56673437e 100644 --- a/app/design/frontend/magento_plushe/css/styles.css +++ b/app/design/frontend/magento_plushe/css/styles.css @@ -4470,6 +4470,7 @@ body { border: 1px solid #c2c2c2; border-width: 0 1px 1px; border-radius: 0 0 5px 5px; + overflow: hidden; z-index: 5; } .block.search .search.autocomplete ul { @@ -5681,6 +5682,9 @@ body { font-size: 24px; color: #da370a; } +.order.data.items tfoot .amount { + text-align: right; +} .order.review.data th.col.price, .order.review.data th.col.subtotal { text-align: right; @@ -6912,7 +6916,7 @@ body { .minicart.wrapper .block.minicart > .content > .actions .primary .checkout.paypal:after { float: none; } -.minicart.wrapper .block.minicart > .content > .actions .primary .checkout.paypal + .action.checkout { +.minicart.wrapper .block.minicart > .content > .actions .primary .action.checkout { float: right; } .block.minicart .products.minilist { @@ -10997,6 +11001,9 @@ img[align="right"] { .block.account.nav .item.current { color: #da370a; } +.block.account.nav .item.current a { + color: #da370a; +} .block.account.nav .item strong { font-weight: 400; } @@ -11280,6 +11287,7 @@ img[align="right"] { color: #675f55; border: none; background: none; + padding: 0 20px 0 5px; } /* Popular Search Terms @@ -11826,6 +11834,10 @@ img[align="right"] { .map.popup .price-including-tax { display: block; } +.map.popup + .category.view { + position: relative; + z-index: 1; +} .mobileAction { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; @@ -11841,6 +11853,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; } .mobileAction span { font-size: 18px; @@ -11860,6 +11873,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -11881,6 +11895,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #c2c2c2; color: #ffffff; } @@ -11985,6 +12000,12 @@ img[align="right"] { visibility: visible; width: 100%; } + .products.wrapper .products.list .item .product.actions .action.tocart { + padding: 10px 11px; + } + .products.wrapper .products.list .item .product.actions .primary { + margin: 12px 0; + } .products.wrapper .products.list .item .secondary { margin-left: 0; border: none; @@ -12136,10 +12157,6 @@ img[align="right"] { .category.view .products.wrapper.grid .products.list .item.product .secondary { background: transparent; } - .search.results .products.wrapper.grid .products.list .item.product .secondary .action.tocompare, - .category.view .products.wrapper.grid .products.list .item.product .secondary .action.tocompare { - display: none; - } .search.results .products.wrapper.list .products.list .item.product .product.photo, .category.view .products.wrapper.list .products.list .item.product .product.photo { float: none; @@ -12217,7 +12234,7 @@ img[align="right"] { display: block; height: 35px; padding: 0; - margin: 15px 12px 0 0; + margin: 15px -15px 0 0; float: none; text-align: left; position: relative; @@ -12263,7 +12280,7 @@ img[align="right"] { .header .block.search .control .input-text:focus { margin-right: 0; width: 100%; - padding: 0 65px 0 0; + padding: 0 38px 0 0; border-color: #c2c2c2; } .header .block.search .actions { @@ -12316,6 +12333,7 @@ img[align="right"] { .header .block.search .search.autocomplete { top: 35px !important; width: 100% !important; + border: none; } .header .minicart.wrapper { position: absolute; @@ -12497,6 +12515,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -12556,6 +12575,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #c2c2c2; color: #ffffff; } @@ -12629,9 +12649,12 @@ img[align="right"] { .cart.totals .amount, .cart.totals td:first-child strong { font-size: 18px; + line-height: 30px; + vertical-align: bottom; } .cart.totals td:not(:first-child) strong { font-size: 30px; + vertical-align: bottom; } .cart.table.wrapper thead { display: none; @@ -12655,13 +12678,20 @@ img[align="right"] { } .cart.table.wrapper .col.item .product.name { font-size: 18px; - margin: 0 0 2px; + margin: 0 0 10px; } .cart.table.wrapper .col.item dl { margin: 0; + padding-bottom: 12px; + clear: both; } - .cart.table.wrapper .col.item dd { - margin-bottom: 0; + .cart.table.wrapper .col.item dl dt, + .cart.table.wrapper .col.item dl dd { + line-height: 1.1; + } + .cart.table.wrapper .col.item dl dd { + margin-bottom: 12px; + margin-left: 0; } .cart.table.wrapper .col.price, .cart.table.wrapper .col.subtotal { @@ -12683,6 +12713,9 @@ img[align="right"] { font-size: 12px; margin-right: 7px; } + .cart.table.wrapper .col.price { + margin-top: -30px; + } .cart.table.wrapper .col.price.excl.tax + .col.price.incl.tax:before { visibility: hidden; } @@ -12860,37 +12893,37 @@ img[align="right"] { .opc.wrapper .gift-messages-form .details { padding-left: 70px; } - .opc.wrapper .sp-methods dt { + .opc.wrapper .items.methods.payment dt { font-weight: normal; margin: 0 0 10px; } - .opc.wrapper .sp-methods dd { + .opc.wrapper .items.methods.payment dd { margin: 0; padding: 0; } - .opc.wrapper .sp-methods dd > ul { + .opc.wrapper .items.methods.payment dd > ul { list-style: none; margin: 0; padding: 5px 10px 15px 20px; } - .opc.wrapper .sp-methods dd > ul > li { + .opc.wrapper .items.methods.payment dd > ul > li { margin: 5px 0 0; } - .opc.wrapper .sp-methods dd > ul label { + .opc.wrapper .items.methods.payment dd > ul label { display: block; } - .opc.wrapper .sp-methods dd > ul label em { + .opc.wrapper .items.methods.payment dd > ul label em { display: none; } - .opc.wrapper .sp-methods dd > ul label.required:after { + .opc.wrapper .items.methods.payment dd > ul label.required:after { color: #da370a; content: "*"; } - .opc.wrapper .sp-methods dd > ul .input-box > input, - .opc.wrapper .sp-methods dd > ul .input-box > select { + .opc.wrapper .items.methods.payment dd > ul .input-box > input, + .opc.wrapper .items.methods.payment dd > ul .input-box > select { width: 100%; } - .opc.wrapper .sp-methods dd > ul .v-fix { + .opc.wrapper .items.methods.payment dd > ul .v-fix { display: inline-block; } .opc.wrapper .order-review { @@ -12900,23 +12933,21 @@ img[align="right"] { overflow-x: scroll; margin-bottom: 10px; } - .opc.wrapper .order-review .order.review.data th.col.item, - .opc.wrapper .order-review .order.review.data td:first-child { + .opc.wrapper .order-review .order.review.data th, + .opc.wrapper .order-review .order.review.data td { padding-left: 0; - padding-right: 10px; + padding-right: 5px; + text-align: left; } - .opc.wrapper .order-review .order.review.data .items.data td { - padding: 10px 5px 5px; + .opc.wrapper .order-review .order.review.data th.qty, + .opc.wrapper .order-review .order.review.data td.qty { + text-align: center; } .opc.wrapper .order-review th.col.item, .opc.wrapper .order-review th.col.price, .opc.wrapper .order-review th.col.subtotal { white-space: nowrap; } - .opc.wrapper .order-review th.col.price, - .opc.wrapper .order-review th.col.subtotal { - text-align: center; - } .opc.wrapper .order-review th.excl.tax span, .opc.wrapper .order-review th.col.incl.tax span { font-size: 12px; @@ -12988,16 +13019,17 @@ img[align="right"] { font-weight: 600; } .block.progress.onepage > .title:before { - content: "\e00d"; - font-family: "icons"; + content: "+"; + font-family: Arial, sans-serif; font-weight: 400; - font-size: 20px; + font-size: 30px; position: absolute; right: 20px; - top: 9px; + top: 2px; } .block.progress.onepage > .title.active:before { - content: "\e03a"; + top: 1px; + content: "–"; } .block.progress.onepage > .content { background: #ffffff; @@ -13014,14 +13046,18 @@ img[align="right"] { } .block.progress.onepage dt > a { font-weight: 400; + font-size: 14px; margin-left: 20px; text-decoration: underline; } - .block.progress.onepage dd { + .block.progress.onepage dd, + .block.progress.onepage .complete .payment .title { font-size: 16px; line-height: 1.4; + font-weight: 400; } - .block.progress.onepage dd:last-child { + .block.progress.onepage dd:last-child, + .block.progress.onepage .complete .payment .title:last-child { margin: 0; } .block.progress.onepage .separator { @@ -13165,6 +13201,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -13240,6 +13277,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -13360,6 +13398,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -13491,6 +13530,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -13539,8 +13579,32 @@ img[align="right"] { display: block; width: 100%; float: none; + margin-top: 20px; + } + .account .column.main .my-account .actions .primary, + .account .column.main .block .actions .primary, + .account .column.main .form .actions .primary, + .account .column.main .my-account .actions .secondary, + .account .column.main .block .actions .secondary, + .account .column.main .form .actions .secondary { + float: none; + } + .account .column.main .my-account .actions .secondary, + .account .column.main .block .actions .secondary, + .account .column.main .form .actions .secondary { + margin-bottom: 15px; + } + .account .column.main .my-account .actions .secondary .action.back, + .account .column.main .block .actions .secondary .action.back, + .account .column.main .form .actions .secondary .action.back { + display: block; + float: none; + text-align: left; + } + .account > .block, + .account .my-account > .block { + margin-bottom: 20px; } - .my-account > .actions, .billing-agreements > .actions, .recurring-profiles .buttons-set, .newsletter.manage > .actions { @@ -13587,6 +13651,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -13630,6 +13695,9 @@ img[align="right"] { display: none; } /* Address book */ + .block.addresses:not(.dashboard) { + margin-bottom: 20px; + } .block.addresses:not(.dashboard) .content { padding: 20px; margin: 0 -20px; @@ -13645,7 +13713,7 @@ img[align="right"] { .form.newsletter .action.save { width: 100%; } - .my-account .tags.items.cloud .item { + .account .column.main .tags.items.cloud .item { font-size: 18px; } /* @@ -13671,49 +13739,28 @@ img[align="right"] { /* My Account -> Downloadable products -------------------------------------- */ - .downloadable-customer-products .my-account { + .downloadable-customer-products .column.main { overflow-x: scroll; } /* - My Account -> Wishlist + My Account -> My Reviews -------------------------------------- */ - .review-customer-index .my-account { + .review-customer-index .column.main { overflow-x: scroll; } /* - My Account -> My Reviews + My Account -> Wishlist -------------------------------------- */ - .my-account .form.wishlist.items { + .account .form.wishlist.items .wishlist.table.wrapper { overflow-x: scroll; } - .my-account .form.wishlist.items .actions .primary { - float: none; - } - .my-account .form.wishlist.items .actions .primary .action { - -moz-box-sizing: border-box; - -webkit-box-sizing: border-box; - -ms-box-sizing: border-box; - box-sizing: border-box; - display: block; - margin: 0 auto 15px; - padding: 10px; - width: 100%; - max-width: 100%; - line-height: 1; - float: none; - text-align: center; - text-decoration: none; - text-transform: uppercase; - background-color: #da370a; - color: #ffffff; - } - .my-account .form.wishlist.items .actions .primary .action span { - font-size: 18px; + .account .form.wishlist.items .wishlist.table.wrapper thead { + display: none; } - .my-account .form.wishlist.items .actions .secondary { - float: none; + .account .form.wishlist.items .wishlist.table.wrapper textarea { + width: 15em; } - .my-account .form.wishlist.items .actions .secondary .action { + .account .form.wishlist.items .actions .primary .action { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; -ms-box-sizing: border-box; @@ -13728,17 +13775,18 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; - background-color: #c2c2c2; + border: none; + background-color: #da370a; color: #ffffff; } - .my-account .form.wishlist.items .actions .secondary .action span { + .account .form.wishlist.items .actions .primary .action span { font-size: 18px; } /* * My Account -> My orders * ----------------------------------------------------------------------------- */ - .sales-order-history .my-account { + .sales-order-history .column.main { overflow-x: scroll; } .order.details .order.toolbar { @@ -13792,7 +13840,6 @@ img[align="right"] { margin: 0 -20px 20px; } .order.details > .actions { - text-align: center; margin-bottom: 20px; } .order.details.items { @@ -13871,9 +13918,18 @@ img[align="right"] { clear: right; float: right; } + .product.info.main .stock.alert { + float: none; + } .product.info.main .prices.tier { clear: both; } + .product.info.main .product.alert { + margin: 10px 0; + } + .product.info.main .product.attibute.sku { + margin-bottom: 10px; + } .product.info.main .product.add.form { clear: both; } @@ -14060,8 +14116,31 @@ img[align="right"] { .product.info.detailed .block.add.review .field:not(.ratings) { width: 100%; } - .product.info.detailed .block.add.review .actions { - text-align: left; + .product.info.detailed .block.add.review .action.submit { + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; + display: block; + margin: 0 auto 15px; + padding: 10px; + width: 100%; + max-width: 100%; + line-height: 1; + float: none; + text-align: center; + text-decoration: none; + text-transform: uppercase; + border: none; + background-color: #da370a; + color: #ffffff; + margin-bottom: 10px; + } + .product.info.detailed .block.add.review .action.submit span { + font-size: 18px; + } + .product.info.detailed .block.reviews.list { + margin-left: 0; } .block.add.review { margin: 0; @@ -14222,6 +14301,9 @@ img[align="right"] { margin: 0; padding: 0; } + .bundle.options.container:before { + display: none; + } .bundle.options.container .product.add.form { margin: 0 -18px; padding: 20px 18px 280px; @@ -14231,6 +14313,11 @@ img[align="right"] { float: none; width: auto; } + .bundle.options.container .product.options.wrapper > .fieldset, + .bundle.options.container .product.options.bottom > .fieldset { + margin-left: 0; + margin-right: 0; + } .bundle.options.container .product.options.bottom .price-box { display: none; } @@ -14276,11 +14363,16 @@ img[align="right"] { .block.bundle.summary { background: #f8f8f8; margin: 0; + padding: 0 20px; float: none; position: absolute; margin: -280px 0 0; top: 100% !important; width: 90%; + -moz-box-sizing: border-box; + -webkit-box-sizing: border-box; + -ms-box-sizing: border-box; + box-sizing: border-box; } .block.bundle.summary .content { padding: 0; @@ -14293,6 +14385,10 @@ img[align="right"] { .block.bundle.summary .addto { display: none !important; } + .block.bundle.summary .price-box { + float: left; + width: 80%; + } .block.bundle.summary .price-box .price-label { display: block; float: none; @@ -14308,10 +14404,6 @@ img[align="right"] { padding-bottom: 0; border: none; } - .block.bundle.summary .box.tocart .field, - .block.bundle.summary .box.tocart .actions { - display: inline-block; - } .block.bundle.summary .box.tocart .control { width: auto; } @@ -14321,17 +14413,23 @@ img[align="right"] { -ms-box-sizing: border-box; box-sizing: border-box; width: 18%; + float: right; + padding-right: 0; } .block.bundle.summary .box.tocart input.qty { height: 49px; } .block.bundle.summary .box.tocart .actions { - width: 80%; + clear: both; + margin-right: 0; } .block.bundle.summary .box.tocart .actions .action.primary.tocart { padding: 18px 10px 14px; width: 100%; } + .fieldset.bundle.options .legend { + margin-left: 0; + } .fieldset.bundle.options > .field { margin: 0 0 20px; } @@ -14340,6 +14438,11 @@ img[align="right"] { font-size: 16px; width: 90%; } + .fieldset.bundle.options > .field input[type="checkbox"], + .fieldset.bundle.options > .field input[type="radio"] { + margin-top: 3px; + vertical-align: top; + } .fieldset.bundle.options > .field > .label { font-size: 22px; } @@ -14384,6 +14487,7 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #da370a; color: #ffffff; } @@ -14405,10 +14509,18 @@ img[align="right"] { text-align: center; text-decoration: none; text-transform: uppercase; + border: none; background-color: #c2c2c2; color: #ffffff; } .popup .actions .action.cancel span { font-size: 18px; } + /* + Magento_Catalog + Compare + -------------------------------------- */ + .catalog-product-compare-index .action.print { + margin: -20px 0 20px; + } } diff --git a/app/design/frontend/magento_plushe/less/responsive/responsive.less b/app/design/frontend/magento_plushe/less/responsive/responsive.less index eef42ae697114e7d0c46b7a742af9c1ca759cda0..71a7681111f95a5eee27b3dbca69fab29e175a45 100644 --- a/app/design/frontend/magento_plushe/less/responsive/responsive.less +++ b/app/design/frontend/magento_plushe/less/responsive/responsive.less @@ -23,6 +23,8 @@ // */ @breakPoint1: 640px; +@icon-expand-mobile: "+"; +@icon-collapse-mobile: "–"; .mobileAction { .box-sizing(); @@ -36,6 +38,7 @@ text-align: center; text-decoration: none; text-transform: uppercase; + border: none; span { font-size: 18px; } @@ -239,6 +242,12 @@ and (max-width : @breakPoint1) { visibility: visible; width: 100%; } + .action.tocart { + padding: 10px 11px + } + .primary { + margin: 12px 0; + } } .secondary { margin-left: 0; @@ -319,9 +328,6 @@ and (max-width : @breakPoint1) { .box-sizing(); .secondary { background: transparent; - .action.tocompare { - display: none; - } } } .products.wrapper.list .products.list .item.product { @@ -402,7 +408,7 @@ and (max-width : @breakPoint1) { display: block; height: 35px; padding: 0; - margin: 15px 12px 0 0; + margin: 15px -15px 0 0; float: none; text-align: left; position: relative; @@ -444,7 +450,7 @@ and (max-width : @breakPoint1) { &:focus { margin-right: 0; width: 100%; - padding: 0 65px 0 0; + padding: 0 38px 0 0; border-color: @primary3; } } @@ -470,6 +476,7 @@ and (max-width : @breakPoint1) { .search.autocomplete { top: 35px !important; width: 100% !important; + border: none; } } .minicart.wrapper { @@ -743,9 +750,12 @@ and (max-width : @breakPoint1) { .amount, td:first-child strong { font-size: 18px; + line-height: 30px; + vertical-align: bottom; } td:not(:first-child) strong { font-size: 30px; + vertical-align: bottom; } } @@ -774,16 +784,23 @@ and (max-width : @breakPoint1) { min-height: 60px; .product.name { font-size: 18px; - margin: 0 0 2px; + margin: 0 0 10px; } dl { margin: 0; + padding-bottom: 12px; + clear: both; + dt, + dd { + line-height: 1.1; + } + dd { + margin-bottom: 12px; + margin-left: 0; + } } - dd { - margin-bottom: 0; - } - } + } &.price, &.subtotal { display: block; @@ -802,7 +819,9 @@ and (max-width : @breakPoint1) { margin-right: 7px; } } - + &.price { + margin-top: -30px; + } &.price.excl.tax + .col.price.incl.tax { &:before { visibility: hidden; @@ -1020,7 +1039,7 @@ and (max-width : @breakPoint1) { } // Payment methods - .sp-methods { + .items.methods.payment { dt { font-weight: normal; margin: 0 0 10px; @@ -1064,13 +1083,14 @@ and (max-width : @breakPoint1) { margin-bottom: 10px; } .order.review.data { - th.col.item, - td:first-child { + th, + td { padding-left: 0; - padding-right: 10px; - } - .items.data td { - padding: 10px 5px 5px; + padding-right: 5px; + text-align: left; + &.qty { + text-align: center; + } } } th.col.item, @@ -1078,10 +1098,6 @@ and (max-width : @breakPoint1) { th.col.subtotal { white-space: nowrap; } - th.col.price, - th.col.subtotal { - text-align: center; - } th.excl.tax span, th.col.incl.tax span { font-size: 12px; @@ -1151,16 +1167,17 @@ and (max-width : @breakPoint1) { font-weight: 600; } &:before { - content: @icon-expand; - font-family: "icons"; + content: @icon-expand-mobile; + font-family: Arial, sans-serif; font-weight: 400; - font-size: 20px; + font-size: 30px; position: absolute; right: 20px; - top: 9px; + top: 2px; } &.active:before { - content: "\e03a"; + top: 1px; + content: @icon-collapse-mobile; } } > .content { @@ -1177,13 +1194,16 @@ and (max-width : @breakPoint1) { font-weight: 200; > a { font-weight: 400; + font-size: 14px; margin-left: 20px; text-decoration: underline; } } - dd { + dd, + .complete .payment .title { font-size: 16px; line-height: 1.4; + font-weight: 400; &:last-child { margin: 0; } @@ -1533,10 +1553,37 @@ Multishipping display: block; width: 100%; float: none; + margin-top: 20px; + } + } + + .account { + .column.main { + .my-account, + .block, + .form { + .actions { + .primary, + .secondary { + float: none; + } + .secondary { + margin-bottom: 15px; + .action.back { + display: block; + float: none; + text-align: left; + } + } + } + } + } + > .block, + .my-account > .block { + margin-bottom: 20px; } } - .my-account > .actions, .billing-agreements > .actions, .recurring-profiles .buttons-set, .newsletter.manage > .actions { @@ -1630,6 +1677,7 @@ Multishipping /* Address book */ .block.addresses:not(.dashboard) { + margin-bottom: 20px; .content { padding: 20px; margin: 0 -20px; @@ -1650,10 +1698,12 @@ Multishipping } } - .my-account { - .tags.items.cloud { - .item { - font-size: 18px; + .account { + .column.main { + .tags.items.cloud { + .item { + font-size: 18px; + } } } } @@ -1675,39 +1725,40 @@ Multishipping My Account -> Downloadable products -------------------------------------- */ .downloadable-customer-products { - .my-account { + .column.main { overflow-x: scroll; } } /* - My Account -> Wishlist + My Account -> My Reviews -------------------------------------- */ .review-customer-index { - .my-account { + .column.main { overflow-x: scroll; } } /* - My Account -> My Reviews + My Account -> Wishlist -------------------------------------- */ - .my-account { + .account { .form.wishlist.items { - overflow-x: scroll; + .wishlist.table.wrapper { + overflow-x: scroll; + thead { + display: none; + } + textarea { + width: 15em; + } + } .actions { .primary { - float: none; .action { .mobilePrimaryAction(); } } - .secondary { - float: none; - .action { - .mobileSecondaryAction(); - } - } } } } @@ -1717,7 +1768,7 @@ Multishipping * ----------------------------------------------------------------------------- */ .sales-order-history { - .my-account { + .column.main { overflow-x: scroll; } } @@ -1779,7 +1830,6 @@ Multishipping } } > .actions { - text-align: center; margin-bottom: 20px; } &.items { @@ -1874,10 +1924,19 @@ Multishipping .stock { clear: right; float: right; + &.alert { + float: none; + } } .prices.tier { clear: both; } + .product.alert { + margin: 10px 0; + } + .product.attibute.sku { + margin-bottom: 10px; + } .product.add.form { clear: both; .actions { @@ -2047,10 +2106,14 @@ Multishipping .field:not(.ratings) { width: 100%; } - .actions { - text-align: left; + .action.submit { + .mobilePrimaryAction(); + margin-bottom: 10px; } } + .block.reviews.list { + margin-left: 0; + } } .block.add.review { @@ -2193,6 +2256,9 @@ Multishipping .bundle.options.container { margin: 0; padding: 0; + &:before { + display: none; + } .product.add.form { margin: 0 -18px; padding: 20px 18px 280px; @@ -2201,6 +2267,10 @@ Multishipping .product.options.bottom { float: none; width: auto; + > .fieldset { + margin-left: 0; + margin-right: 0; + } } .product.options.bottom { .price-box { @@ -2222,11 +2292,13 @@ Multishipping .block.bundle.summary { background: @primary1; margin: 0; + padding: 0 20px; float: none; position: absolute; margin: -280px 0 0; top: 100% !important; width: 90%; + .box-sizing(); .content { padding: 0; } @@ -2239,6 +2311,8 @@ Multishipping display: none !important; } .price-box { + float: left; + width: 80%; .price-label { display: block; float: none; @@ -2254,22 +2328,21 @@ Multishipping .box.tocart { padding-bottom: 0; border: none; - .field, - .actions { - display: inline-block; - } .control { width: auto; } .field.qty { .box-sizing(); width: 18%; + float: right; + padding-right: 0; } input.qty { height: 49px; } .actions { - width: 80%; + clear: both; + margin-right: 0; .action.primary.tocart { padding: 18px 10px 14px; width: 100%; @@ -2279,6 +2352,9 @@ Multishipping } .fieldset.bundle.options { + .legend { + margin-left: 0; + } > .field { margin: 0 0 20px; .label { @@ -2286,6 +2362,11 @@ Multishipping font-size: 16px; width: 90%; } + input[type="checkbox"], + input[type="radio"] { + margin-top: 3px; + vertical-align: top; + } > .label { font-size: 22px; } @@ -2342,4 +2423,13 @@ Multishipping } } + /* + Magento_Catalog Compare +-------------------------------------- */ + .catalog-product-compare-index { + .action.print { + margin: -20px 0 20px; + } + } + } \ No newline at end of file diff --git a/app/design/frontend/magento_plushe/less/styles.less b/app/design/frontend/magento_plushe/less/styles.less index 5ff9cd504cc48681dac985d7ff3df66ddd8d64a1..50038db2cb410248c0231b861b730e0163b1913d 100644 --- a/app/design/frontend/magento_plushe/less/styles.less +++ b/app/design/frontend/magento_plushe/less/styles.less @@ -274,6 +274,7 @@ body { border: 1px solid @primary3; border-width: 0 1px 1px; border-radius: 0 0 5px 5px; + overflow: hidden; z-index: 5; ul { .resetList(); @@ -1231,6 +1232,11 @@ body { font-size: 24px; color: @secondary1; } + tfoot { + .amount { + text-align: right; + } + } } .order.review.data { @@ -2419,7 +2425,7 @@ body { float: none; } } - .checkout.paypal + .action.checkout { + .action.checkout { float: right; } } @@ -4969,6 +4975,9 @@ img[align="right"] { margin-bottom: 10px; &.current { color: @secondary1; + a { + color: @secondary1; + } } } .item strong { @@ -5259,6 +5268,7 @@ img[align="right"] { color: @textColor; border: none; background: none; + padding: 0 20px 0 5px; } } } @@ -5785,6 +5795,10 @@ img[align="right"] { .price-including-tax { display: block; } + + .category.view { + position: relative; + z-index: 1; + } } @import "/responsive/responsive.less"; diff --git a/app/etc/di.xml b/app/etc/di.xml index 128bbed6945d31a05f0e0a9d0f2740c99b79895c..95445ba68ea473cc33116b15cc7b1de9085f2b80 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -78,6 +78,7 @@ <preference for="Magento\Session\SidResolverInterface" type="Magento\Core\Model\Session\SidResolver\Proxy" /> <preference for="Magento\TranslateInterface" type="Magento\Core\Model\Translate" /> <preference for="Magento\Config\ScopeListInterface" type="interceptionConfigScope" /> + <preference for="Magento\View\Design\Theme\Label\ListInterface" type="Magento\Core\Model\Resource\Theme\Collection" /> <virtualType name="interceptionConfigScope" type="Magento\Config\Scope"> <param name="defaultScope"> <value>global</value> @@ -277,4 +278,21 @@ <value/> </param> </type> + <type name="Magento\App\FrontController"> + <plugin name="install" type="Magento\Module\FrontController\Plugin\Install" sortOrder="40"/> + </type> + <type name="Magento\View\Layout\Argument\HandlerFactory"> + <param name="handlerFactories"> + <value> + <object>Magento\Core\Model\Layout\Argument\Handler\Object</object> + <options>Magento\Core\Model\Layout\Argument\Handler\Options</options> + <url>Magento\Core\Model\Layout\Argument\Handler\Url</url> + <array>Magento\Core\Model\Layout\Argument\Handler\ArrayHandler</array> + <boolean>Magento\Core\Model\Layout\Argument\Handler\Boolean</boolean> + <helper>Magento\Core\Model\Layout\Argument\Handler\Helper</helper> + <number>Magento\Core\Model\Layout\Argument\Handler\Number</number> + <string>Magento\Core\Model\Layout\Argument\Handler\String</string> + </value> + </param> + </type> </config> diff --git a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php index 50aa310c4e66f1ccbcd73408bcf8435e547e7b37..6b051089168f976d37266f32a15735eb3fc39906 100644 --- a/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php +++ b/dev/tests/integration/framework/Magento/TestFramework/Interception/PluginList.php @@ -50,11 +50,11 @@ class PluginList extends \Magento\Interception\PluginList\PluginList \Magento\ObjectManager\Config $omConfig, \Magento\Interception\Definition $definitions, array $scopePriorityScheme, - \Magento\ObjectManager\Definition\Compiled $classDefinitions = null, - $cacheId = 'plugins' + $cacheId = 'plugins', + \Magento\ObjectManager\Definition\Compiled $classDefinitions = null ) { parent::__construct($reader, $configScope, $cache, $relations, $omConfig, - $definitions, $scopePriorityScheme, $classDefinitions, $cacheId); + $definitions, $scopePriorityScheme, $cacheId, $classDefinitions); $this->_originScopeScheme = $this->_scopePriorityScheme; } diff --git a/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php b/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php index 7e372939d27b0bd1ab4294107a2511607443a56a..0cf7120bc6e9094b84194faf02e1fb609ab23937 100644 --- a/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php +++ b/dev/tests/integration/testsuite/Magento/Cache/Backend/MongoDbTest.php @@ -236,7 +236,7 @@ class MongoDbTest extends \PHPUnit_Framework_TestCase /** * @dataProvider cleanDataProvider */ - public function testClean($mode, $tags = array(), $expectedIds) + public function testClean($mode, $tags, $expectedIds) { $this->_prepareCollection(); diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespace.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespace.php index 08ff15a311edc381217d1b614339cfecadd78921..c58139c1c55531951c6bbbb8685ff40254da182d 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespace.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithNamespace.php @@ -74,7 +74,7 @@ class SourceClassWithNamespace extends ParentClassWithNamespace * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function publicMethodWithReference(ClassGenerator &$classGenerator, &$param1 = "'", array &$array) + public function publicMethodWithReference(ClassGenerator &$classGenerator, &$param1, array &$array) { } diff --git a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespace.php b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespace.php index 996d792a00010ea311b083661d3f77db6f69fc29..ac646f45638f39043a29e7c09e202797b1b41ed4 100644 --- a/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespace.php +++ b/dev/tests/integration/testsuite/Magento/Code/GeneratorTest/SourceClassWithoutNamespace.php @@ -75,7 +75,7 @@ class SourceClassWithoutNamespace * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function publicMethodWithReference(ClassGenerator &$classGenerator, &$param1 = "'", array &$array) + public function publicMethodWithReference(ClassGenerator &$classGenerator, &$param1, array &$array) { } 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 12b4e0e142d6703023d48bc0ae84c7121d705384..e67c73e210e20194b7e68ab2ebf02e73948044e9 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/Template/FilterTest.php @@ -131,7 +131,7 @@ class FilterTest extends \PHPUnit_Framework_TestCase $themeId = $collection->getThemeByFullPath('frontend/test_default')->getId(); $objectManager->get('Magento\Core\Model\StoreManagerInterface') ->getStore()->setConfig( - \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, + \Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId ); diff --git a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php index a65c17eba1b2b7666e836133307e0500d76fb882..b9c55716bb57f035efbdc0f5cc2f34fd538b961b 100644 --- a/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php +++ b/dev/tests/integration/testsuite/Magento/Email/Model/TemplateTest.php @@ -135,7 +135,7 @@ class TemplateTest extends \PHPUnit_Framework_TestCase $theme->load('magento_blank', 'theme_path'); \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\StoreManagerInterface') ->getStore('fixturestore')->setConfig( - \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, + \Magento\View\DesignInterface::XML_PATH_THEME_ID, $theme->getId() ); } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php index 7804d9c7261b013d72534431cd01e4ce452aacef..dd05faa4133fa4de39d74ffe19a7e92d7e309480 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/QueueTest.php @@ -55,7 +55,7 @@ class QueueTest extends \PHPUnit_Framework_TestCase /** @var $storeManager \Magento\Core\Model\StoreManagerInterface */ $storeManager = $objectManager->get('Magento\Core\Model\StoreManagerInterface'); $storeManager->getStore('fixturestore')->setConfig( - \Magento\Core\Model\View\Design::XML_PATH_THEME_ID, $themeId + \Magento\View\DesignInterface::XML_PATH_THEME_ID, $themeId ); $subscriberOne = $this->getMock('Zend_Mail', array('send', 'setBodyHTML'), array('utf-8')); diff --git a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php index ad1f5a808f94271a56df31b68999ebb9e9f9c6c8..2f32cd07b78accf0f01326f45a9573678fa2c75a 100644 --- a/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Outbound/Authentication/FactoryTest.php @@ -23,29 +23,37 @@ * @copyright Copyright (c) 2013 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 \Magento\Outbound\Authentication\Factory */ + /** @var AuthenticationFactory */ protected $_authFactory; protected function setUp() { $this->_authFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Outbound\Authentication\Factory'); + ->create('Magento\Outbound\Authentication\Factory', array( + 'authenticationMap' => array( + EndpointInterface::AUTH_TYPE_HMAC => 'Magento\Outbound\Authentication\Hmac' + ) + )); } public function testGetFormatter() { - $authObject = $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); + $authObject = $this->_authFactory->getAuthentication(EndpointInterface::AUTH_TYPE_HMAC); $this->assertInstanceOf('Magento\Outbound\Authentication\Hmac', $authObject); } public function testGetFormatterIsCached() { - $authObject = $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); - $authObject2 = $this->_authFactory->getAuthentication(\Magento\Outbound\EndpointInterface::AUTH_TYPE_HMAC); + $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 index 2edb3b23a5ff5474f36480b50e1d9125d314dc21..ba7fca29917e5d25b19e4e4f0dec72ba101785b0 100644 --- a/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Outbound/Formatter/FactoryTest.php @@ -23,29 +23,37 @@ * @copyright Copyright (c) 2013 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 \Magento\Outbound\Formatter\Factory */ + /** @var FormatterFactory */ protected $_formatterFactory; protected function setUp() { $this->_formatterFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Outbound\Formatter\Factory'); + ->create('Magento\Outbound\Formatter\Factory', array( + 'formatterMap' => array( + EndpointInterface::FORMAT_JSON => 'Magento\Outbound\Formatter\Json' + ) + )); } public function testGetFormatter() { - $formatter = $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); + $formatter = $this->_formatterFactory->getFormatter(EndpointInterface::FORMAT_JSON); $this->assertInstanceOf('Magento\Outbound\Formatter\Json', $formatter); } public function testGetFormatterIsCached() { - $formatter = $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); - $formatter2 = $this->_formatterFactory->getFormatter(\Magento\Outbound\EndpointInterface::FORMAT_JSON); + $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/Paypal/Model/VoidTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php index ba1df91a17620170c27fd6db111a832b712047ef..7e3888edf087ac27eb9149a99347986136d3b827 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Model/VoidTest.php @@ -55,12 +55,12 @@ class VoidTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Paypal\Model\Payflowpro $instance */ $instance = $this->getMock('Magento\Paypal\Model\Payflowpro', array('_postRequest'), array( - $logger, $eventManager, - $coreStoreConfig, - $moduleList, $paymentData, + $coreStoreConfig, $logAdapterFactory, + $logger, + $moduleList, $locale, $centinelService, $storeManager, diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php b/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php deleted file mode 100644 index f21961ace82c117e7f38c9fdd549c55aded44952..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/PubSub/Event/QueueHandlerTest.php +++ /dev/null @@ -1,160 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\QueueHandler - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -/** - * @magentoDbIsolation enabled - */ -class QueueHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** - * mock endpoint url - */ - const ENDPOINT_URL = 'http://localhost/'; - - /** - * @var \Magento\PubSub\Event\QueueHandler - */ - protected $_model; - - protected function setUp() - { - /** @var \Magento\Webhook\Model\Resource\Event\Collection $eventCollection */ - $eventCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Resource\Event\Collection'); - /** @var array $event */ - $events = $eventCollection->getItems(); - /** @var \Magento\Webhook\Model\Event $event */ - foreach ($events as $event) { - $event->complete(); - $event->save(); - } - - /** @var $factory \Magento\Webhook\Model\Event\Factory */ - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\PubSub\Event\FactoryInterface'); - - /** @var $event \Magento\Webhook\Model\Event */ - $factory->create('testinstance/created', array( - 'testKey1' => 'testValue1' - ))->save(); - - $factory->create('testinstance/updated', array( - 'testKey2' => 'testValue2' - ))->save(); - - $endpoint = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Endpoint') - ->setEndpointUrl(self::ENDPOINT_URL) - ->setFormat('json') - ->setAuthenticationType('hmac') - ->setTimeoutInSecs('20') - ->save(); - - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->configure(array( - 'Magento\Webhook\Model\Config' => array( - 'parameters' => array( - 'sourceData' => __DIR__ . '/../_files/config.xml', - ), - ), - 'Magento\Webhook\Model\Resource\Subscription' => array( - 'parameters' => array( - 'config' => array('instance' => 'Magento\Webhook\Model\Config'), - ), - ) - )); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData( - array( - 'name' => 'test', - 'status' => \Magento\Webhook\Model\Subscription::STATUS_INACTIVE, - 'version' => 1, - 'alias' => 'test', - 'topics' => array( - 'testinstance/created', - 'testinstance/updated' - ), - ))->save(); - - // Simulate activating of the subscription - $webApiUser = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User') - ->setData('api_key', 'test') - ->setData('secret', 'secret') - ->save(); - $endpoint->setApiUserId($webApiUser->getId()) - ->save(); - $subscription->setEndpointId($endpoint->getId()) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save();; - - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\PubSub\Event\QueueHandler'); - } - - /** - * Test the main flow of event queue handling - */ - public function testHandle() - { - $this->_model->handle(); - /** @var $queue \Magento\PubSub\Job\QueueReaderInterface */ - $queue = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\PubSub\Job\QueueReaderInterface'); - - /* First EVENT */ - $job = $queue->poll(); - $this->assertNotNull($job); - $this->assertInstanceOf('Magento\PubSub\JobInterface', $job); - $event = $job->getEvent(); - $subscription = $job->getSubscription(); - - $this->assertEquals('testinstance/created', $event->getTopic()); - $this->assertEquals(array('testKey1' => 'testValue1'), $event->getBodyData()); - - $this->assertEquals(self::ENDPOINT_URL, $subscription->getEndpointUrl()); - $this->assertEquals(20, $subscription->getTimeoutInSecs()); - - /* Second EVENT */ - $job = $queue->poll(); - $this->assertNotNull($job); - $event = $job->getEvent(); - $subscription = $job->getSubscription(); - - $this->assertEquals('testinstance/updated', $event->getTopic()); - $this->assertEquals(array('testKey2' => 'testValue2'), $event->getBodyData()); - - $this->assertEquals(self::ENDPOINT_URL, $subscription->getEndpointUrl()); - $this->assertEquals(20, $subscription->getTimeoutInSecs()); - - /* No more EVENTS */ - $job = $queue->poll(); - $this->assertNull($job); - } -} diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Job/QueueHandlerTest.php b/dev/tests/integration/testsuite/Magento/PubSub/Job/QueueHandlerTest.php deleted file mode 100644 index 4846979b370d8a50a34cf8bcb909136d5ef237df..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/PubSub/Job/QueueHandlerTest.php +++ /dev/null @@ -1,164 +0,0 @@ -<?php -/** - * \Magento\PubSub\Job\QueueHandler - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -/** - * @magentoDbIsolation enabled - */ -class QueueHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\ObjectManager */ - private $_objectManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_transportMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_responseMock; - - /** @var \Magento\Webhook\Model\Event */ - private $_event; - - /** @var \Magento\Webhook\Model\Subscription */ - private $_subscription; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - // Must mock transport to avoid actual network actions - $this->_transportMock = $this->getMockBuilder('Magento\Outbound\Transport\Http') - ->disableOriginalConstructor() - ->getMock(); - $this->_responseMock = $this->getMockBuilder('Magento\Outbound\Transport\Http\Response') - ->disableOriginalConstructor() - ->getMock(); - $this->_transportMock->expects($this->any()) - ->method('dispatch') - ->will($this->returnValue($this->_responseMock)); - - /** \Magento\Webapi\Model\Acl\User $user */ - $user = $this->_objectManager->create('Magento\Webapi\Model\Acl\User') - ->setSecret('shhh...') - ->setApiKey(uniqid()) - ->save(); - - /** @var \Magento\Webhook\Model\Event $_event */ - $this->_event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setTopic('topic') - ->setBodyData(array('body data')) - ->save(); - /** @var \Magento\Webhook\Model\Subscription $_subscription */ - $this->_subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription') - ->setFormat('json') - ->setAuthenticationType('hmac') - ->setApiUserId($user->getId()) - ->save(); - } - - /** - * Test the main flow of event queue handling given a successful job - */ - public function testHandleSuccess() - { - $this->_responseMock->expects($this->any()) - ->method('isSuccessful') - ->will($this->returnValue(true)); - - $queueWriter = $this->_objectManager->create('Magento\PubSub\Job\QueueWriterInterface'); - - /** @var \Magento\Webhook\Model\Job $job */ - $job = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Webhook\Model\Job'); - $job->setEventId($this->_event->getId()); - $job->setSubscriptionId($this->_subscription->getId()); - $jobId = $job->save() - ->getId(); - $queueWriter->offer($job); - - // Must clear collection to avoid interaction with other tests - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $collection->removeAllItems(); - $queueArgs = array( - 'collection' => $collection - ); - - $queueReader = $this->_objectManager->create('Magento\PubSub\Job\QueueReaderInterface', $queueArgs); - $queueHandlerArgs = array( - 'jobQueueReader' => $queueReader, - 'jobQueueWriter' => $queueWriter, - 'transport' => $this->_transportMock - ); - - /** @var \Magento\PubSub\Job\QueueHandler $queueHandler */ - $queueHandler = $this->_objectManager->create('Magento\PubSub\Job\QueueHandler', $queueHandlerArgs); - $queueHandler->handle(); - $loadedJob = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->load($jobId); - - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_SUCCEEDED, $loadedJob->getStatus()); - } - - public function testHandleFailure() - { - $this->_responseMock->expects($this->any()) - ->method('isSuccessful') - ->will($this->returnValue(false)); - - $queueWriter = $this->_objectManager->create('Magento\PubSub\Job\QueueWriterInterface'); - - /** @var \Magento\Webhook\Model\Job $job */ - $job = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Webhook\Model\Job'); - $job->setEventId($this->_event->getId()); - $job->setSubscriptionId($this->_subscription->getId()); - $jobId = $job->save() - ->getId(); - $queueWriter->offer($job); - - // Must clear collection to avoid interaction with other tests - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $collection->removeAllItems(); - $queueArgs = array( - 'collection' => $collection - ); - - $queueReader = $this->_objectManager->create('Magento\PubSub\Job\QueueReaderInterface', $queueArgs); - $queueHandlerArgs = array( - 'jobQueueReader' => $queueReader, - 'jobQueueWriter' => $queueWriter, - 'transport' => $this->_transportMock - ); - - /** @var \Magento\PubSub\Job\QueueHandler $queueHandler */ - $queueHandler = $this->_objectManager->create('Magento\PubSub\Job\QueueHandler', $queueHandlerArgs); - $queueHandler->handle(); - $loadedJob = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->load($jobId); - - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_RETRY, $loadedJob->getStatus()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php b/dev/tests/integration/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php deleted file mode 100644 index 5bee982187aa2a1d303031a72e77611b6ea321ca..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/PubSub/Message/DispatcherAsyncTest.php +++ /dev/null @@ -1,79 +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) 2013 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; - -/** - * @magentoDbIsolation enabled - */ -class DispatcherAsyncTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\PubSub\Message\DispatcherAsync - */ - protected $_model; - - /** - * Initialize the model - */ - protected function setUp() - { - /** @var \Magento\Webhook\Model\Resource\Event\Collection $eventCollection */ - $eventCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Resource\Event\Collection'); - /** @var array $event */ - $events = $eventCollection->getItems(); - /** @var \Magento\Webhook\Model\Event $event */ - foreach ($events as $event) { - $event->complete(); - $event->save(); - } - - $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\PubSub\Message\DispatcherAsync'); - } - - /** - * Test the maing flow of event dispatching - */ - public function testDispatch() - { - $topic = 'webhooks/dispatch/tested'; - - $data = array( - 'testKey' => 'testValue' - ); - - $this->_model->dispatch($topic, $data); - - $queue = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\PubSub\Event\QueueReaderInterface'); - $event = $queue->poll(); - - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals($data, $event->getBodyData()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml b/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml index 056604cd477b8e3b83af32df7a5c73e5e20716e0..4b9bf1f7890612265a4768e839f8a385fee33297 100644 --- a/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml +++ b/dev/tests/integration/testsuite/Magento/PubSub/_files/config.xml @@ -24,21 +24,4 @@ */ --> <config> - <global> - <webhook> - <webhooks> - <testinstance> - <created> - <label>Webhooks Test Instance Created</label> - </created> - <updated> - <label>Webhooks Test Instance Updated</label> - </updated> - <deleted> - <label>Webhooks Test Instance Deleted</label> - </deleted> - </testinstance> - </webhooks> - </webhook> - </global> </config> \ No newline at end of file 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 5781111f437dac12ee9022306947a567c76cb20c..70610e069530c8203c1488321d85e7c7a7fd933b 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/LayoutFilesTest.php @@ -30,7 +30,7 @@ namespace Magento\Test\Integrity\Modular; class LayoutFilesTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Layout\Argument\HandlerFactory + * @var \Magento\View\Layout\Argument\HandlerFactory */ protected $_handlerFactory; @@ -42,7 +42,7 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase protected function setUp() { $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_handlerFactory = $objectManager->get('Magento\Core\Model\Layout\Argument\HandlerFactory'); + $this->_handlerFactory = $objectManager->get('Magento\View\Layout\Argument\HandlerFactory'); $this->_types = $this->_handlerFactory->getTypes(); } @@ -62,7 +62,7 @@ class LayoutFilesTest extends \PHPUnit_Framework_TestCase continue; } try { - /* @var $handler \Magento\Core\Model\Layout\Argument\HandlerInterface */ + /* @var $handler \Magento\View\Layout\Argument\HandlerInterface */ $handler = $this->_handlerFactory->getArgumentHandlerByType($type); $argument = $handler->parse($argument); if ($this->_isIgnored($argument)) { diff --git a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php index 84895375c02b90d083c73f5d7d126b24f0288156..3806d81d4a0b20b8b85a0e3406d0d969409ee904 100644 --- a/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php +++ b/dev/tests/integration/testsuite/Magento/Test/Integrity/Modular/_files/skip_blocks_ce.php @@ -33,14 +33,6 @@ return array( 'Magento\Backend\Block\System\Config\Form', 'Magento\Backend\Block\System\Config\Tabs', 'Magento\Review\Block\Form', - // Fails because of bug in \Magento\Webapi\Model\Acl\Loader\Resource\ConfigReader constructor - 'Magento\Cms\Block\Adminhtml\Page', - 'Magento\Cms\Block\Adminhtml\Page\Edit', - 'Magento\Sales\Block\Adminhtml\Order', - 'Magento\Paypal\Block\Adminhtml\Settlement\Report', - 'Magento\Sales\Block\Adminhtml\Billing\Agreement\View', - 'Magento\User\Block\Role\Tab\Edit', - 'Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource', // Fails because of dependence on registry 'Magento\Reminder\Block\Adminhtml\Reminder\Edit\Tab\Customers', ); diff --git a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/LabelTest.php b/dev/tests/integration/testsuite/Magento/View/Design/Theme/LabelTest.php similarity index 77% rename from dev/tests/integration/testsuite/Magento/Core/Model/Theme/LabelTest.php rename to dev/tests/integration/testsuite/Magento/View/Design/Theme/LabelTest.php index a5116e67eb14f7d88bd06f65dfd88a376398edfa..11215f3fc588828ac5158392ad04a5f182024df8 100644 --- a/dev/tests/integration/testsuite/Magento/Core/Model/Theme/LabelTest.php +++ b/dev/tests/integration/testsuite/Magento/View/Design/Theme/LabelTest.php @@ -18,40 +18,36 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @subpackage integration_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Theme; +namespace Magento\View\Design\Theme; class LabelTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Theme\Label + * @var \Magento\View\Design\Theme\Label */ protected $_model; protected function setUp() { $this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Theme\Label'); + ->create('Magento\View\Design\Theme\Label'); } /** - * @covers \Magento\Core\Model\Theme\Label::getLabelsCollection + * @covers \Magento\View\Design\Theme\Label::getLabelsCollection */ public function testGetLabelsCollection() { /** @var $expectedCollection \Magento\Core\Model\Resource\Theme\Collection */ $expectedCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Resource\Theme\Collection'); - $expectedCollection->addAreaFilter(\Magento\Core\Model\App\Area::AREA_FRONTEND) - ->filterVisibleThemes(); + ->create('Magento\View\Design\Theme\Label\ListInterface'); - $expectedItemsCount = count($expectedCollection); + $expectedItemsCount = count($expectedCollection->getLabels()); $labelsCollection = $this->_model->getLabelsCollection(); $this->assertEquals($expectedItemsCount, count($labelsCollection)); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php deleted file mode 100644 index 317a3b6af08eab84881c4a2bf0dabf4175c3857e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/AbstractFormTest.php +++ /dev/null @@ -1,113 +0,0 @@ -<?php -/** - * Abstract test case for Webapi forms. It was introduced to avoid copy-paste in form tests. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml; - -/** - * @magentoAppArea adminhtml - */ -abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase -{ - /** - * Form class must be defined in children. - * - * @var string - */ - protected $_formClass = ''; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit\Form - */ - protected $_block; - - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Backend\Model\Url|\PHPUnit_Framework_MockObject_MockObject - */ - protected $_urlBuilder; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \Magento\View\Element\BlockFactory - */ - protected $_blockFactory; - - protected function setUp() - { - parent::setUp(); - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') - ->disableOriginalConstructor() - ->getMock(); - $this->_layout = $this->_objectManager->get('Magento\View\LayoutInterface'); - $this->_blockFactory = $this->_objectManager->get('Magento\View\Element\BlockFactory'); - $this->_block = $this->_blockFactory->createBlock($this->_formClass, array( - 'context' => \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - 'Magento\Backend\Block\Template\Context', - array('urlBuilder' => $this->_urlBuilder) - ) - )); - $this->_layout->addBlock($this->_block); - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\Core\Model\Layout'); - unset($this->_objectManager, $this->_urlBuilder, $this->_layout, $this->_blockFactory, $this->_block); - } - - /** - * Test _prepareForm method. - */ - public function testPrepareForm() - { - // TODO: Move to unit tests after MAGETWO-4015 complete. - \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\App') - ->loadArea(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - $this->assertEmpty($this->_block->getForm()); - - $this->_urlBuilder->expects($this->once()) - ->method('getUrl') - ->with('adminhtml/*/save', array()) - ->will($this->returnValue('action_url')); - $this->_block->toHtml(); - - $form = $this->_block->getForm(); - $this->assertInstanceOf('Magento\Data\Form', $form); - $this->assertTrue($form->getUseContainer()); - $this->assertEquals('edit_form', $form->getId()); - $this->assertEquals('post', $form->getMethod()); - $this->assertEquals('action_url', $form->getAction()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/MainTest.php deleted file mode 100644 index 9e97b0c57f10131166f20bcaf79893edd935f8c2..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/MainTest.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main block - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml\Role\Edit\Tab; - -/** - * @magentoAppArea adminhtml - */ -class MainTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \Magento\View\Element\BlockFactory - */ - protected $_blockFactory; - - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main - */ - protected $_block; - - protected function setUp() - { - parent::setUp(); - - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_layout = $this->_objectManager->get('Magento\View\LayoutInterface'); - $this->_blockFactory = $this->_objectManager->get('Magento\View\Element\BlockFactory'); - $this->_block = $this->_blockFactory->createBlock('Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Main'); - $this->_layout->addBlock($this->_block); - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\View\LayoutInterface'); - $this->_objectManager->removeSharedInstance('Magento\View\Element\BlockFactory'); - unset($this->_objectManager, $this->_layout, $this->_blockFactory, $this->_block); - } - - /** - * Test _prepareForm method. - * - * @dataProvider prepareFormDataProvider - * @param \Magento\Object $apiRole - * @param array $formElements - */ - public function testPrepareForm($apiRole, array $formElements) - { - // TODO: Move to unit tests after MAGETWO-4015 complete - $this->assertEmpty($this->_block->getForm()); - - $this->_block->setApiRole($apiRole); - $this->_block->toHtml(); - - $form = $this->_block->getForm(); - $this->assertInstanceOf('Magento\Data\Form', $form); - /** @var \Magento\Data\Form\Element\Fieldset $fieldset */ - $fieldset = $form->getElement('base_fieldset'); - $this->assertInstanceOf('Magento\Data\Form\Element\Fieldset', $fieldset); - $elements = $fieldset->getElements(); - foreach ($formElements as $elementId) { - $element = $elements->searchById($elementId); - $this->assertNotEmpty($element, "Element '$elementId' is not found in form fieldset"); - $this->assertEquals($apiRole->getData($elementId), $element->getValue()); - } - } - - /** - * @return array - */ - public function prepareFormDataProvider() - { - return array( - 'Empty API Role' => array( - new \Magento\Object(), - array( - 'role_name', - 'in_role_user', - 'in_role_user_old' - ) - ), - 'New API Role' => array( - new \Magento\Object(array( - 'role_name' => 'Role' - )), - array( - 'role_name', - 'in_role_user', - 'in_role_user_old' - ) - ), - 'Existed API Role' => array( - new \Magento\Object(array( - 'id' => 1, - 'role_name' => 'Role' - )), - array( - 'role_id', - 'role_name', - 'in_role_user', - 'in_role_user_old' - ) - ) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php deleted file mode 100644 index 16abeaa6f28fe40c9901f87464bb2606df44f261..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php +++ /dev/null @@ -1,190 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml\Role\Edit\Tab; - -/** - * @magentoAppArea adminhtml - */ -class ResourceTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_resourceProvider; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_ruleResource; - - /** - * @var \Magento\View\Element\BlockFactory - */ - protected $_blockFactory; - - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource - */ - protected $_block; - - protected function setUp() - { - parent::setUp(); - - $this->_resourceProvider = $this->getMock('Magento\Webapi\Model\Acl\Resource\ProviderInterface'); - - $this->_ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') - ->disableOriginalConstructor() - ->setMethods(array('getResourceIdsByRole')) - ->getMock(); - - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_layout = $this->_objectManager->get('Magento\View\LayoutInterface'); - $this->_blockFactory = $this->_objectManager->get('Magento\View\Element\BlockFactory'); - $this->_block = $this->_blockFactory->createBlock('Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource', - array( - 'resourceProvider' => $this->_resourceProvider, - 'ruleResource' => $this->_ruleResource - ) - ); - $this->_layout->addBlock($this->_block); - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\View\LayoutInterface'); - unset($this->_objectManager, $this->_layout, $this->_resourceProvider, $this->_blockFactory, $this->_block); - } - - /** - * Test _prepareForm method. - * - * @dataProvider prepareFormDataProvider - * @param array $originResTree - * @param array $selectedRes - * @param array $expectedRes - */ - public function testPrepareForm($originResTree, $selectedRes, $expectedRes) - { - // TODO: Move to unit tests after MAGETWO-4015 complete. - $apiRole = new \Magento\Object(array( - 'role_id' => 1 - )); - $apiRole->setIdFieldName('role_id'); - - $this->_block->setApiRole($apiRole); - - $this->_resourceProvider->expects($this->once()) - ->method('getAclResources') - ->will($this->returnValue($originResTree)); - - $this->_ruleResource->expects($this->once()) - ->method('getResourceIdsByRole') - ->with($apiRole->getId()) - ->will($this->returnValue($selectedRes)); - - $this->_block->toHtml(); - - $this->assertEquals($expectedRes, $this->_block->getResourcesTree()); - } - - /** - * @return array - */ - public function prepareFormDataProvider() - { - $resourcesTree = array( - array('id' => 'All'), - array( - 'id' => 'Admin', - 'children' => array( - array( - 'id' => 'customer', - 'title' => 'Manage Customers', - 'sortOrder' => 20, - 'children' => array( - array( - 'id' => 'customer/get', - 'title' => 'Get Customer', - 'sortOrder' => 20, - 'children' => array(), - ), - array( - 'id' => 'customer/create', - 'title' => 'Create Customer', - 'sortOrder' => 30, - 'children' => array(), - ) - ) - ) - ) - ) - ); - $expected = array( - array( - 'id' => 'customer', - 'text' => 'Manage Customers', - 'children' => array( - array( - 'id' => 'customer/get', - 'text' => 'Get Customer', - 'children' => array() - ), - array( - 'id' => 'customer/create', - 'text' => 'Create Customer', - 'children' => array() - ), - ) - ) - ); - $expectedSelected = $expected; - $expectedSelected[0]['children'][0]['checked'] = true; - return array( - 'Empty Selected Resources' => array( - 'originResourcesTree' => $resourcesTree, - 'selectedResources' => array(), - 'expectedResourcesTree' => $expected - ), - 'One Selected Resource' => array( - 'originResourcesTree' => $resourcesTree, - 'selectedResources' => array('customer/get'), - 'expectedResourcesTree' => $expectedSelected - ) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/FormTest.php deleted file mode 100644 index 4b90a977c86a32d6ab62d176f5250eb9bb44e332..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/FormTest.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\User\Edit\Form block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\User\Edit; - -class FormTest extends \Magento\Webapi\Block\Adminhtml\AbstractFormTest -{ - protected $_formClass = 'Magento\Webapi\Block\Adminhtml\User\Edit\Form'; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit\Form - */ - protected $_block; -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/MainTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/MainTest.php deleted file mode 100644 index e7b1756fbc2d85a704e26d97229ba9c88dcd2b68..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/Tab/MainTest.php +++ /dev/null @@ -1,148 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml\User\Edit\Tab; - -/** - * @magentoAppArea adminhtml - */ -class MainTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \Magento\View\Element\BlockFactory - */ - protected $_blockFactory; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main - */ - protected $_block; - - protected function setUp() - { - parent::setUp(); - - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_layout = $this->_objectManager->get('Magento\View\LayoutInterface'); - $this->_blockFactory = $this->_objectManager->get('Magento\View\Element\BlockFactory'); - $this->_block = $this->_blockFactory->createBlock('Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main'); - $this->_layout->addBlock($this->_block); - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\View\LayoutInterface'); - unset($this->_objectManager, $this->_urlBuilder, $this->_layout, $this->_blockFactory, $this->_block); - } - - /** - * Test _prepareForm method. - * - * @dataProvider prepareFormDataProvider - * @param \Magento\Object $apiUser - * @param array $formElements - */ - public function testPrepareForm($apiUser, array $formElements) - { - // TODO: Move to unit tests after MAGETWO-4015 complete. - $this->assertEmpty($this->_block->getForm()); - - $this->_block->setApiUser($apiUser); - $this->_block->toHtml(); - - $form = $this->_block->getForm(); - $this->assertInstanceOf('Magento\Data\Form', $form); - /** @var \Magento\Data\Form\Element\Fieldset $fieldset */ - $fieldset = $form->getElement('base_fieldset'); - $this->assertInstanceOf('Magento\Data\Form\Element\Fieldset', $fieldset); - $elements = $fieldset->getElements(); - foreach ($formElements as $elementId) { - $element = $elements->searchById($elementId); - $this->assertNotEmpty($element, "Element '$elementId' is not found in form fieldset"); - $this->assertEquals($apiUser->getData($elementId), $element->getValue()); - } - } - - /** - * @return array - */ - public function prepareFormDataProvider() - { - return array( - 'Empty API User' => array( - new \Magento\Object(), - array( - 'company_name', - 'contact_email', - 'api_key', - 'secret' - ) - ), - 'New API User' => array( - new \Magento\Object(array( - 'company_name' => 'Company', - 'contact_email' => 'mail@example.com', - 'api_key' => 'API Key', - 'secret' => 'API Secret', - 'role_id' => 1 - )), - array( - 'company_name', - 'contact_email', - 'api_key', - 'secret' - ) - ), - 'Existed API User' => array( - new \Magento\Object(array( - 'id' => 1, - 'company_name' => 'Company', - 'contact_email' => 'mail@example.com', - 'api_key' => 'API Key', - 'secret' => 'API Secret', - 'role_id' => 1 - )), - array( - 'user_id', - 'company_name', - 'contact_email', - 'api_key', - 'secret' - ) - ) - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/TabsTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/TabsTest.php deleted file mode 100644 index 31589d32a53604c840e4d271f5ad7b80d75728f3..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/Edit/TabsTest.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\User\Edit\Tabs block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml\User\Edit; - -/** - * @magentoAppArea adminhtml - */ -class TabsTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit\Tabs - */ - protected $_block; - - protected function setUp() - { - parent::setUp(); - - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_layout = $this->_objectManager->get('Magento\View\LayoutInterface'); - $this->_block = $this->_layout->createBlock('Magento\Webapi\Block\Adminhtml\User\Edit\Tabs', - 'webapi.user.edit.tabs'); - } - - protected function tearDown() - { - $this->_objectManager->removeSharedInstance('Magento\View\LayoutInterface'); - unset($this->_objectManager, $this->_layout, $this->_block); - } - - /** - * Test _beforeToHtml method. - */ - public function testBeforeToHtml() - { - // TODO: Move to unit tests after MAGETWO-4015 complete. - /** @var \Magento\Webapi\Block\Adminhtml\User\Edit\Tab\Main $mainTabBlock */ - $mainTabBlock = $this->_layout->addBlock( - 'Magento\View\Element\Text', - 'webapi.user.edit.tab.main', - 'webapi.user.edit.tabs' - )->setText('Main Block Content'); - - $this->_layout->addBlock( - 'Magento\View\Element\Text', - 'webapi.user.edit.tab.roles.grid', - 'webapi.user.edit.tabs' - )->setText('Grid Block Content'); - - $apiUser = new \Magento\Object(array( - 'role_id' => 1 - )); - $this->_block->setApiUser($apiUser); - $this->_block->toHtml(); - - $this->assertSame($apiUser, $mainTabBlock->getApiUser()); - - $tabs = $this->_getProtectedTabsValue($this->_block); - $this->assertArrayHasKey('main_section', $tabs); - $this->assertInstanceOf('Magento\Object', $tabs['main_section']); - $this->assertEquals(array( - 'label' => 'User Info', - 'title' => 'User Info', - 'content' => 'Main Block Content', - 'active' => '1', - 'url' => '#', - 'id' => 'main_section', - 'tab_id' => 'main_section', - ), $tabs['main_section']->getData()); - - $this->assertArrayHasKey('roles_section', $tabs); - $this->assertInstanceOf('Magento\Object', $tabs['roles_section']); - $this->assertEquals(array( - 'label' => 'User Role', - 'title' => 'User Role', - 'content' => 'Grid Block Content', - 'url' => '#', - 'id' => 'roles_section', - 'tab_id' => 'roles_section' - ), $tabs['roles_section']->getData()); - } - - /** - * Get protected _tabs property of \Magento\Backend\Block\Widget\Tabs block. - * - * @param \Magento\Backend\Block\Widget\Tabs $tabs - * @return array - */ - protected function _getProtectedTabsValue(\Magento\Backend\Block\Widget\Tabs $tabs) - { - $result = null; - try { - $classReflection = new \ReflectionClass(get_class($tabs)); - $tabsProperty = $classReflection->getProperty('_tabs'); - $tabsProperty->setAccessible(true); - $result = $tabsProperty->getValue($tabs); - } catch (\ReflectionException $exception) { - $this->fail('Cannot get tabs value'); - - } - $this->assertInternalType('array', $result, 'Tabs value is expected to be an array'); - return $result; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php deleted file mode 100644 index 277e1383fe27053bb6eee1c7746e164a63ab598a..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php +++ /dev/null @@ -1,73 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\User\Edit block. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -namespace Magento\Webapi\Block\Adminhtml\User; - -/** - * @magentoAppArea adminhtml - */ -class EditTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\View\LayoutInterface - */ - protected $_layout; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit - */ - protected $_block; - - /** - * Initialize block. - */ - protected function setUp() - { - parent::setUp(); - - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\View\LayoutInterface'); - $this->_block = $this->_layout->createBlock('Magento\Webapi\Block\Adminhtml\User\Edit'); - } - - /** - * Test _beforeToHtml method. - */ - public function testBeforeToHtml() - { - // TODO: Move to unit tests after MAGETWO-4015 complete. - $apiUser = new \Magento\Object(); - $this->_block->setApiUser($apiUser); - $this->_block->toHtml(); - $this->assertSame($apiUser, $this->_block->getChildBlock('form')->getApiUser()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RoleTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RoleTest.php deleted file mode 100644 index 3de34ed059e860e91d921b6598fd9937a0dc0adb..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RoleTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -namespace Magento\Webapi\Model\Acl; - -/** - * Test for \Magento\Webapi\Model\Acl\Role model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @magentoDataFixture Magento/Webapi/_files/role.php - */ -class RoleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Acl\Role - */ - protected $_model; - - /** - * Initialize model. - */ - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_model = $this->_objectManager->create('Magento\Webapi\Model\Acl\Role'); - } - - /** - * Test Web API Role CRUD. - */ - public function testCRUD() - { - $this->_model->setRoleName('Test Role Name'); - $crud = new \Magento\TestFramework\Entity($this->_model, array('role_name' => '_Role_Name_')); - $crud->testCrud(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RuleTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RuleTest.php deleted file mode 100644 index ae7941d5cbf8dee15c8696ae06e748374fe334cd..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/RuleTest.php +++ /dev/null @@ -1,86 +0,0 @@ -<?php -namespace Magento\Webapi\Model\Acl; - -/** - * Test for \Magento\Webapi\Model\Acl\Rule model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @magentoDataFixture Magento/Webapi/_files/role.php - */ -class RuleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Acl\Role\Factory - */ - protected $_roleFactory; - - /** - * @var \Magento\Webapi\Model\Acl\Rule - */ - protected $_model; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_roleFactory = $this->_objectManager->get('Magento\Webapi\Model\Acl\Role\Factory'); - $this->_model = $this->_objectManager->create('Magento\Webapi\Model\Acl\Rule'); - } - - /** - * Test Web API Role CRUD. - */ - public function testCRUD() - { - $role = $this->_roleFactory->create()->load('test_role', 'role_name'); - $allowResourceId = 'customer/multiGet'; - - $this->_model->setRoleId($role->getId()) - ->setResourceId($allowResourceId); - - $crud = new \Magento\TestFramework\Entity($this->_model, array('resource_id' => 'customer/get')); - $crud->testCrud(); - } - - /** - * Test \Magento\Webapi\Model\Acl\Rule::saveResources() method. - */ - public function testSaveResources() - { - $role = $this->_roleFactory->create()->load('test_role', 'role_name'); - $resources = array('customer/create', 'customer/update'); - - $this->_model - ->setRoleId($role->getId()) - ->setResources($resources) - ->saveResources(); - - /** @var $rulesSet \Magento\Webapi\Model\Resource\Acl\Rule\Collection */ - $rulesSet = $this->_objectManager->get('Magento\Webapi\Model\Resource\Acl\Rule\Collection') - ->getByRole($role->getRoleId())->load(); - $this->assertCount(2, $rulesSet); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/UserTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/UserTest.php deleted file mode 100644 index 34b07ec21368990d92ccaa4774f0642102d676db..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Acl/UserTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -namespace Magento\Webapi\Model\Acl; - -/** - * Test for \Magento\Webapi\Model\Acl\User model. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * @magentoDataFixture Magento/Webapi/_files/role.php - */ -class UserTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Acl\User - */ - protected $_model; - - /** - * @var \Magento\Webapi\Model\Acl\Role\Factory - */ - protected $_roleFactory; - - /** - * Initialize model. - */ - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_roleFactory = $this->_objectManager->get('Magento\Webapi\Model\Acl\Role\Factory'); - $this->_model = $this->_objectManager->create('Magento\Webapi\Model\Acl\User'); - } - - /** - * Test Web API User CRUD. - */ - public function testCRUD() - { - $role = $this->_roleFactory->create()->load('test_role', 'role_name'); - - $this->_model - ->setApiKey('Test User Name') - ->setContactEmail('null@null.com') - ->setSecret('null@null.com') - ->setRoleId($role->getId()); - - $crud = new \Magento\TestFramework\Entity($this->_model, array('api_key' => '_User_Name_')); - $crud->testCrud(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapi.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapi.php index acd67d02c695c8ab40036034326903671c88689d..3020a504b2cea6d3d2c2078b4458458c4eb64b80 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapi.php +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapi.php @@ -30,12 +30,14 @@ return array( 'method' => 'item', 'route' => '/:id', 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource1'), ), 'create' => array( 'httpMethod' => 'POST', 'method' => 'create', 'route' => '', 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource2'), ), ), 'baseUrl' => '/V1/testmodule1', @@ -48,44 +50,41 @@ return array( 'method' => 'item', 'route' => '/:id', 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource1'), ), 'create' => array( 'httpMethod' => 'POST', 'method' => 'create', 'route' => '', 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource1', 'Magento_TestModule1::resource2'), ), 'delete' => array( 'httpMethod' => 'DELETE', 'method' => 'delete', 'route' => '/:id', 'isSecure' => true, + 'resources' => array('Magento_TestModule1::resource2'), ), ), 'baseUrl' => '/V2/testmodule1', ), - '\Magento\TestModule1\Service\AllSoapAndRestV3Interface' => array( - 'class' => '\Magento\TestModule1\Service\AllSoapAndRestV3Interface', - 'methods' => array(), - ), - '\Magento\TestModule2\Service\SomeVInterface' => array( - 'class' => '\Magento\TestModule2\Service\SomeVInterface', - 'methods' => array(), - ), '\Magento\TestModule2\Service\AllSoapAndRestV2Interface' => array( 'class' => '\Magento\TestModule2\Service\AllSoapAndRestV2Interface', 'methods' => array( - 'create' => array( - 'httpMethod' => 'POST', - 'method' => 'create', + 'update' => array( + 'httpMethod' => 'PUT', + 'method' => 'update', 'route' => '', 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource1'), ), 'delete' => array( 'httpMethod' => 'DELETE', 'method' => 'delete', 'route' => '/:id', 'isSecure' => true, + 'resources' => array('Magento_TestModule1::resource2'), ), ), 'baseUrl' => '/V2/testmodule2', diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiA.xml b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiA.xml index 2ab43187f04b0c08853d71683c9122623fd2bb37..96e73457be36815b13613ca467b710b568826071 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiA.xml +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiA.xml @@ -25,14 +25,12 @@ --> <config> <service class="\Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> - <rest-route httpMethod="GET" method="item">/:id</rest-route> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> </service> <service class="\Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> - <rest-route httpMethod="GET" method="item">/:id</rest-route> - <rest-route httpMethod="POST" method="create"></rest-route> - <rest-route httpMethod="DELETE" method="delete" isSecure="true">/:id</rest-route> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_TestModule1::resource1, Magento_TestModule1::resource2"></rest-route> + <rest-route httpMethod="DELETE" method="delete" isSecure="true" resources="Magento_TestModule1::resource2">/:id</rest-route> </service> - - <service class="\Magento\TestModule1\Service\AllSoapAndRestV3Interface"/> </config> diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiB.xml b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiB.xml index 8165984b516f2a12493b21801a98b33553e47bc9..78e648766f0383df7832cc53dc619aa9ca8eafea 100644 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiB.xml +++ b/dev/tests/integration/testsuite/Magento/Webapi/Model/Config/_files/webapiB.xml @@ -26,13 +26,11 @@ <config> <service class="\Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> <!--Extension of service declared in webapiA.xml--> - <rest-route httpMethod="POST" method="create"></rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_TestModule1::resource2"></rest-route> </service> - <service class="\Magento\TestModule2\Service\SomeVInterface"/> - <service class="\Magento\TestModule2\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule2"> - <rest-route httpMethod="POST" method="create"></rest-route> - <rest-route httpMethod="DELETE" method="delete" isSecure="true">/:id</rest-route> + <rest-route httpMethod="PUT" method="update" resources="Magento_TestModule1::resource1"></rest-route> + <rest-route httpMethod="DELETE" method="delete" isSecure="true" resources="Magento_TestModule1::resource2">/:id</rest-route> </service> </config> diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php deleted file mode 100644 index b687af7b9441efd9a0e74d472a6bd169e2725429..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Model\Resource\Acl\Role. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class RoleTest extends \PHPUnit_Framework_TestCase -{ - protected function setUp() - { - parent::setUp(); - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::getRolesIds(). - * - * @magentoDataFixture Magento/Webapi/_files/role.php - * @magentoDataFixture Magento/Webapi/_files/role_with_rule.php - */ - public function testGetRolesIds() - { - $expectedRoleNames = array('test_role', 'Test role'); - /** @var $roleResource \Magento\Webapi\Model\Resource\Acl\Role */ - $roleResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Resource\Acl\Role'); - $rolesIds = $roleResource->getRolesIds(); - $this->assertCount(2, $rolesIds); - foreach ($rolesIds as $roleId) { - /** @var $role \Magento\Webapi\Model\Acl\Role */ - $role = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role')->load($roleId); - $this->assertNotEmpty($role->getId()); - $this->assertContains($role->getRoleName(), $expectedRoleNames); - } - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::getRolesList(). - * - * @magentoDataFixture Magento/Webapi/_files/role.php - * @magentoDataFixture Magento/Webapi/_files/role_with_rule.php - */ - public function testGetRolesList() - { - /** @var $roleResource \Magento\Webapi\Model\Resource\Acl\Role */ - $roleResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Resource\Acl\Role'); - $rolesList = $roleResource->getRolesList(); - $this->assertCount(2, $rolesList); - foreach ($rolesList as $roleId => $roleName) { - $role = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role')->load($roleId); - $this->assertEquals($roleId, $role->getId()); - $this->assertEquals($roleName, $role->getRoleName()); - } - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::_initUniqueFields(). - * - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Role Name already exists. - * @magentoDataFixture Magento/Webapi/_files/role.php - */ - public function testInitUniqueFields() - { - /** @var $roleResource \Magento\Webapi\Model\Resource\Acl\Role */ - $roleResource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Resource\Acl\Role'); - $uniqueFields = $roleResource->getUniqueFields(); - $expectedUnique = array( - array( - 'field' => 'role_name', - 'title' => 'Role Name' - ), - ); - $this->assertEquals($expectedUnique, $uniqueFields); - - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role') - ->setRoleName('test_role') - ->save(); - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::delete(). - * - * @magentoDataFixture Magento/Webapi/_files/user_with_role.php - */ - public function testDeleteRole() - { - \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role') - ->load('Test role', 'role_name') - ->delete(); - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User') - ->load('test_username', 'api_key'); - $this->assertNotEmpty($user->getId()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php b/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php deleted file mode 100644 index 805dbe57e1af0ad55004e590800162bc0cfbcc0b..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php - -namespace Magento\Webapi\Model\Resource\Acl; - -/** - * Test for \Magento\Webapi\Model\Resource\Acl\Rule. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - * @magentoDataFixture Magento/Webapi/_files/role_with_rule.php - */ -class RuleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule - */ - protected $_ruleResource; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_ruleResource = $this->_objectManager->get('Magento\Webapi\Model\Resource\Acl\Rule'); - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::getRolesIds(). - */ - public function testGetRuleList() - { - /** @var \Magento\Webapi\Model\Acl\Role $role */ - $role = $this->_objectManager->create('Magento\Webapi\Model\Acl\Role')->load('Test role', 'role_name'); - $allowResourceId = 'customer/get'; - $rules = $this->_ruleResource->getRuleList(); - $this->assertCount(1, $rules); - $this->assertEquals($allowResourceId, $rules[0]['resource_id']); - $this->assertEquals($role->getId(), $rules[0]['role_id']); - } - - /** - * Test for \Magento\Webapi\Model\Resource\Acl\Role::getResourceIdsByRole(). - */ - public function testGetResourceIdsByRole() - { - /** @var \Magento\Webapi\Model\Acl\Role $role */ - $role = $this->_objectManager->create('Magento\Webapi\Model\Acl\Role')->load('Test role', 'role_name'); - $this->assertEquals(array('customer/get'), $this->_ruleResource->getResourceIdsByRole($role->getId())); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webapi/_files/role.php b/dev/tests/integration/testsuite/Magento/Webapi/_files/role.php deleted file mode 100644 index 6f30928613b9e6386421f9dce2363c2595ac39a2..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/_files/role.php +++ /dev/null @@ -1,30 +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_Webapi - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -/** @var \Magento\Webapi\Model\Acl\Role $role */ -$role = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role'); -$role->setRoleName('test_role')->save(); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/_files/role_with_rule.php b/dev/tests/integration/testsuite/Magento/Webapi/_files/role_with_rule.php deleted file mode 100644 index 114b315cceffc2151a70155673c53e2b66af37d8..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/_files/role_with_rule.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_Webapi - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -$allowResourceId = 'customer/get'; -/** @var \Magento\Webapi\Model\Acl\Role $role */ -$role = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role'); -$role->setData(array( - 'role_name' => 'Test role' -)); -$role->save(); -/** @var \Magento\Webapi\Model\Acl\Rule $rule */ -$rule = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Rule'); -$rule->setData(array( - 'resource_id' => $allowResourceId, - 'role_id' => $role->getRoleId() -)); -$rule->save(); diff --git a/dev/tests/integration/testsuite/Magento/Webapi/_files/user_with_role.php b/dev/tests/integration/testsuite/Magento/Webapi/_files/user_with_role.php deleted file mode 100644 index 76aff4d8a845936703cd317171a071477d5e1b9c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webapi/_files/user_with_role.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_Webapi - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -/** @var \Magento\Webapi\Model\Acl\Role $role */ -$role = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\Role'); -$role->setData(array( - 'role_name' => 'Test role' -)); -$role->save(); -/** @var \Magento\Webapi\Model\Acl\User $user */ -$user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User'); -$user->setData(array( - 'api_key' => 'test_username', - 'secret' => '123123qa', - 'contact_email' => 'null@null.com', - 'role_id' => $role->getRoleId() -)); -$user->save(); diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.php deleted file mode 100644 index 33446ace0909a597c637bbf4225542740430b1ec..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.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. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -/** - * \Magento\Webhook\Block\Adminhtml\Registration\ActivateTest - * - * @magentoDbIsolation enabled - * @magentoAppArea adminhtml - */ -class ActivateTest extends \PHPUnit_Framework_TestCase -{ - public function testGetMethods() - { - // Data for the block object - $topics = array('array', 'of', 'topics'); - $subscriptionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save() - ->getId(); - $subscriptionData = array( - \Magento\Webhook\Block\Adminhtml\Registration\Activate::DATA_SUBSCRIPTION_ID => $subscriptionId, - \Magento\Webhook\Block\Adminhtml\Registration\Activate::DATA_NAME => 'name', - \Magento\Webhook\Block\Adminhtml\Registration\Activate::DATA_TOPICS => $topics - ); - - /** @var \Magento\Core\Model\Registry $registry */ - $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry'); - $registry->register(\Magento\Webhook\Block\Adminhtml\Registration\Activate::REGISTRY_KEY_CURRENT_SUBSCRIPTION, - $subscriptionData); - - /** @var \Magento\View\Element\Template\Context $context */ - $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\View\Element\Template\Context'); - - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Activate $block */ - $block = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Block\Adminhtml\Registration\Activate', array($context, $registry)); - - $urlBuilder = $context->getUrlBuilder(); - $expectedUrl = $urlBuilder->getUrl('adminhtml/*/accept', array('id' => $subscriptionId)); - - $this->assertEquals($expectedUrl, $block->getAcceptUrl()); - $this->assertEquals('name', $block->getSubscriptionName()); - $this->assertEquals($topics, $block->getSubscriptionTopics()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php deleted file mode 100644 index efcf7e870b42e0296fe1f2e51b73ca3bac4c0101..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php +++ /dev/null @@ -1,71 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create\Form; - -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Create\Form\Container - * - * @magentoDbIsolation enabled - * @magentoAppArea adminhtml - */ -class ContainerTest extends \PHPUnit_Framework_TestCase -{ - public function testGetMethods() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - // Data for the block object - $subscriptionId = $objectManager->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save() - ->getId(); - $subscriptionData = array( - \Magento\Webhook\Block\Adminhtml\Registration\Activate::DATA_SUBSCRIPTION_ID => $subscriptionId, - \Magento\Webhook\Block\Adminhtml\Registration\Activate::DATA_NAME => 'name', - ); - - /** @var \Magento\Core\Model\Registry $registry */ - $registry = $objectManager->get('Magento\Core\Model\Registry'); - $registry->register(\Magento\Webhook\Block\Adminhtml\Registration\Activate::REGISTRY_KEY_CURRENT_SUBSCRIPTION, - $subscriptionData); - - /** @var \Magento\View\Element\Template\Context $context */ - $context = $objectManager->create('Magento\View\Element\Template\Context'); - - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Activate $block */ - $block = $objectManager - ->create('Magento\Webhook\Block\Adminhtml\Registration\Create\Form\Container', array( - $context, - $registry - )); - - $urlBuilder = $context->getUrlBuilder(); - $expectedUrl = $urlBuilder->getUrl('adminhtml/*/register', array('id' => $subscriptionId)); - - $this->assertEquals($expectedUrl, $block->getSubmitUrl()); - $this->assertEquals('name', $block->getSubscriptionName()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php deleted file mode 100644 index a80a8cc1ebbbbf0b33fde6f370b40c64b9dfc934..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create; - -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Create\Form - * - * @magentoAppArea adminhtml - */ -class FormTest extends \PHPUnit_Framework_TestCase -{ - public function testPrepareForm() - { - /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); - - /** @var \Magento\Core\Model\Registry $registry */ - $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry'); - $subscriptionData = array( - 'subscription_id' => '333', - ); - $registry - ->register( - 'current_subscription', - $subscriptionData - ); - - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Create\Form $block */ - $block = $layout->createBlock('Magento\Webhook\Block\Adminhtml\Registration\Create\Form', - '', array('registry' => $registry) - ); - $block->toHtml(); - - $form = $block->getForm(); - - $this->assertInstanceOf('Magento\Data\Form', $form); - $this->assertEquals('post', $form->getData('method')); - $this->assertEquals($block->getUrl('adminhtml/*/register', array('id' => 333)), $form->getData('action')); - $this->assertEquals('api_user', $form->getId()); - - - $expectedFieldset = array( - 'company' => array( - 'name' => 'company', - 'type' => 'text', - 'required' => false - ), - 'email' => array( - 'name' => 'email', - 'type' => 'text', - 'required' => true - ), - 'apikey' => array( - 'name' => 'apikey', - 'type' => 'text', - 'required' => true - ), - 'apisecret' => array( - 'name' => 'apisecret', - 'type' => 'text', - 'required' => true - ) - ); - - foreach ($expectedFieldset as $fieldId => $field) { - $element = $form->getElement($fieldId); - $this->assertInstanceOf('Magento\Data\Form\Element\AbstractElement', $element); - $this->assertEquals($field['name'], $element->getName(), 'Wrong \'' . $fieldId . '\' field name'); - $this->assertEquals($field['type'], $element->getType(), 'Wrong \'' . $fieldId . ' field type'); - $this->assertEquals($field['required'], $element->getData('required'), - 'Wrong \'' . $fieldId . '\' requirement state' - ); - } - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php deleted file mode 100644 index 71934daa19662a0849c582d441584659a20d6e52..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php +++ /dev/null @@ -1,56 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Failed - * - * @magentoAppArea adminhtml - */ -class FailedTest extends \PHPUnit_Framework_TestCase -{ - public function testGetSessionError() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - /** @var \Magento\Backend\Model\Session $session */ - $session = $objectManager->create('Magento\Backend\Model\Session'); - $context = $objectManager->create( - 'Magento\Backend\Block\Template\Context', - array('backendSession' => $session) - ); - $messageCollection = $objectManager->create('Magento\Message\Collection'); - $message = $objectManager->create('Magento\Message\Notice', array('code' => '')); - $messageCollection->addMessage($message); - $session->setData('messages', $messageCollection); - - $block = $objectManager->create('Magento\Webhook\Block\Adminhtml\Registration\Failed', - array('context' => $context)); - - $this->assertEquals($message->toString(), $block->getSessionError()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php deleted file mode 100644 index d9899520ef794b2a3f5c072283877b81994a6b5d..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php +++ /dev/null @@ -1,118 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Edit; - -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Edit\Form - * - * @magentoAppArea adminhtml - */ -class FormTest extends \PHPUnit_Framework_TestCase -{ - public function testPrepareForm() - { - /** @var $layout \Magento\View\LayoutInterface */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Core\Model\Layout'); - - /** @var \Magento\Core\Model\Registry $registry */ - $registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\Core\Model\Registry'); - $subscription = array( - 'name' => 'subscriptionName', - 'endpoint_url' => 'example.url.com', - 'format' => 'JSON', - 'authentication_type' => 'manual', - 'topics' => 'customer/created', - 'subscription_id' => '4' - ); - $registry - ->register( - 'current_subscription', - $subscription - ); - - /** @var \Magento\Webhook\Block\Adminhtml\Subscription\Edit\Form $block */ - $block = $layout->createBlock('Magento\Webhook\Block\Adminhtml\Subscription\Edit\Form', - '', array('registry' => $registry) - ); - $block->toHtml(); - - $form = $block->getForm(); - - $this->assertInstanceOf('Magento\Data\Form', $form); - $this->assertEquals('post', $form->getData('method')); - $this->assertEquals('edit_form', $form->getId()); - $this->assertTrue($form->getUseContainer()); - - $expectedFieldset = array( - 'name' => array( - 'name' => 'name', - 'type' => 'text', - 'required' => true, - 'value' => $subscription['name'] - ), - 'endpoint_url' => array( - 'name' => 'endpoint_url', - 'type' => 'text', - 'required' => true, - 'value' => $subscription['endpoint_url'] - ), - 'format' => array( - 'name' => 'format', - 'type' => 'select', - 'required' => false, - 'value' => $subscription['format'] - ), - 'authentication_type' => array( - 'name' => 'authentication_type', - 'type' => 'select', - 'required' => false, - 'value' => $subscription['authentication_type'] - ), - 'topics' => array( - 'name' => 'topics[]', - 'type' => 'select', - 'required' => true, - 'value' => $subscription['topics'] - ), - ); - - foreach ($expectedFieldset as $fieldId => $field) { - $element = $form->getElement($fieldId); - $this->assertInstanceOf('Magento\Data\Form\Element\AbstractElement', $element); - $this->assertEquals($field['name'], $element->getName(), 'Wrong \'' . $fieldId . '\' field name'); - $this->assertEquals($field['type'], $element->getType(), 'Wrong \'' . $fieldId . ' field type'); - $this->assertEquals( - $field['required'], - $element->getData('required'), - 'Wrong \'' . $fieldId . '\' requirement state' - ); - if (array_key_exists('value', $field)) { - $this->assertEquals($field['value'], $element->getData('value'), 'Wrong \'' . $fieldId . '\' value'); - } - } - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php deleted file mode 100644 index 048abee3d30bba29d0c2eb52305ffdf59cf70773..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php +++ /dev/null @@ -1,86 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription; - -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Edit - * - * @magentoAppArea adminhtml - */ -class EditTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - protected function setUp() - { - $this->_registry = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Core\Model\Registry'); - } - - protected function tearDown() - { - $this->_registry->unregister('current_subscription'); - } - - public function testAddSubscriptionTitle() - { - /** @var \Magento\View\LayoutInterface $layout */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\LayoutInterface'); - - $subscription = array( - 'subscription_id' => null, - ); - $this->_registry->register('current_subscription', $subscription); - - /** @var \Magento\Webhook\Block\Adminhtml\Subscription\Edit $block */ - $block = $layout->createBlock('Magento\Webhook\Block\Adminhtml\Subscription\Edit', - '', array('registry' => $this->_registry) - ); - $block->toHtml(); - $this->assertEquals('Add Subscription', $block->getHeaderText()); - - } - - public function testEditSubscriptionTitle() - { - /** @var \Magento\View\LayoutInterface $layout */ - $layout = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\View\LayoutInterface'); - - $subscription = array( - 'subscription_id' => 1, - ); - $this->_registry->register('current_subscription', $subscription); - - /** @var \Magento\Webhook\Block\Adminhtml\Subscription\Edit $block */ - $block = $layout->createBlock('Magento\Webhook\Block\Adminhtml\Subscription\Edit', - '', array('registry' => $this->_registry) - ); - $block->toHtml(); - $this->assertEquals('Edit Subscription', $block->getHeaderText()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php deleted file mode 100644 index 7afb6180c5ff098c0686928b795e15c301d73068..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php +++ /dev/null @@ -1,58 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer; - -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\Action - * - * @magentoAppArea adminhtml - */ -class ActionTest extends \PHPUnit_Framework_TestCase -{ - public function testRender() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $grid = $objectManager->create('Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\Action'); - - /** @var \Magento\Webhook\Model\Subscription $subscriptionRow */ - $subscriptionRow = $objectManager->create('Magento\Webhook\Model\Subscription'); - - $subscriptionRow->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE); - $this->assertTrue(strpos($grid->render($subscriptionRow), 'Revoke') !== false); - - $subscriptionRow->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE); - $this->assertTrue(strpos($grid->render($subscriptionRow), 'Activate') !== false); - $this->assertTrue(strpos($grid->render($subscriptionRow), 'activateSubscription') !== false); - - $subscriptionRow->setStatus(\Magento\Webhook\Model\Subscription::STATUS_REVOKED); - $this->assertTrue(strpos($grid->render($subscriptionRow), 'Activate') !== false); - - $invalidStatus = -1; - $subscriptionRow->setStatus($invalidStatus); - $this->assertEquals('', $grid->render($subscriptionRow)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php deleted file mode 100644 index bd0525e6d0e333a8c8a00943228556a985b349c4..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php +++ /dev/null @@ -1,46 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml; - -/** - * \Magento\Webhook\Block\Adminhtml\Subscription - * - * @magentoAppArea adminhtml - */ -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\ObjectManager */ - private $_objectManager; - - public function testConstruct() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $block = $this->_objectManager->create('Magento\Webhook\Block\Adminhtml\Subscription'); - $this->assertEquals('Subscriptions', $block->getHeaderText()); - $this->assertEquals('Add Subscription', $block->getAddButtonLabel()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php deleted file mode 100644 index 3061da492babe999568db55b140361985d2da97b..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php +++ /dev/null @@ -1,228 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -/** - * \Magento\Webhook\Controller\Adminhtml\Webhook\Registration - * - * @magentoAppArea adminhtml - * @magentoDbIsolation enabled - */ -class RegistrationTest extends \Magento\Backend\Utility\Controller -{ - /** @var \Magento\Webhook\Model\Subscription */ - private $_subscription; - - protected function setUp() - { - parent::setUp(); - $this->_createDummySubscription(); - } - - protected function tearDown() - { - parent::tearDown(); - if (isset($this->_subscription)) { - $this->_subscription->delete(); - } - } - - public function testActivateAction() - { - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/activate'); - $response = $this->getResponse()->getBody(); - $this->assertContains('page-popup adminhtml-webhook-registration-activate', $response); - $expectedContent = 'webhook_registration/accept/id/' . $subscriptionId; - $this->assertContains($expectedContent, $response); - } - - public function testAcceptAction() - { - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/accept'); - $this->assertRedirect($this->stringContains('webhook_registration/user/id/' . $subscriptionId)); - } - - public function testUserAction() - { - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/user'); - $response = $this->getResponse()->getBody(); - $this->assertContains('page-popup adminhtml-webhook-registration-user', $response); - $expectedContent = 'webhook_registration/register/id/' . $subscriptionId; - $this->assertContains($expectedContent, $response); - } - - /** - * @param array $requestParam - * @dataProvider requestParamDataProvider - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - */ - public function testRegisterActionMissingRequiredFields($requestParam) - { - foreach ($requestParam as $key => $value) { - $this->getRequest()->setParam($key, $value); - } - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/register'); - $this->assertSessionMessages( - $this->equalTo(array("API Key, API Secret and Contact Email are required fields.")), - \Magento\Message\Factory::ERROR - ); - $this->assertRedirect($this->stringContains('webhook_registration/failed')); - } - - /** - * Data provider for testRegisterActionMissingRequiredFields. - * - * @return array - */ - public function requestParamDataProvider() - { - return array( - array( - array( - 'apikey' => 'apikey' . uniqid(), - 'apisecret' => 'apisecret', - 'company' => 'company', - ), - ), - array( - array( - 'apikey' => 'apikey' . uniqid(), - 'email' => 'email', - 'company' => 'company', - ), - ), - array( - array( - 'email' => 'email', - 'apisecret' => 'apisecret', - 'company' => 'company', - ), - ) - ); - } - - /** - * @param array $requestParam - * @dataProvider requestParamDataProvider2 - * @magentoAppIsolation enabled - * @magentoDbIsolation enabled - */ - public function testRegisterActionWithRequiredFields($requestParam) - { - foreach ($requestParam as $key => $value) { - $this->getRequest()->setParam($key, $value); - } - - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/register'); - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been activated.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('webhook_registration/succeeded')); - } - - /** - * Data provider for testRegisterActionWithRequiredFields. - * - * @return array - */ - public function requestParamDataProvider2() - { - return array( - array( - array( - 'apikey' => 'apikey' . uniqid(rand()), - 'apisecret' => 'apisecret', - 'email' => 'email@domain.com', - 'company' => 'company', - ), - ), - array( - array( - 'apikey' => 'apikey' . uniqid(rand()), - 'apisecret' => 'apisecret', - 'email' => 'email@domain.com', - ), - ), - ); - } - - public function testRegisterActionWithInvalidEmailAndFailedAction() - { - $requestParam = array( - 'apikey' => 'apikey' . uniqid(), - 'apisecret' => 'apisecret', - 'email' => 'email', - 'company' => 'company', - ); - foreach ($requestParam as $key => $value) { - $this->getRequest()->setParam($key, $value); - } - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_registration/register'); - $this->assertSessionMessages( - $this->equalTo(array("Invalid Email address provided")), \Magento\Message\Factory::ERROR - ); - } - - public function testSucceededAction() - { - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_registration/succeeded'); - $response = $this->getResponse()->getBody(); - $this->assertContains('page-popup adminhtml-webhook-registration-succeeded', $response); - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been activated.")), - \Magento\Message\Factory::SUCCESS - ); - } - - /** - * Creates a dummy subscription for use in dispatched methods under testing - */ - private function _createDummySubscription() - { - /** @var $factory \Magento\Webhook\Model\Subscription\Factory */ - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get('Magento\Webhook\Model\Subscription\Factory'); - $this->_subscription = $factory->create() - ->setName('dummy') - ->save(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php deleted file mode 100644 index 6ba744711cec6a86a132aa28e9b14b1494abccb7..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php +++ /dev/null @@ -1,197 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - * - */ -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -/** - * \Magento\Webhook\Controller\Adminhtml\Webhook\Subscription - * - * @magentoAppArea adminhtml - * @magentoDbIsolation enabled - */ -class SubscriptionTest extends \Magento\Backend\Utility\Controller -{ - /** @var \Magento\Webhook\Model\Subscription */ - private $_subscription; - - protected function setUp() - { - parent::setUp(); - $this->_createDummySubscription(); - } - - public function testIndexAction() - { - $this->dispatch('backend/admin/webhook_subscription/index'); - $response = $this->getResponse()->getBody(); - - $this->assertContains('Subscriptions', $response); - $this->assertSelectCount('#subscriptionGrid', 1, $response); - } - - public function testNewAction() - { - $this->dispatch('backend/admin/webhook_subscription/new'); - $response = $this->getResponse()->getBody(); - - $this->assertEquals('edit', $this->getRequest()->getActionName()); - $this->assertContains('entry-edit form-inline', $response); - $this->assertContains('Add Subscription', $response); - $this->assertSelectCount('#subscription_fieldset', 1, $response); - } - - public function testEditAction() - { - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $this->dispatch('backend/admin/webhook_subscription/edit'); - $response = $this->getResponse()->getBody(); - $saveLink = 'webhook_subscription/save/id/' . $subscriptionId; - - $this->assertContains('entry-edit form-inline', $response); - $this->assertContains('Edit Subscription', $response); - $this->assertContains($saveLink, $response); - $this->assertSelectCount('#subscription_fieldset', 1, $response); - } - - public function testSaveActionNoData() - { - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_subscription/save'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has not been saved, as no data was provided.")), - \Magento\Message\Factory::ERROR - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/edit/')); - } - - public function testSaveActionUpdateSubscription() - { - $subscriptionId = $this->_subscription->getId(); - $this->getRequest()->setParam('id', $subscriptionId); - $url = 'endpoint_url' . uniqid(); - $this->getRequest()->setPost(array( - 'endpoint_url' => $url, - )); - $this->dispatch('backend/admin/webhook_subscription/save'); - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been saved.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testSaveActionNewSubscription() - { - $url = 'endpoint_url' . uniqid(); - $subscriptionName = 'new subscription'; - $this->getRequest()->setPost(array( - 'name' => $subscriptionName, - 'endpoint_url' => $url, - )); - $this->dispatch('backend/admin/webhook_subscription/save'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription '$subscriptionName' has been saved.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testDeleteActionNoId() - { - $this->dispatch('backend/admin/webhook_subscription/delete'); - - $this->assertSessionMessages( - $this->equalTo(array("Subscription with ID '' doesn't exist.")), - \Magento\Message\Factory::ERROR - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testDeleteActionWithAliasSubscription() - { - $this->_subscription->setAlias('alias')->save(); - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_subscription/delete'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' can not be removed.")), - \Magento\Message\Factory::ERROR - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testDeleteAction() - { - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_subscription/delete'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been removed.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testRevokeAction() - { - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_subscription/revoke'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been revoked.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - public function testActivateAction() - { - $this->getRequest()->setParam('id', $this->_subscription->getId()); - $this->dispatch('backend/admin/webhook_subscription/activate'); - - $this->assertSessionMessages( - $this->equalTo(array("The subscription 'dummy' has been activated.")), - \Magento\Message\Factory::SUCCESS - ); - $this->assertRedirect($this->stringContains('backend/admin/webhook_subscription/index/')); - } - - /** - * Creates a dummy subscription for use in dispatched methods under testing - */ - private function _createDummySubscription() - { - /** @var $factory \Magento\Webhook\Model\Subscription\Factory */ - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription\Factory'); - $this->_subscription = $factory->create() - ->setName('dummy') - ->save(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/EndpointTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/EndpointTest.php deleted file mode 100644 index 6f3ef4873f03ef210df8bd2ad08b981baac9ada3..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/EndpointTest.php +++ /dev/null @@ -1,72 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Endpoint - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class EndpointTest extends \PHPUnit_Framework_TestCase -{ - public function testGetMethods() - { - /** @var \Magento\Webhook\Model\Endpoint $endpoint */ - $endpoint = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Endpoint'); - - $endpoint->setEndpointUrl('endpoint.url.com'); - $this->assertEquals('endpoint.url.com', $endpoint->getEndpointUrl()); - - $endpoint->setTimeoutInSecs('9001'); - $this->assertEquals('9001', $endpoint->getTimeoutInSecs()); - - $endpoint->setFormat('JSON'); - $this->assertEquals('JSON', $endpoint->getFormat()); - - $endpoint->setAuthenticationType('basic'); - $this->assertEquals('basic', $endpoint->getAuthenticationType()); - - // test getUser - $endpoint->setApiUserId(null); - $this->assertEquals(null, $endpoint->getUser()); - - $userId = 42; - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\User', array('webapiUserId' => $userId)); - $endpoint->setApiUserId($userId); - $this->assertEquals($user, $endpoint->getUser()); - - } - - public function testBeforeSave() - { - /** @var \Magento\Webhook\Model\Endpoint $endpoint */ - $endpoint = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Endpoint'); - $endpoint->setUpdatedAt('-1') - ->save(); - - $this->assertEquals('none', $endpoint->getAuthenticationType()); - $this->assertFalse($endpoint->getUpdatedAt() == '-1'); - $endpoint->delete(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/FactoryTest.php deleted file mode 100644 index 9e1ab792934eb0b1b61f2b70303f8c971b506be9..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/FactoryTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -/** - * \Magento\Webhook\Model\Event\Factory - */ -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event\Factory'); - $data = array('array', 'of', 'event', 'data'); - $topic = 'Topic on which to publish data'; - - /** @var \Magento\Webhook\Model\Event $event */ - $event = $factory->create($topic, $data); - - $this->assertInstanceOf('Magento\Webhook\Model\Event', $event); - $this->assertEquals($topic, $event->getTopic()); - $this->assertEquals($data, $event->getBodyData()); - } - - public function testCreateEmpty() - { - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event\Factory'); - - /** @var \Magento\Webhook\Model\Event $event */ - $event = $factory->create('', array()); - - $this->assertInstanceOf('Magento\Webhook\Model\Event', $event); - $this->assertEmpty($event->getBodyData()); - $this->assertEmpty($event->getTopic()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php deleted file mode 100644 index 014ef5bcf330986a9af623d1abd72c25b7eccde5..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Event\QueueReader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -/** - * @magentoDbIsolation enabled - */ -class QueueReaderTest extends \PHPUnit_Framework_TestCase -{ - public function testPoll() - { - /** @var \Magento\Webhook\Model\Event $event */ - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - /** @var \Magento\Webhook\Model\Event\QueueReader $queue */ - $queue = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event\QueueReader'); - $this->assertEquals($event->getId(), $queue->poll()->getId()); - - // Make sure an empty queue returns null - $this->assertNull($queue->poll()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php deleted file mode 100644 index c9106c8caddc8a050a39f761320dc0ea6015bb0e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -/** - * \Magento\Webhook\Model\Event\QueueWriter - * - * @magentoDbIsolation enabled - */ -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @magentoDbIsolation enabled - */ - public function testOfferWebhookEvent() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - // New collection must be created to avoid interference between QueueReader tests - $collection = $objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $readerArgs = array('collection' => $collection); - - $bodyData = array('webhook', 'event', 'body', 'data'); - /** @var \Magento\Webhook\Model\Event\QueueWriter $queueWriter */ - $queueWriter = $objectManager->create('Magento\Webhook\Model\Event\QueueWriter'); - /** @var \Magento\Webhook\Model\Event $event */ - $event = $objectManager->create('Magento\Webhook\Model\Event') - ->setBodyData($bodyData); - $queueWriter->offer($event); - /** @var \Magento\Webhook\Model\Event\QueueReader $queueReader */ - $queueReader = $objectManager->create('Magento\Webhook\Model\Event\QueueReader', $readerArgs); - - $this->assertEquals($event->getBodyData(), $queueReader->poll()->getBodyData()); - // Make sure poll returns null after queue is empty - $this->assertNull($queueReader->poll()); - } - - /** - * @magentoDbIsolation enabled - */ - public function testOfferMagentoEvent() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - // New collection must be created to avoid interference between QueueReader tests - $collection = $objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $readerArgs = array('collection' => $collection); - - $bodyData = array('magento', 'event', 'body', 'data'); - $topic = 'some topic'; - $eventArgs = array( - 'bodyData' => $bodyData, - 'topic' => $topic - ); - - /** @var \Magento\Webhook\Model\Event\QueueWriter $queueWriter */ - $queueWriter = $objectManager->create('Magento\Webhook\Model\Event\QueueWriter'); - /** @var \Magento\Webhook\Model\Event $magentoEvent */ - $magentoEvent = $objectManager->create('Magento\PubSub\Event', $eventArgs); - $queueWriter->offer($magentoEvent); - /** @var \Magento\Webhook\Model\Event\QueueReader $queueReader */ - $queueReader = $objectManager->create('Magento\Webhook\Model\Event\QueueReader', $readerArgs); - - $this->assertEquals($magentoEvent->getBodyData(), $queueReader->poll()->getBodyData()); - // Make sure poll returns null after queue is empty - $this->assertNull($queueReader->poll()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/EventTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/EventTest.php deleted file mode 100644 index 7995c134b99764b463e9321741c7ddf4d2224d7d..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/EventTest.php +++ /dev/null @@ -1,82 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -/** - * @magentoDbIsolation enabled - */ -class EventTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Event */ - private $_event; - - protected function setUp() - { - $this->_event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event'); - } - - public function testSetGet() - { - $this->assertEmpty($this->_event->getBodyData()); - $data = array('body', 'data'); - $this->_event->setBodyData($data); - $this->assertEquals($data, $this->_event->getBodyData()); - - $this->assertEmpty($this->_event->getHeaders()); - $data = array('header', 'array'); - $this->_event->setHeaders($data); - $this->assertEquals($data, $this->_event->getHeaders()); - } - - public function testSetGetArrays() - { - $this->_event->setStatus(42); - $this->assertEquals(42, $this->_event->getStatus()); - - $this->_event->setTopic('customer/topic'); - $this->assertEquals('customer/topic', $this->_event->getTopic()); - } - - public function testMarkAsProcessed() - { - $this->_event->complete(); - $this->assertEquals(\Magento\PubSub\EventInterface::STATUS_PROCESSED, $this->_event->getStatus()); - } - - public function testSaveAndLoad() - { - $bodyData = array('array', 'of', 'body', 'data'); - $eventId = $this->_event - ->setBodyData($bodyData) - ->save() - ->getId(); - $loadedEvent = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->load($eventId); - $this->assertEquals($bodyData, $loadedEvent->getBodyData()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/FactoryTest.php deleted file mode 100644 index 37f6c2abb88e6923334e43e06dc1cd0b86922e07..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/FactoryTest.php +++ /dev/null @@ -1,51 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -/** - * @magentoDbIsolation enabled - */ -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Job\Factory'); - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save(); - $job = $factory->create($subscription, $event); - - $this->assertInstanceOf('Magento\Webhook\Model\Job', $job); - $this->assertEquals($event->getId(), $job->getEventId()); - $this->assertEquals($subscription->getId(), $job->getSubscriptionId()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php deleted file mode 100644 index 2db87adae0271de04db2ea742ee40fff295d9368..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php +++ /dev/null @@ -1,60 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\QueueReader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -/** - * @magentoDbIsolation enabled - */ -class QueueReaderTest extends \PHPUnit_Framework_TestCase -{ - public function testPoll() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save(); - - /** @var \Magento\Webhook\Model\Job $job */ - $job = $objectManager->create('Magento\Webhook\Model\Job'); - $job->setEventId($event->getId()); - $job->setSubscriptionId($subscription->getId()); - - $queueWriter = $objectManager->create('Magento\Webhook\Model\Job\QueueWriter'); - $queueWriter->offer($job); - - /** @var \Magento\Webhook\Model\Job\QueueReader $queueReader */ - $queueReader = $objectManager->create('Magento\Webhook\Model\Job\QueueReader'); - $this->assertEquals($job->getId(), $queueReader->poll()->getId()); - - $this->assertNull($queueReader->poll()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php deleted file mode 100644 index 125f31ee60b4618a70197d0c47d648550724890f..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\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) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -/** - * @magentoDbIsolation enabled - */ -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - public function testOffer() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save(); - /** @var \Magento\Webhook\Model\Job $job */ - $job = $objectManager->create('Magento\Webhook\Model\Job'); - $job->setEventId($event->getId()); - $job->setSubscriptionId($subscription->getId()); - - /** @var \Magento\Webhook\Model\Event\QueueWriter $queueWriter */ - $queueWriter = $objectManager->create('Magento\Webhook\Model\Job\QueueWriter'); - $queueWriter->offer($job); - - /** @var \Magento\Webhook\Model\Event\QueueReader $queueReader */ - $queueReader = $objectManager->create('Magento\Webhook\Model\Job\QueueReader'); - - $this->assertEquals($job->getId(), $queueReader->poll()->getId()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/JobTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/JobTest.php deleted file mode 100644 index 4bd2b03dd7cb46a882e53ce854f0cf095d666c06..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/JobTest.php +++ /dev/null @@ -1,171 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -/** - * - * @magentoDbIsolation enabled - */ -class JobTest extends \PHPUnit_Framework_TestCase -{ - /** - * mock endpoint url - */ - const ENDPOINT_URL = 'http://localhost/'; - const SUCCESS_RESPONSE = 200; - const FAILURE_RESPONSE = 404; - - /** - * @var \Magento\Webhook\Model\Job - */ - protected $_job; - - protected function setUp() - { - $this->_job = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Webhook\Model\Job'); - } - - public function testConstruct() - { - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - $eventId = $event->getId(); - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save(); - $subscriptionId = $subscription->getId(); - - $this->_job->setEvent($event); - $this->_job->setSubscription($subscription); - $this->_job->_construct(); - - $this->assertEquals($eventId, $this->_job->getEventId()); - $this->assertEquals($subscriptionId, $this->_job->getSubscriptionId()); - } - - public function testGetEventById() - { - $eventId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save() - ->getId(); - $this->_job->setData('event_id', $eventId); - $this->assertEquals($eventId, $this->_job->getEvent()->getId()); - } - - public function testGetEvent() - { - $event = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save(); - $this->_job->setData('event', $event); - $this->assertEquals($event, $this->_job->getEvent()); - } - - public function testGetSubscriptionById() - { - $subscriptionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save() - ->getId(); - $this->_job->setData('subscription_id', $subscriptionId); - $this->assertEquals($subscriptionId, $this->_job->getSubscription()->getId()); - } - - public function testGetSubscription() - { - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save(); - $this->_job->setData('subscription', $subscription); - $this->assertEquals($subscription, $this->_job->getSubscription()); - } - - public function testGetNonexistent() - { - $this->assertEquals(null, $this->_job->getEvent()); - $this->assertEquals(null, $this->_job->getSubscription()); - } - - public function testHandleResponseSuccess() - { - $subscriptionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save() - ->getId(); - $eventId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save() - ->getId(); - $this->_job->setData('subscription_id', $subscriptionId); - $this->_job->setData('event_id', $eventId); - - $this->_job->complete(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_SUCCEEDED, $this->_job->getStatus()); - } - - public function testHandleResponseRetry() - { - $subscriptionId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription') - ->setDataChanges(true) - ->save() - ->getId(); - $this->_job->setData('subscription_id', $subscriptionId); - - $eventId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Event') - ->setDataChanges(true) - ->save() - ->getId(); - $this->_job->setData('event_id', $eventId); - - $this->_job->handleFailure(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_RETRY, $this->_job->getStatus()); - } - - public function testHandleFailure() - { - $count = 1; - while ($count <= 8) { - $this->_job->handleFailure(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_RETRY, $this->_job->getStatus()); - $this->assertEquals($count, $this->_job->getRetryCount()); - $count++; - } - $this->_job->handleFailure(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_FAILED, $this->_job->getStatus()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php deleted file mode 100644 index 81a74d6d19eadd2ec5b288af90834ebfef5b0403..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/ObserverTest.php +++ /dev/null @@ -1,144 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Observer - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -/** - * @magentoDbIsolation enabled - */ -class ObserverTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Subscription */ - private $_subscription; - - /** @var \Magento\Webapi\Model\Acl\User */ - private $_user; - - /** @var \Magento\Webapi\Model\Acl\Role */ - private $_role; - - /** @var \Magento\Webhook\Model\Endpoint */ - private $_endpoint; - - /** @var \Magento\Webhook\Model\Subscription\Factory */ - private $_subscriptionFactory; - - protected function setUp() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - /** @var $factory \Magento\Webhook\Model\Subscription\Factory */ - $this->_subscriptionFactory = $objectManager->create('Magento\Webhook\Model\Subscription\Factory'); - - $this->_subscription = $objectManager->create('Magento\Webhook\Model\Subscription\Factory') - ->create() - ->setName('dummy') - ->setEndpointUrl('http://localhost') - ->save(); - - $this->_role = $objectManager->create('Magento\Webapi\Model\Acl\Role') - ->setData(array( 'role_name' => 'Test role')) - ->save(); - - $allowResourceId = 'test/get'; - /** @var \Magento\Webapi\Model\Acl\Rule $rule */ - $rule = $objectManager->create('Magento\Webapi\Model\Acl\Rule'); - $rule->setData(array( - 'resource_id' => $allowResourceId, - 'role_id' => $this->_role->getId() - )); - $rule->save(); - - $this->_user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User') - ->setData(array( - 'api_key' => 'webhook_test_username', - 'secret' => 'webhook_test_secret', - 'contact_email' => 'null@null.com', - 'role_id' => $this->_role->getId() - ))->save(); - - $this->_endpoint = $objectManager->create('Magento\Webhook\Model\Endpoint') - ->load($this->_subscription->getEndpointId()); - } - - public function testAfterWebapiUserDelete() - { - //setup - $this->_subscription->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE) - ->save(); - - //action - $this->_user->delete(); - - //verify - $this->assertEquals((\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE), - $this->_subscriptionFactory->create()->load($this->_subscription->getId())->getStatus()); - } - - public function testAfterWebapiUserChange() - { - //setup - $this->_subscription->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE) - ->setTopics(array('test/hook')) - ->save(); - $this->_endpoint->setApiUserId($this->_user->getUserId()) - ->save(); - - //action - $this->_user->setSecret('new secret')->save(); - - //verify - $this->assertEquals((\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE), - $this->_subscriptionFactory->create()->load($this->_subscription->getId())->getStatus()); - } - - public function testAfterWebapiRoleChange() - { - //setup - $this->_subscription->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE) - ->setTopics(array('test/hook')) - ->save(); - $this->_endpoint->setApiUserId($this->_user->getUserId()) - ->save(); - - //action - $this->_role->setRoleName('a new name')->save(); - - //verify - $this->assertEquals((\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE), - $this->_subscriptionFactory->create()->load($this->_subscription->getId())->getStatus()); - } - - protected function tearDown() - { - $this->_subscription->delete(); - $this->_user->delete(); - $this->_role->delete(); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php deleted file mode 100644 index a9c9cb3fd5cf73a57431688a2b25d1540cb6cdd8..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php +++ /dev/null @@ -1,126 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -/** - * \Magento\Webhook\Model\Resource\Endpoint - * - * @magentoDbIsolation enabled - */ -class EndpointTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Resource\Endpoint */ - private $_endpointResource; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_endpointResource = $this->_objectManager->get('Magento\Webhook\Model\Resource\Endpoint'); - } - - /** - * @magentoDbIsolation enabled - */ - public function testGetApiUserEndpoints() - { - // Set up the users to be associated with endpoints - $apiUserId = $this->_objectManager->create('Magento\Webapi\Model\Acl\User') - ->setDataChanged(true) - ->setApiKey('api_key1') - ->save() - ->getUserId(); - $wrongApiUserId = $this->_objectManager->create('Magento\Webapi\Model\Acl\User') - ->setDataChanged(true) - ->setApiKey('api_key2') - ->save() - ->getUserId(); - $this->_objectManager->create('Magento\Webhook\Model\User', array('webapiUserId' => $apiUserId)); - $this->_objectManager->create('Magento\Webhook\Model\User', array('webapiUserId' => $wrongApiUserId)); - - $endpointIds = array(); - - // All of these should be returned - for ($i = 0; $i < 3; $i++) { - $endpointIds[] = $this->_objectManager - ->create('Magento\Webhook\Model\Endpoint') - ->setApiUserId($apiUserId) - ->save() - ->getId(); - } - - // None of these should be returned - for ($i = 0; $i < 3; $i++) { - $this->_objectManager->create('Magento\Webhook\Model\Endpoint') - ->setApiUserId($wrongApiUserId) - ->save() - ->getId(); - } - - // Test retrieving them - $this->assertEquals($endpointIds, $this->_endpointResource->getApiUserEndpoints($apiUserId)); - } - - /** - * @magentoDbIsolation enabled - */ - public function testGetEndpointsWithoutApiUser() - { - // Set up the user to be associated with endpoints - $apiUserId = $this->_objectManager->create('Magento\Webapi\Model\Acl\User') - ->setDataChanged(true) - ->setApiKey('api_key3') - ->save() - ->getUserId(); - $this->_objectManager->create('Magento\Webhook\Model\User', array('webapiUserId' => $apiUserId)); - - $endpointIdsToFind = array(); - - // All of these should be returned - for ($i = 0; $i < 3; $i++) { - $endpointIdsToFind[] = $this->_objectManager - ->create('Magento\Webhook\Model\Endpoint') - ->setApiUserId(null) - ->save() - ->getId(); - } - - // None of these should be returned - for ($i = 0; $i < 3; $i++) { - $this->_objectManager->create('Magento\Webhook\Model\Endpoint') - ->setApiUserId($apiUserId) - ->save() - ->getId(); - } - - // Test retrieving them - $this->assertEquals($endpointIdsToFind, $this->_endpointResource->getEndpointsWithoutApiUser()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php deleted file mode 100644 index a6c7f94727a91242ef37915fcafe6b06af8df67a..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php +++ /dev/null @@ -1,181 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Event; - -/** - * \Magento\Webhook\Model\Resource\Event\Collection - */ -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - } - - /** - * @magentoDbIsolation enabled - */ - public function testInit() - { - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertEquals('Magento\Webhook\Model\Resource\Event', $collection->getResourceModelName()); - $this->assertEquals('Magento\Webhook\Model\Event', $collection->getModelName()); - - /* check FOR UPDATE lock */ - $forUpdate = $collection->getSelect()->getPart(\Zend_Db_Select::FOR_UPDATE); - $this->assertTrue($forUpdate); - - $where = array("(`status` = '" . \Magento\PubSub\EventInterface::STATUS_READY_TO_SEND . "')"); - $this->assertEquals($where, $collection->getSelect()->getPart(\Zend_Db_Select::WHERE)); - } - - /** - * @magentoDbIsolation enabled - */ - public function testGetData() - { - $event = $this->_objectManager->create('Magento\Webhook\Model\Event')->save(); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertEquals(1, count($collection->getItems())); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collectionSecond */ - $collectionSecond = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertEquals(0, count($collectionSecond->getItems())); - - $updatedEvent = $this->_objectManager->create('Magento\Webhook\Model\Event') - ->load($event->getId()); - - $this->assertEquals(\Magento\PubSub\EventInterface::STATUS_IN_PROGRESS, $updatedEvent->getStatus()); - $event->delete(); - } - - /** - * @magentoDbIsolation enabled - */ - public function testNewEventInNewCollection() - { - $event1 = $this->_objectManager->create('Magento\Webhook\Model\Event')->save(); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertEquals(1, count($collection->getItems())); - $this->assertEquals($event1->getId(), $collection->getFirstItem()->getId()); - - $event2 = $this->_objectManager->create('Magento\Webhook\Model\Event')->save(); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collectionSecond */ - $collectionSecond = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertEquals(1, count($collectionSecond->getItems())); - $this->assertEquals($event2->getId(), $collectionSecond->getFirstItem()->getId(), - sprintf("Event #%s is expected in second collection," - . "found event #%s. It could lead to race conditions issue if it is #%s", - $event2->getId(), $collectionSecond->getFirstItem()->getId(), $event1->getId()) - ); - - $event1->delete(); - $event2->delete(); - } - - /** - * @magentoDbIsolation enabled - */ - public function testRevokeIdlingInProgress() - { - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertNull($collection->revokeIdlingInProgress()); - } - - /** - * Emulates concurrent transactions. Executes 50 seconds because of lock timeout - * - * @magentoDbIsolation enabled - * @expectedException \Zend_Db_Statement_Exception - * @expectedMessage SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction - */ - public function testParallelTransactions() - { - $event = $this->_objectManager->create('Magento\Webhook\Model\Event')->save(); - $event2 = $this->_objectManager->create('Magento\Webhook\Model\Event')->save(); - /** @var \Magento\Webhook\Model\Event $event3 */ - $event3 = $this->_objectManager->create('Magento\Webhook\Model\Event') - ->setStatus(\Magento\PubSub\EventInterface::STATUS_IN_PROGRESS) - ->save(); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - - - - $beforeLoad = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Event\Collection', '_beforeLoad'); - $beforeLoad->setAccessible(true); - $beforeLoad->invoke($collection); - $data = $collection->getData(); - $this->assertEquals(2, count($data)); - - /** @var \Magento\App\Resource $resource */ - $resource = $this->_objectManager->create('Magento\App\Resource'); - $connection = $resource->getConnection('core_write'); - - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection2 */ - $collection2 = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $collection2->setConnection($connection); - $initSelect = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Event\Collection', '_initSelect'); - $initSelect->setAccessible(true); - $initSelect->invoke($collection2); - - - $afterLoad = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Event\Collection', '_afterLoad'); - $afterLoad->setAccessible(true); - - - try { - $collection2->getData(); - } catch (\Zend_Db_Statement_Exception $e) { - $event->delete(); - $event2->delete(); - $event3->delete(); - $afterLoad->invoke($collection); - - throw ($e); - } - $event->delete(); - $event2->delete(); - $event3->delete(); - $afterLoad->invoke($collection); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php deleted file mode 100644 index f8e36902b16420a2d0cac232d5e093102d760f06..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/EventTest.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -/** - * @magentoDbIsolation enabled - */ -class EventTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers \Magento\Webhook\Model\Resource\Event::_init - */ - public function testInit() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $resource = $objectManager->create('Magento\App\Resource', array('tablePrefix' => 'prefix_')); - - /** @var \Magento\Webhook\Model\Resource\Event $eventResource */ - $eventResource = $objectManager->create('Magento\Webhook\Model\Resource\Event', array('resource' => $resource)); - - $this->assertEquals('prefix_webhook_event', $eventResource->getMainTable()); - $this->assertEquals('event_id', $eventResource->getIdFieldName()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php deleted file mode 100644 index 92a13800d449d54e3e06ff248b5da4f6dd7c6d91..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php +++ /dev/null @@ -1,187 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Job; - -/** - * \Magento\Webhook\Model\Resource\Job\Collection - */ -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Subscription */ - protected $_subscription; - - /** @var \Magento\Webhook\Model\Event */ - protected $_event; - - /** @var \Magento\Webhook\Model\Endpoint */ - protected $_endpoint; - - /** @var \Magento\Webapi\Model\Acl\User */ - protected $_user; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_user = $this->_objectManager->create('Magento\Webapi\Model\Acl\User') - ->setApiKey(md5(rand(0, time()))) - ->save(); - $this->_endpoint = $this->_objectManager->create('Magento\Webhook\Model\Endpoint') - ->setEndpointUrl('test') - ->setTimeoutInSecs('test') - ->setFormat('test') - ->setAuthenticationType('authentication_type'); - $this->_subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription', - array('endpoint' => $this->_endpoint)) - ->setApiUserId($this->_user->getId()) - ->save(); - $this->_event = $this->_objectManager->create('Magento\Webhook\Model\Event') - ->save(); - } - - protected function tearDown() - { - $this->_subscription->delete(); - $this->_event->delete(); - $this->_endpoint->delete(); - $this->_user->delete(); - } - - public function testInit() - { - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $this->assertEquals('Magento\Webhook\Model\Resource\Job', $collection->getResourceModelName()); - $this->assertEquals('Magento\Webhook\Model\Job', $collection->getModelName()); - } - - public function testNewEventInNewCollection() - { - $job1 = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->setSubscriptionId($this->_subscription->getId()) - ->setEventId($this->_event->getId()) - ->save(); - - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $this->assertEquals(1, count($collection->getItems())); - $this->assertEquals($job1->getId(), $collection->getFirstItem()->getId()); - - $job2 = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->setSubscriptionId($this->_subscription->getId()) - ->setEventId($this->_event->getId()) - ->save(); - - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collectionSecond */ - $collectionSecond = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $this->assertEquals(1, count($collectionSecond->getItems())); - $this->assertEquals($job2->getId(), $collectionSecond->getFirstItem()->getId(), - sprintf("Event #%s is expected in second collection," - . "found event #%s. It could lead to race conditions issue if it is #%s", - $job2->getId(), $collectionSecond->getFirstItem()->getId(), $job1->getId()) - ); - - $job1->delete(); - $job2->delete(); - } - - /** - * Emulates concurrent transactions. Executes 50 seconds because of lock timeout - * - * @expectedException \Zend_Db_Statement_Exception - * @expectedMessage SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction - */ - public function testParallelTransactions() - { - $job = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->setSubscriptionId($this->_subscription->getId()) - ->setEventId($this->_event->getId()) - ->save(); - $job2 = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->setSubscriptionId($this->_subscription->getId()) - ->setEventId($this->_event->getId()) - ->save(); - $job3 = $this->_objectManager->create('Magento\Webhook\Model\Job') - ->setSubscriptionId($this->_subscription->getId()) - ->setEventId($this->_event->getId()) - ->setStatus(\Magento\PubSub\JobInterface::STATUS_IN_PROGRESS) - ->save(); - - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - - $beforeLoad = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Job\Collection', '_beforeLoad'); - $beforeLoad->setAccessible(true); - $beforeLoad->invoke($collection); - $data = $collection->getData(); - $this->assertEquals(2, count($data)); - - /** @var \Magento\App\Resource $resource */ - $resource = $this->_objectManager->create('Magento\App\Resource'); - $connection = $resource->getConnection('core_write'); - - /** @var \Magento\Webhook\Model\Resource\Job\Collection $collection2 */ - $collection2 = $this->_objectManager->create('Magento\Webhook\Model\Resource\Job\Collection'); - $collection2->setConnection($connection); - $initSelect = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Job\Collection', '_initSelect'); - $initSelect->setAccessible(true); - $initSelect->invoke($collection2); - - - $afterLoad = new \ReflectionMethod( - 'Magento\Webhook\Model\Resource\Job\Collection', '_afterLoad'); - $afterLoad->setAccessible(true); - - - try { - $collection2->getData(); - } catch (\Zend_Db_Statement_Exception $e) { - $job->delete(); - $job2->delete(); - $job3->delete(); - $afterLoad->invoke($collection); - - throw ($e); - } - $job->delete(); - $job2->delete(); - $job3->delete(); - $afterLoad->invoke($collection); - } - - public function testRevokeIdlingInProgress() - { - /** @var \Magento\Webhook\Model\Resource\Event\Collection $collection */ - $collection = $this->_objectManager->create('Magento\Webhook\Model\Resource\Event\Collection'); - $this->assertNull($collection->revokeIdlingInProgress()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php deleted file mode 100644 index a62e45d765452dd19d89e69d4d31fd0d6fdd626c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/JobTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Job - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class JobTest extends \PHPUnit_Framework_TestCase -{ - /** - * @covers \Magento\Webhook\Model\Resource\Job::_init - */ - public function testInit() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $resource = $objectManager->create('Magento\App\Resource', array('tablePrefix' => 'prefix_')); - - /** @var \Magento\Webhook\Model\Resource\Job $jobResource */ - $jobResource = $objectManager->create('Magento\Webhook\Model\Resource\Job', array('resource' => $resource)); - - $this->assertEquals('prefix_webhook_dispatch_job', $jobResource->getMainTable()); - $this->assertEquals('dispatch_job_id', $jobResource->getIdFieldName()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php deleted file mode 100644 index 53d56afb0324bba0f7875f3fdb7e6bbdf1b06e61..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php +++ /dev/null @@ -1,222 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription; - -/** - * \Magento\Webhook\Model\Resource\Subscription\Collection - * - * We need DB isolation to avoid confusing interactions with the other Webhook tests. - * - * @magentoDbIsolation enabled - */ -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - const TOPIC_LISTENERS_THREE = 'listeners/three'; - const TOPIC_LISTENERS_TWO = 'listeners/two'; - const TOPIC_LISTENERS_ONE = 'listeners/one'; - const TOPIC_UNKNOWN = 'unknown'; - /** - * API Key for user - */ - const API_KEY = 'Magento\Webhook\Model\Resource\Subscription\CollectionTest'; - - /** @var int */ - private static $_apiUserId; - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection */ - private $_subscriptionSet; - - /** @var \Magento\Webhook\Model\Subscription[] */ - private $_subscriptions; - - public static function setUpBeforeClass() - { - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Webapi\Model\Acl\User'); - $user->loadByKey(self::API_KEY); - if ($user->getId()) { - self::$_apiUserId = $user->getId(); - } else { - /** @var \Magento\Webhook\Model\Webapi\User\Factory $webapiUserFactory */ - $webapiUserFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Webapi\User\Factory'); - self::$_apiUserId = $webapiUserFactory->createUser( - array( - 'email' => 'email@localhost.com', - 'key' => self::API_KEY, - 'secret' =>'secret' - ), - array() - ); - } - } - - protected function setUp() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_subscriptions = array(); - - $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); - $webHooks = array( - 'listeners' => array( - 'one' => array('label' => 'One Listener'), - 'two' => array('label' => 'Two Listeners'), - 'three' => array('label' => 'Three Listeners'), - ) - ); - $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); - $objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('inactive') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/endpoint') - ->setFormat('json') - ->setName('Inactive Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('first') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/endpoint') - ->setFormat('json') - ->setName('First Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('second') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/unique_endpoint') - ->setFormat('json') - ->setName('Second Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_TWO, self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('third') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/unique_endpoint') - ->setFormat('json') - ->setName('Third Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_ONE, self::TOPIC_LISTENERS_TWO, self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->setApiUserId(self::$_apiUserId) - ->save(); - $this->_subscriptions[] = $subscription; - - $this->_subscriptionSet = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Resource\Subscription\Collection'); - } - - protected function tearDown() - { - foreach ($this->_subscriptions as $subscription) { - $subscription->delete(); - } - } - - public function testGetSubscriptions() - { - $subscriptions = $this->_subscriptionSet->getItems(); - $this->assertEquals(4, count($subscriptions)); - } - - public function testGetActiveSubscriptions() - { - $subscriptions = $this->_subscriptionSet->addIsActiveFilter(true)->getItems(); - $this->assertEquals(3, count($subscriptions)); - } - - public function testGetInactiveSubscriptions() - { - $subscriptions = $this->_subscriptionSet->addIsActiveFilter(false)->getItems(); - $this->assertEquals(1, count($subscriptions)); - } - - public function testGetUnknownTopicSubscriptions() - { - $subscriptions = $this->_subscriptionSet->addTopicFilter(self::TOPIC_UNKNOWN)->getItems(); - $this->assertEquals(0, count($subscriptions)); - } - - public function testGetKnownTopicSubscriptions() - { - $subscriptions = $this->_subscriptionSet->addTopicFilter(self::TOPIC_LISTENERS_ONE)->getItems(); - $this->assertEquals(1, count($subscriptions)); - } - - public function testGetSubscriptionsByTopic() - { - $subscriptions = $this->_subscriptionSet->getSubscriptionsByTopic(self::TOPIC_LISTENERS_THREE); - - $this->assertEquals(3, count($subscriptions)); - - $subscriptions = $this->_subscriptionSet->getSubscriptionsByTopic(self::TOPIC_LISTENERS_TWO); - - $this->assertEquals(2, count($subscriptions)); - - $subscriptions = $this->_subscriptionSet->getSubscriptionsByTopic(self::TOPIC_LISTENERS_ONE); - - $this->assertEquals(1, count($subscriptions)); - } - - public function testGetSubscriptionsByAlias() - { - $subscriptions = $this->_subscriptionSet->getSubscriptionsByAlias('first'); - // There should only be one item - foreach ($subscriptions as $subscription) { - $this->assertEquals('First Subscription', $subscription->getName()); - } - } - - public function testGetActivatedSubscriptionsWithoutApiUser() - { - $subscriptions = $this->_subscriptionSet->getActivatedSubscriptionsWithoutApiUser(); - - $this->assertEquals(2, count($subscriptions)); - } - - public function testGetApiUserSubscriptions() - { - $subscriptions = $this->_subscriptionSet->getApiUserSubscriptions(self::$_apiUserId); - - $this->assertEquals(1, count($subscriptions)); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php deleted file mode 100644 index 2f0fdf786741efa223df1ff2f33aeaf26800b906..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php +++ /dev/null @@ -1,202 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription\Grid; - -/** - * \Magento\Webhook\Model\Resource\Subscription\Grid\Collection - * - * We need DB isolation to avoid confusing interactions with the other Webhook tests. - * - * @magentoDbIsolation enabled - */ -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** Topics */ - const TOPIC_LISTENERS_THREE = 'listeners/three'; - const TOPIC_LISTENERS_TWO = 'listeners/two'; - const TOPIC_LISTENERS_ONE = 'listeners/one'; - const TOPIC_UNKNOWN = 'unknown'; - - /** - * API Key for user - */ - const API_KEY = 'Magento\Webhook\Model\Resource\Subscription\Grid\CollectionTest'; - - /** @var int */ - private static $_apiUserId; - - /** @var \Magento\Webhook\Model\Subscription[] */ - private $_subscriptions; - - /** @var \Magento\Webhook\Model\Subscription\Config */ - private $_config; - - public static function setUpBeforeClass() - { - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\Webapi\Model\Acl\User'); - $user->loadByKey(self::API_KEY); - if ($user->getId()) { - self::$_apiUserId = $user->getId(); - } else { - /** @var \Magento\Webhook\Model\Webapi\User\Factory $webapiUserFactory */ - $webapiUserFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Webapi\User\Factory'); - self::$_apiUserId = $webapiUserFactory->createUser( - array( - 'email' => 'email@localhost.com', - 'key' => self::API_KEY, - 'secret' =>'secret' - ), - array() - ); - } - } - - protected function setUp() - { - $this->_createSubscriptions(); - - $this->_config = $this->_createSubscriptionConfig(); - } - - protected function tearDown() - { - foreach ($this->_subscriptions as $subscription) { - $subscription->delete(); - } - } - - public function testGetSubscriptions() - { - $gridCollection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Resource\Subscription\Grid\Collection', - array('subscriptionConfig' => $this->_config)); - - $subscriptions = $gridCollection->getItems(); - $this->assertEquals(5, count($subscriptions)); - } - - /** - * Create subscription configure - * - * @return \Magento\Webhook\Model\Subscription\Config - */ - protected function _createSubscriptionConfig() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); - $subscriptions = array( - 'subscription_alias' => array( - 'name' => 'Test subscriber', - 'endpoint_url' => 'http://mage.loc/mage-twitter-integration/web/index.php/endpoint', - 'topics' => array( - 'customer' => array( - 'created' => '', - 'updated' => '', - 'deleted' => '', - ), - 'order' => array( - 'created' - ), - ), - ), - ); - $configMock->expects($this->any())->method('getSubscriptions')->will($this->returnValue($subscriptions)); - - return $objectManager->create('Magento\Webhook\Model\Subscription\Config', array( - 'config' => $configMock - )); - } - - protected function _createSubscriptions() - { - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->_subscriptions = array(); - - $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); - $webHooks = array( - 'listeners' => array( - 'one' => array('label' => 'One Listener'), - 'two' => array('label' => 'Two Listeners'), - 'three' => array('label' => 'Three Listeners'), - ) - ); - $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); - $objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('inactive') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/endpoint') - ->setFormat('json') - ->setName('Inactive Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('first') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/endpoint') - ->setFormat('json') - ->setName('First Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - $subscription = $objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('second') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/unique_endpoint') - ->setFormat('json') - ->setName('Second Subscription') - ->setTopics(array(self::TOPIC_LISTENERS_TWO, self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - $this->_subscriptions[] = $subscription; - - $subscription = $objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setAlias('third') - ->setAuthenticationType('hmac') - ->setEndpointUrl('http://localhost/unique_endpoint') - ->setFormat('json') - ->setName('Third Subscription') - ->setTopics(array( - self::TOPIC_LISTENERS_ONE, - self::TOPIC_LISTENERS_TWO, - self::TOPIC_LISTENERS_THREE)) - ->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->setApiUserId(self::$_apiUserId) - ->save(); - $this->_subscriptions[] = $subscription; - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php deleted file mode 100644 index 07161f0af9c78bec46b3e183dc937fe9ab61fec2..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php +++ /dev/null @@ -1,96 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -/** - * \Magento\Webhook\Model\Resource\Subscription - * - * @magentoDbIsolation enabled - */ -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Resource\Subscription */ - private $_resource; - - protected function setUp() - { - $this->_resource = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Resource\Subscription'); - } - - public function testLoadTopics() - { - $topics = array( - 'customer/created', - 'customer/updated', - 'customer/deleted', - ); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setTopics($topics); - $subscription->save(); - - - $this->_resource->loadTopics($subscription); - // When topics are not set, getTopics() calls resource's loadTopics method - $this->assertEquals($topics, $subscription->getTopics()); - $subscription->delete(); - } - - public function testSaveAndLoad() - { - $topics = array( - 'customer/created', - 'customer/updated', - 'customer/deleted', - ); - - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscriptionId = $subscription - ->setTopics($topics) - ->setName('subscription to load') - ->save() - ->getId(); - - // This is done so all of the topic save logic is used - $topics[] = 'order/created'; - unset($topics[0]); - $topics = array_values($topics); // Fix integer indices - $subscription->setTopics($topics) - ->save(); - - $loadedSubscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $loadedSubscription->load($subscriptionId); - - $this->assertEquals('subscription to load', $loadedSubscription->getName()); - $this->assertEquals($topics, $loadedSubscription->getTopics()); - - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php deleted file mode 100644 index cf221137e83f6fcc403377dff5f1a70f8892d01c..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php +++ /dev/null @@ -1,103 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription; - -/** - * \Magento\Webhook\Model\Subscription\Config - * - * @magentoDbIsolation enabled - */ -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** - * alias being used in the _files/config.xml file - */ - const SUBSCRIPTION_ALIAS = 'subscription_alias'; - - /** - * name being used in the _files/config.xml file - */ - const SUBSCRIPTION_NAME = 'Test subscriber'; - - /** - * @var \Magento\Webhook\Model\Subscription\Config - */ - private $_config; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - - $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); - $subscriptions = array( - 'subscription_alias' => array( - 'name' => 'Test subscriber', - 'endpoint_url' => 'http://mage.loc/mage-twitter-integration/web/index.php/endpoint', - 'topics' => array( - 'customer' => array( - 'created' => '', - 'updated' => '', - 'deleted' => '', - ), - 'order' => array( - 'created' - ), - ), - ), - ); - $configMock->expects($this->any())->method('getSubscriptions')->will($this->returnValue($subscriptions)); - - $this->_config = $objectManager->create('Magento\Webhook\Model\Subscription\Config', array( - 'config' => $configMock - )); - } - - public function testReadingConfig() - { - - /** @var \Magento\Webhook\Model\Resource\Subscription\Collection $subscriberCollection */ - $subscriptionSet = $this->_objectManager->create('Magento\Webhook\Model\Resource\Subscription\Collection'); - - // Sanity check - $subscriptions = $subscriptionSet->getSubscriptionsByAlias(self::SUBSCRIPTION_ALIAS); - $this->assertEmpty($subscriptions); - $this->_config->updateSubscriptionCollection(); - - // Test that data matches what we have in config.xml - $subscriptions = $subscriptionSet->getSubscriptionsByAlias(self::SUBSCRIPTION_ALIAS); - $this->assertEquals(1, count($subscriptions)); - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = array_shift($subscriptions); - $this->assertEquals(self::SUBSCRIPTION_NAME, $subscription->getName()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php deleted file mode 100644 index 141dc325a994436691b4af9a7d5b0146ec6f98e1..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php +++ /dev/null @@ -1,46 +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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription\Options; - -/** - * \Magento\Webhook\Model\Subscription\Options\Status - */ -class StatusTest extends \PHPUnit_Framework_TestCase -{ - public function testToOptionArray() - { - $translator = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Core\Model\Translate'); - $object = new \Magento\Webhook\Model\Subscription\Options\Status($translator); - $expectedArray = array( - \Magento\Webhook\Model\Subscription::STATUS_ACTIVE => 'Active', - \Magento\Webhook\Model\Subscription::STATUS_REVOKED => 'Revoked', - \Magento\Webhook\Model\Subscription::STATUS_INACTIVE => 'Inactive', - ); - $this->assertEquals($expectedArray, $object->toOptionArray()); - - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php deleted file mode 100644 index 8a26a89783551f2ed35c5f1d3c52847210d42554..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/SubscriptionTest.php +++ /dev/null @@ -1,488 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -/** - * \Magento\Webhook\Model\Subscription - * - * @magentoAppArea adminhtml - * @magentoDbIsolation enabled - */ -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - /** - * Constant strings representing hooks in the config files - */ - const HOOK_IN_CONFIG = 'test/hook'; - const HOOK_NOT_IN_CONFIG = 'test/hook_not_in_config'; - const OTHER_HOOK = 'test/two'; - - /** - * Constants for setting/getting data - */ - const VALUE_NAME = 'subscription name'; - const VALUE_ALIAS = 'sub_alias'; - const VALUE_ENDPOINT_URL = 'http://localhost/endpoint'; - const VALUE_ENDPOINT_ID = 'endpoint_id_value'; - const VALUE_FORMAT = 'json'; - const VALUE_STATUS = \Magento\Webhook\Model\Subscription::STATUS_INACTIVE; - const VALUE_AUTHENTICATION_TYPE = 'hmac'; - const VALUE_API_USER_ID = null; - const VALUE_REG_MECH = 'registration_mechanism'; - const VALUE_UPDATED_AT = 'Five minutes ago.'; - const VALUE_TIMEOUT_IN_SECS = '30'; - - const KEY_NAME = 'name'; - const KEY_ALIAS = 'alias'; - const KEY_ENDPOINT_URL = \Magento\Webhook\Model\Subscription::FIELD_ENDPOINT_URL; - const KEY_FORMAT = \Magento\Webhook\Model\Subscription::FIELD_FORMAT; - const KEY_STATUS = 'status'; - const KEY_API_USER_ID = \Magento\Webhook\Model\Subscription::FIELD_API_USER_ID; - const KEY_AUTHENTICATION_TYPE = \Magento\Webhook\Model\Subscription::FIELD_AUTHENTICATION_TYPE; - const KEY_TIMEOUT_IN_SECS = \Magento\Webhook\Model\Subscription::FIELD_TIMEOUT_IN_SECS; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - protected function setUp() - { - // Clean out the cache - $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Acl\CacheInterface $aclCache */ - $aclCache = $this->_objectManager->get('Magento\Acl\CacheInterface'); - $aclCache->clean(); - // add new hooks for the tests - - - $configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false, false); - $webHooks = array( - 'test' => array( - 'hook' => array('label' => 'Test Hook'), - 'two' => array('label' => 'Test Hook Two'), - ) - ); - $configMock->expects($this->any())->method('getWebhooks')->will($this->returnValue($webHooks)); - $this->_objectManager->addSharedInstance($configMock, 'Magento\Webhook\Model\Config'); - } - - protected function tearDown() - { - // Clean out the cache - /** @var \Magento\Acl\CacheInterface $aclCache */ - $aclCache = $this->_objectManager->get('Magento\Acl\CacheInterface'); - $aclCache->clean(); - } - - public function testSetGetHooks() - { - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $this->assertEmpty($subscription->getTopics(), - "New subscription shouldn't be subscribed on any hooks."); - - // Get topics returns all topics that were set, both valid and invalid, before save - $topics = array(self::HOOK_IN_CONFIG, self::HOOK_NOT_IN_CONFIG); - $subscription->setTopics($topics); - $this->assertEquals($topics, $subscription->getTopics()); - - $subscription->save(); - - // All, and only, topics stored in config should persist after save - $loadedSubscription = $this->_getSubscription($subscription->getId()); - $this->assertEquals(array(self::HOOK_IN_CONFIG), $loadedSubscription->getTopics()); - - $this->assertEquals(array('test/hook'), $loadedSubscription->getTopics()); - - // cleanup - $subscription->delete(); - } - - public function testHasTopic() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setTopics(array(self::HOOK_IN_CONFIG)) - ->save(); - - $this->assertTrue($subscription->hasTopic(self::HOOK_IN_CONFIG)); - $this->assertFalse($subscription->hasTopic(self::HOOK_NOT_IN_CONFIG)); - } - - public function testActivate() - { - //setup - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE) - ->save(); - - //action - $subscription->activate(); - - //verify - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $subscription->getStatus()); - $subscriptionInDb = $this->_getSubscription($subscription->getId()); - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE, $subscriptionInDb->getStatus()); - } - - public function testDeactivate() - { - //setup - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - - //action - $subscription->deactivate(); - - //verify - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE, $subscription->getStatus()); - $subscriptionInDb = $this->_getSubscription($subscription->getId()); - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $subscriptionInDb->getStatus()); - } - - public function testRevoke() - { - //setup - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE) - ->save(); - - //action - $subscription->revoke(); - - //verify - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_REVOKED, $subscription->getStatus()); - $subscriptionInDb = $this->_getSubscription($subscription->getId()); - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $subscriptionInDb->getStatus()); - } - - public function testFindRestrictedTopics() - { - /** TODO: This test should be rewritten after global ACL service introduction. */ - $this->markTestIncomplete("This test should be rewritten after global ACL service introduction."); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - - /** @var \Magento\Webhook\Model\Webapi\User\Factory $webapiUserFactory */ - $webapiUserFactory = $this->_objectManager->create('Magento\Webhook\Model\Webapi\User\Factory'); - $userContext = array( - 'key' => 'some_key_value', - 'secret' => 'shh', - 'company' => 'Corporate Corporations Inc.', - 'email' => 'email.address@email.com' - ); - - $allowedTopics = array( - 'webhook/get', - ); - $restrictedTopics = array( - 'customer/get', - ); - $allTopics = array_merge($allowedTopics, $restrictedTopics); - - $webapiUserId = $webapiUserFactory->createUser($userContext, $allowedTopics); - $subscription->setApiUserId($webapiUserId) - ->setTopics($allTopics) - ->save(); - - $retrievedTopics = $subscription->findRestrictedTopics(); - $this->assertEquals($restrictedTopics, $retrievedTopics); - } - - public function testUpdatingHooks() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setTopics(array(self::HOOK_IN_CONFIG)) - ->save(); - - // Sanity check - $loadedSubscription = $this->_getSubscription($subscription->getId()); - $this->assertEquals(array(self::HOOK_IN_CONFIG), $loadedSubscription->getTopics()); - - $subscription->setTopics(array(self::OTHER_HOOK)) - ->save(); - - // Verify we only have the new hook - $loadedSubscription = $this->_getSubscription($subscription->getId()); - $this->assertEquals(array(self::OTHER_HOOK), $loadedSubscription->getTopics()); - } - - public function testGetUser() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - - // Test getUser - $userContext = array( - 'key' => 'some_other_key_value', - 'secret' => 'shh1', - 'company' => 'Corporate Corporations Inc.', - 'email' => 'email.address@email.com' - ); - /** @var \Magento\Webhook\Model\User\Factory $userFactory */ - $userFactory = $this->_objectManager->create('Magento\Webhook\Model\User\Factory'); - /** @var \Magento\Webhook\Model\Webapi\User\Factory $webapiUserFactory */ - $webapiUserFactory = $this->_objectManager->create('Magento\Webhook\Model\Webapi\User\Factory'); - - $userId = $webapiUserFactory->createUser($userContext, array()); - $user = $userFactory->create(array('webapiUserId' => $userId)); - $subscription->setApiUserId($userId); - $this->assertEquals($user, $subscription->getUser()); - } - - public function testGetUserWhenNoneAssigned() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - - $this->assertNull($subscription->getUser()); - } - - public function testSetData() - { - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - - $subscription->setData('key', 'value'); - $this->assertEquals('value', $subscription->getData('key')); - - $keyArray = array( - \Magento\Webhook\Model\Subscription::FIELD_ENDPOINT_URL => self::VALUE_ENDPOINT_URL, - \Magento\Webhook\Model\Subscription::FIELD_FORMAT => self::VALUE_FORMAT, - \Magento\Webhook\Model\Subscription::FIELD_AUTHENTICATION_TYPE => self::VALUE_AUTHENTICATION_TYPE, - \Magento\Webhook\Model\Subscription::FIELD_API_USER_ID => self::VALUE_API_USER_ID, - ); - - $subscription->setData($keyArray); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $subscription->getEndpointUrl()); - $this->assertEquals(self::VALUE_FORMAT, $subscription->getFormat()); - $this->assertEquals(self::VALUE_AUTHENTICATION_TYPE, $subscription->getAuthenticationType()); - $this->assertEquals(self::VALUE_API_USER_ID, $subscription->getApiUserId()); - - - // Clear data to test different setting logic - $subscription->setData(array(null, null, null, null)); - - foreach ($keyArray as $key => $value) { - $subscription->setData($key, $value); - } - - $this->assertEquals(self::VALUE_ENDPOINT_URL, $subscription->getEndpointUrl()); - $this->assertEquals(self::VALUE_FORMAT, $subscription->getFormat()); - $this->assertEquals(self::VALUE_AUTHENTICATION_TYPE, $subscription->getAuthenticationType()); - $this->assertEquals(self::VALUE_API_USER_ID, $subscription->getApiUserId()); - - } - - public function testSetGetMethods() - { - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - - $subscription->setAlias(self::VALUE_ALIAS); - $subscription->setEndpointId(self::VALUE_ENDPOINT_ID); - $subscription->setName(self::VALUE_NAME); - $subscription->setRegistrationMechanism(self::VALUE_REG_MECH); - $subscription->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE); - $subscription->setUpdatedAt(self::VALUE_UPDATED_AT); - $subscription->setApiUserId(self::VALUE_API_USER_ID); - $subscription->setAuthenticationType(self::VALUE_AUTHENTICATION_TYPE); - $subscription->setEndpointUrl(self::VALUE_ENDPOINT_URL); - $subscription->setFormat(self::VALUE_FORMAT); - - $this->assertEquals(self::VALUE_ALIAS, $subscription->getAlias()); - $this->assertEquals(self::VALUE_ENDPOINT_ID, $subscription->getEndpointId()); - $this->assertEquals(self::VALUE_NAME, $subscription->getName()); - $this->assertEquals(self::VALUE_REG_MECH, $subscription->getRegistrationMechanism()); - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $subscription->getStatus()); - $this->assertEquals(self::VALUE_UPDATED_AT, $subscription->getUpdatedAt()); - $this->assertEquals(self::VALUE_API_USER_ID, $subscription->getApiUserId()); - $this->assertEquals(self::VALUE_AUTHENTICATION_TYPE, $subscription->getAuthenticationType()); - $this->assertEquals(self::VALUE_ENDPOINT_ID, $subscription->getEndpointId()); - $this->assertEquals(self::VALUE_FORMAT, $subscription->getFormat()); - - - } - - public function testSettingData() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setData(self::KEY_NAME, self::VALUE_NAME); - $subscription->setData(self::KEY_ALIAS, self::VALUE_ALIAS); - $subscription->setData(self::KEY_ENDPOINT_URL, self::VALUE_ENDPOINT_URL); - $subscription->setData(self::KEY_FORMAT, self::VALUE_FORMAT); - $subscription->setData(self::KEY_STATUS, self::VALUE_STATUS); - $subscription->setData(self::KEY_API_USER_ID, self::VALUE_API_USER_ID); - $subscription->setData(self::KEY_AUTHENTICATION_TYPE, self::VALUE_AUTHENTICATION_TYPE); - $subscription->setData(self::KEY_TIMEOUT_IN_SECS, self::VALUE_TIMEOUT_IN_SECS); - - - $subscription->save(); - - $loadedSubscription = $this->_getSubscription($subscription->getId()); - - $this->assertEquals(self::VALUE_NAME, $loadedSubscription->getName()); - $this->assertEquals(self::VALUE_ALIAS, $loadedSubscription->getAlias()); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $loadedSubscription->getEndpointUrl()); - $this->assertEquals(self::VALUE_FORMAT, $loadedSubscription->getFormat()); - $this->assertEquals(self::VALUE_STATUS, $loadedSubscription->getStatus()); - $this->assertEquals(self::VALUE_API_USER_ID, $loadedSubscription->getApiUserId()); - $this->assertEquals(self::VALUE_AUTHENTICATION_TYPE, $loadedSubscription->getAuthenticationType()); - $this->assertEquals(self::VALUE_TIMEOUT_IN_SECS, $loadedSubscription->getTimeoutInSecs()); - } - - public function testGettingData() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setName(self::VALUE_NAME); - $subscription->setAlias(self::VALUE_ALIAS); - $subscription->setEndpointUrl(self::VALUE_ENDPOINT_URL); - $subscription->setFormat(self::VALUE_FORMAT); - $subscription->setStatus(self::VALUE_STATUS); - $subscription->setApiUserId(self::VALUE_API_USER_ID); - $subscription->setAuthenticationType(self::VALUE_AUTHENTICATION_TYPE); - $subscription->setTimeoutInSecs(self::VALUE_TIMEOUT_IN_SECS); - - $subscription->save(); - - $loadedSubscription = $this->_getSubscription($subscription->getId()); - - $this->assertEquals(self::VALUE_NAME, $loadedSubscription->getData(self::KEY_NAME)); - $this->assertEquals(self::VALUE_ALIAS, $loadedSubscription->getData(self::KEY_ALIAS)); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $loadedSubscription->getData(self::KEY_ENDPOINT_URL)); - $this->assertEquals(self::VALUE_FORMAT, $loadedSubscription->getData(self::KEY_FORMAT)); - $this->assertEquals(self::VALUE_STATUS, $loadedSubscription->getData(self::KEY_STATUS)); - $this->assertEquals(self::VALUE_API_USER_ID, $loadedSubscription->getData(self::KEY_API_USER_ID)); - $this->assertEquals( - self::VALUE_AUTHENTICATION_TYPE, - $loadedSubscription->getData(self::KEY_AUTHENTICATION_TYPE) - ); - $this->assertEquals(self::VALUE_TIMEOUT_IN_SECS, $loadedSubscription->getData(self::KEY_TIMEOUT_IN_SECS)); - } - - public function testSetDataArray() - { - $data = array( - self::KEY_NAME => self::VALUE_NAME, - self::KEY_ALIAS => self::VALUE_ALIAS, - self::KEY_ENDPOINT_URL => self::VALUE_ENDPOINT_URL, - self::KEY_FORMAT => self::VALUE_FORMAT, - self::KEY_STATUS => self::VALUE_STATUS, - self::KEY_API_USER_ID => self::VALUE_API_USER_ID, - self::KEY_AUTHENTICATION_TYPE => self::VALUE_AUTHENTICATION_TYPE, - self::KEY_TIMEOUT_IN_SECS => self::VALUE_TIMEOUT_IN_SECS, - ); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($data); - - $subscription->save(); - - $loadedSubscription = $this->_getSubscription($subscription->getId()); - - $this->_assertSubSet($data, $loadedSubscription->getData()); - } - - public function testDeletingEndpoint() - { - $data = array( - self::KEY_NAME => self::VALUE_NAME, - self::KEY_ALIAS => self::VALUE_ALIAS, - self::KEY_ENDPOINT_URL => self::VALUE_ENDPOINT_URL, - self::KEY_FORMAT => self::VALUE_FORMAT, - self::KEY_STATUS => self::VALUE_STATUS, - self::KEY_API_USER_ID => self::VALUE_API_USER_ID, - self::KEY_AUTHENTICATION_TYPE => self::VALUE_AUTHENTICATION_TYPE, - self::KEY_TIMEOUT_IN_SECS => self::VALUE_TIMEOUT_IN_SECS, - ); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($data); - $subscription->save(); - - // Load from DB and verify the endpoint is being populated properly - $subscription = $this->_getSubscription($subscription->getId()); - $endpointId = $subscription->getEndpointId(); - $this->assertNotEquals(0, $endpointId); - $this->assertNotNull($subscription->getEndpointUrl()); - - // Our test, will this delete also trigger the endpoint to be deleted - $subscription->delete(); - - // Create a new subscription, and manually set a link to the old endpoint to see if it still exists. - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - $subscription->setEndpointId($endpointId); - - $this->assertNull($subscription->getEndpointUrl()); - } - - /** - * Load a subscription from the DB - * - * @param $subscriptionId string - * @return \Magento\Webhook\Model\Subscription - */ - protected function _getSubscription($subscriptionId) - { - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription'); - return $subscription->load($subscriptionId); - } - - /** - * Asserts that an array is a subset of another array - * - * @param $subSet - * @param $superSet - */ - protected function _assertSubSet($subSet, $superSet) - { - foreach ($subSet as $key => $value) { - $this->assertArrayHasKey($key, $superSet); - $this->assertEquals($value, $superSet[$key]); - } - } - -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/UserTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/UserTest.php deleted file mode 100644 index 83a5d4aa1e488796b9f9e274b34b508914ff3cca..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/UserTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -/** - * \Magento\Webhook\Model\User - * - * @magentoDbIsolation enabled - */ -class UserTest extends \PHPUnit_Framework_TestCase -{ - public function testGetSharedSecret() - { - $webapiUserId = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User') - ->setSecret('secret') - ->save() - ->getId(); - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\User', array('webapiUserId' => $webapiUserId)); - $this->assertEquals('secret', $user->getSharedSecret()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php deleted file mode 100644 index 03946f727333362105e548fa23509d84cf58c28e..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\EventHandler; - -/** - * \Magento\Webhook\Model\Webapi\EventHandler\Factory - * - * @magentoDbIsolation enabled - */ -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function testCreate() - { - $factory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Webapi\EventHandler\Factory'); - $eventHandler = $factory->create(); - $this->assertInstanceOf('Magento\Webhook\Model\Webapi\EventHandler', $eventHandler); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php deleted file mode 100644 index 4b5aede932ecddece0425d915401d68154717e84..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php +++ /dev/null @@ -1,92 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\User; - -/** - * \Magento\Webhook\Model\Webapi\User\Factory - * - * @magentoDbIsolation enabled - */ -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** Values being sent to user service */ - const VALUE_COMPANY_NAME = 'company name'; - const VALUE_SECRET_VALUE = 'secret_value'; - const VALUE_KEY_VALUE = 'key_value'; - const VALUE_EMAIL = 'email@example.com'; - - /** @var array */ - private $_userContext; - - /** @var int */ - private $_apiUserId; - - protected function setUp() - { - $this->_userContext = array( - 'email' => self::VALUE_EMAIL, - 'key' => self::VALUE_KEY_VALUE, - 'secret' => self::VALUE_SECRET_VALUE, - 'company' => self::VALUE_COMPANY_NAME - ); - } - - protected function tearDown() - { - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User'); - $user->load($this->_apiUserId); - $user->delete(); - } - - public function testCreate() - { - /** @var \Magento\Webhook\Model\Webapi\User\Factory $userFactory */ - $userFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Webapi\User\Factory'); - $this->_apiUserId = $userFactory->createUser($this->_userContext, array('webhook/create')); - - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User'); - $user->load($this->_apiUserId); - - $this->assertEquals(self::VALUE_COMPANY_NAME, $user->getCompanyName()); - $this->assertEquals(self::VALUE_EMAIL, $user->getContactEmail()); - $this->assertEquals(self::VALUE_SECRET_VALUE, $user->getSecret()); - $this->assertEquals(self::VALUE_KEY_VALUE, $user->getApiKey()); - $this->assertNotEquals(0, $user->getRoleId()); - - /** @var \Magento\Webapi\Model\Resource\Acl\Rule $ruleResources */ - $ruleResources = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Resource\Acl\Rule'); - $rules = $ruleResources->getResourceIdsByRole($user->getRoleId()); - $this->assertNotEmpty($rules); - } - -} diff --git a/dev/tests/integration/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php b/dev/tests/integration/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php deleted file mode 100644 index a08a56ac6c1a997ccaf604530e96eb46a2c044ed..0000000000000000000000000000000000000000 --- a/dev/tests/integration/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php +++ /dev/null @@ -1,289 +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_Webhook - * @subpackage integration_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Service; - -/** - * \Magento\Webhook\Service\SubscriptionV1 - * - * @magentoDbIsolation enabled - */ -class SubscriptionV1Test extends \PHPUnit_Framework_TestCase -{ - /** Constants for validation of field data */ - const VALUE_NAME = 'Name of the Subscriber'; - const VALUE_ALIAS = 'test alias'; - const VALUE_ENDPOINT_URL = 'http://localhost/reach_us_here'; - - const KEY_ENDPOINT_URL = \Magento\Webhook\Model\SubscriptionTest::KEY_ENDPOINT_URL; - const KEY_NAME = \Magento\Webhook\Model\SubscriptionTest::KEY_NAME; - const KEY_ALIAS = \Magento\Webhook\Model\SubscriptionTest::KEY_ALIAS; - const KEY_API_USER_ID = \Magento\Webhook\Model\SubscriptionTest::KEY_API_USER_ID; - const KEY_TOPICS = 'topics'; - const KEY_STATUS = \Magento\Webhook\Model\SubscriptionTest::KEY_STATUS; - - /** @var array */ - private $_subscriptionData; - - /** @var int */ - private $_apiUserId; - - protected function setUp() - { - $userContext = array( - 'email' => 'email@example.com', - 'key' => 'key', - 'secret' => 'secret', - ); - /** @var \Magento\Webhook\Model\Webapi\User\Factory $webapiUserFactory */ - $webapiUserFactory = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Webapi\User\Factory'); - $this->_apiUserId = $webapiUserFactory->createUser($userContext, array('webhook/create')); - - $this->_subscriptionData = array( - self::KEY_ALIAS => self::VALUE_ALIAS, - self::KEY_NAME => self::VALUE_NAME, - self::KEY_ENDPOINT_URL => self::VALUE_ENDPOINT_URL, - self::KEY_API_USER_ID => $this->_apiUserId, - // TODO: Right now if we check for topic permissions it will fail. Not sure why. - //self::KEY_TOPICS => array('webhook/create'), - ); - } - - protected function tearDown() - { - /** @var \Magento\Webapi\Model\Acl\User $user */ - $user = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webapi\Model\Acl\User'); - $user->load($this->_apiUserId); - $user->delete(); - } - - public function testCreate() - { - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->create($this->_subscriptionData); - - // verify - $this->assertTrue($resultData['subscription_id'] > 0); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $resultData[self::KEY_ENDPOINT_URL]); - } - - /** - * No user exists yet, so we don't expect invalid topics to be identified at this point. - */ - public function testCreateInvalidTopicsNoUser() - { - $this->_subscriptionData[self::KEY_TOPICS] = array('invalid/topic', 'also/invalid/topic'); - unset($this->_subscriptionData[self::KEY_API_USER_ID]); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->create($this->_subscriptionData); - - $this->assertTrue($resultData['subscription_id'] > 0); - } - - /** - * @expectedException \Magento\Webhook\Exception - * @expectedExceptionMessage not authorized - */ - public function testCreateInvalidTopicsWithUser() - { - $this->_subscriptionData[self::KEY_TOPICS] = array('invalid/topic', 'also/invalid/topic'); - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->create($this->_subscriptionData); - - $this->assertTrue($resultData['subscription_id'] > 0); - } - - public function testGet() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->save(); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->get($subscription->getId()); - - $this->assertEquals($subscription->getId(), $resultData['subscription_id']); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $resultData[self::KEY_ENDPOINT_URL]); - } - - /** - * @expectedException \Magento\Webhook\Exception - * @expectedExceptionMessage 0 - */ - public function testGetNotFound() - { - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $service->get(0); - } - - public function testGetAll() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $first = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $first->setData($this->_subscriptionData); - $first->save(); - - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $second = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $second->setData($this->_subscriptionData); - $second->save(); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $subscriptions = $service->getAll($this->_apiUserId); - - $this->assertEquals($first->getId(), $subscriptions[0]['subscription_id']); - $this->assertEquals($second->getId(), $subscriptions[1]['subscription_id']); - } - - public function testUpdate() - { - $newUrl = self::VALUE_ENDPOINT_URL . '/plus/this'; - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->save(); - $subscriptionData = $subscription->getData(); - $subscriptionData[self::KEY_ENDPOINT_URL] = $newUrl; - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->update($subscriptionData); - - $this->assertEquals($subscription->getId(), $resultData['subscription_id']); - $this->assertEquals($newUrl, $resultData[self::KEY_ENDPOINT_URL]); - $this->assertEquals(self::VALUE_NAME, $resultData[self::KEY_NAME]); - } - - public function testDelete() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->save(); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $resultData = $service->delete($subscription->getId()); - - $this->assertEquals($subscription->getId(), $resultData['subscription_id']); - $this->assertEquals(self::VALUE_ENDPOINT_URL, $resultData[self::KEY_ENDPOINT_URL]); - $this->assertEquals(self::VALUE_NAME, $resultData[self::KEY_NAME]); - - - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->load($resultData['subscription_id']); - $this->assertEquals(0, $subscription->getId()); - } - - public function testActivate() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->save(); - // verify initial state - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE, $subscription->getStatus()); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $subscriptionData = $service->activate($subscription->getId()); - - // verify change - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE, $subscriptionData[self::KEY_STATUS]); - $subscription->load($subscription->getId()); - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE, $subscription->getStatus()); - } - - public function testDeactivate() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE); - $subscription->save(); - // verify initial state - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE, $subscription->getStatus()); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $subscriptionData = $service->deactivate($subscription->getId()); - - // verify change - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE, $subscriptionData[self::KEY_STATUS]); - $subscription->load($subscription->getId()); - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE, $subscription->getStatus()); - } - - public function testRevoke() - { - /** @var \Magento\Webhook\Model\Subscription $subscription */ - $subscription = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Model\Subscription'); - $subscription->setData($this->_subscriptionData); - $subscription->setStatus(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE); - $subscription->save(); - // verify initial state - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE, $subscription->getStatus()); - - /** @var \Magento\Webhook\Service\SubscriptionV1 $service */ - $service = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->create('Magento\Webhook\Service\SubscriptionV1'); - $subscriptionData = $service->revoke($subscription->getId()); - - // verify change - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_REVOKED, $subscriptionData[self::KEY_STATUS]); - $subscription->load($subscription->getId()); - $this->assertEquals(\Magento\Webhook\Model\Subscription::STATUS_REVOKED, $subscription->getStatus()); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php index baaf1d96a7d40b119701435aebd2f9f649a1a260..8c55f5796805b2459b9d6a2a08845bcfb67fe72b 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/DesignAbstractionTest.php @@ -47,32 +47,42 @@ class DesignAbstractionTest extends \PHPUnit_Framework_TestCase $layoutUtility = new \Magento\Core\Utility\Layout($this); $appState = $objectManager->get('Magento\App\State'); $appState->setAreaCode(\Magento\Backend\App\Area\FrontNameResolver::AREA_CODE); - $args = array( - 'context' => $objectManager->get('Magento\View\Element\Template\Context'), - 'layoutProcessorFactory' => $this->getMock('Magento\View\Layout\ProcessorFactory', - array(), array(), '', false), - 'themesFactory' => $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), - 'appState' => $appState, - 'data' => array( + $processorMock = $this->getMock( + 'Magento\View\Layout\Processor', array('isPageLayoutDesignAbstraction'), array(), '', false + ); + $processorMock->expects($this->exactly(2)) + ->method('isPageLayoutDesignAbstraction') + ->will($this->returnCallback( + function ($abstraction) { + return $abstraction['design_abstraction'] === 'page_layout'; + } + )); + $processorFactoryMock = $this->getMock( + 'Magento\View\Layout\ProcessorFactory', array('create'), array(), '', false + ); + $processorFactoryMock->expects($this->exactly(2)) + ->method('create') + ->will($this->returnCallback( + function ($data) use ($processorMock, $layoutUtility) { + return ($data === array()) + ? $processorMock + : $layoutUtility->getLayoutUpdateFromFixture(glob(__DIR__ . '/_files/layout/*.xml')); + + } + )); + + $this->_block = new DesignAbstraction( + $objectManager->get('Magento\View\Element\Template\Context'), + $processorFactoryMock, + $objectManager->get('Magento\Core\Model\Resource\Theme\CollectionFactory'), + $appState, + array( 'name' => 'design_abstractions', 'id' => 'design_abstraction_select', 'class' => 'design-abstraction-select', 'title' => 'Design Abstraction Select', ) ); - $this->_block = $this->getMock( - 'Magento\Widget\Block\Adminhtml\Widget\Instance\Edit\Chooser\DesignAbstraction', - array('_getLayoutProcessor'), $args - ); - $this->_block - ->expects($this->any()) - ->method('_getLayoutProcessor') - ->will($this->returnCallback( - function () use ($layoutUtility) { - return $layoutUtility->getLayoutUpdateFromFixture(glob(__DIR__ . '/_files/layout/*.xml')); - } - )) - ; } public function testToHtml() diff --git a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php index 42a5f0e734e0e60b38599d692b531a1293b9902d..e958a951b9842cde5fcb01c39cb324d041ddda57 100644 --- a/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php +++ b/dev/tests/integration/testsuite/Magento/Widget/Block/Adminhtml/Widget/Instance/Edit/Chooser/LayoutTest.php @@ -43,7 +43,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase parent::setUp(); $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $config = $this->getMockBuilder('Magento\Core\Model\Layout\PageType\Config') + $config = $this->getMockBuilder('Magento\View\Layout\PageType\Config') ->setMethods(array('getPageTypes')) ->disableOriginalConstructor() ->getMock(); diff --git a/dev/tests/js/testsuite/mage/suggest/suggest-test.js b/dev/tests/js/testsuite/mage/suggest/suggest-test.js index ca02e66b341e4accbe1320ae2c1ca4dfef6e023b..b7bf1661af5c5195289ba1dff5eede6b9f26d0b9 100644 --- a/dev/tests/js/testsuite/mage/suggest/suggest-test.js +++ b/dev/tests/js/testsuite/mage/suggest/suggest-test.js @@ -458,6 +458,27 @@ SuggestTest.prototype.testSelectItemMultiselect = function() { assertFalse(selectedElement.hasClass(suggestInstance.options.selectedClass)); assertTrue(suggestInstance.dropdown.is(':hidden')); }; +SuggestTest.prototype.testResetSuggestValue = function() { + var suggestInstance = this.suggestCreate(); + suggestInstance.valueField.val('test'); + suggestInstance._resetSuggestValue(); + assertEquals(suggestInstance.valueField.val(), suggestInstance._nonSelectedItem.id); +}; +SuggestTest.prototype.testResetSuggestValueMultiselect = function() { + var suggestInstance = this.suggestCreate({multiselect: true}); + suggestInstance._focused = this.uiHash.item; + var selectedElement = jQuery('<div></div>'); + var event = $.Event('select'); + event.target = selectedElement[0]; + + suggestInstance._selectItem(event); + suggestInstance._resetSuggestValue(); + + var suggestValue = suggestInstance.valueField.val(); + assertArray(suggestValue); + assertNotUndefined(suggestValue[0]); + assertEquals(suggestValue[0], this.uiHash.item.id); +}; SuggestTest.prototype.testReadItemData = function() { var testElement = jQuery('<div></div>'), suggestInstance = this.suggestCreate(); diff --git a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php b/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php index b0d88ec53c54e3a00696c201f01c403a7b06569f..2949dce13e287e4888946603f5d698753434b6ef 100644 --- a/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php +++ b/dev/tests/static/framework/Magento/TestFramework/Dependency/_files/tables_ce.php @@ -27,10 +27,6 @@ return array ( 'admin_rule' => 'Magento_Adminhtml', 'admin_user' => 'Magento_Adminhtml', 'adminnotification_inbox' => 'Magento_AdminNotification', - 'webapi_acl_attribute' => 'Magento_Webapi', - 'webapi_acl_role' => 'Magento_Webapi', - 'webapi_acl_rule' => 'Magento_Webapi', - 'webapi_acl_user' => 'Magento_Webapi', 'catalog_category_entity_datetime' => 'Magento_Catalog', 'catalog_category_entity_decimal' => 'Magento_Catalog', 'catalog_category_entity_int' => 'Magento_Catalog', @@ -360,8 +356,5 @@ return array ( 'core_theme' => 'Magento_Core', 'core_theme_files' => 'Magento_Core', 'core_theme_files_link' => 'Magento_Core', - 'vde_theme_change' => 'Magento_DesignEditor', - 'webapi_role' => 'Magento_Webapi', - 'webapi_user' => 'Magento_Webapi', - 'webapi_rule' => 'Magento_Webapi', + 'vde_theme_change' => 'Magento_DesignEditor' ); diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php index 392d57df4ddb03c3e69faee0d6cc59ce69d429f9..307c0cb0702768b4f095860720b1ee023de35998 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/Di/CompilerTest.php @@ -87,6 +87,7 @@ class CompilerTest extends \PHPUnit_Framework_TestCase $this->_validator = new \Magento\Code\Validator(); $this->_validator->add(new \Magento\Code\Validator\ConstructorIntegrity()); $this->_validator->add(new \Magento\Code\Validator\ContextAggregation()); + $this->_validator->add(new \Magento\Code\Validator\TypeDuplication()); $this->_validator->add(new \Magento\Code\Validator\ArgumentSequence()); } @@ -177,9 +178,10 @@ class CompilerTest extends \PHPUnit_Framework_TestCase /** Build class inheritance hierarchy */ $output = array(); + $allowedFiles = array_keys($classes); foreach ($classes as $class) { if (!in_array($class, $output)) { - $output = array_merge($output, $this->_buildInheritanceHierarchyTree($class)); + $output = array_merge($output, $this->_buildInheritanceHierarchyTree($class, $allowedFiles)); $output = array_unique($output); } } @@ -196,9 +198,10 @@ class CompilerTest extends \PHPUnit_Framework_TestCase * Build inheritance hierarchy tree * * @param string $className + * @param array $allowedFiles * @return array */ - protected function _buildInheritanceHierarchyTree($className) + protected function _buildInheritanceHierarchyTree($className, array $allowedFiles) { $output = array(); if (0 !== strpos($className, '\\')) { @@ -206,9 +209,10 @@ class CompilerTest extends \PHPUnit_Framework_TestCase } $class = new \ReflectionClass($className); $parent = $class->getParentClass(); - if ($parent) { + /** Prevent analysis of non Magento classes */ + if ($parent && in_array($parent->getFileName(), $allowedFiles)) { $output = array_merge( - $this->_buildInheritanceHierarchyTree($parent->getName()), + $this->_buildInheritanceHierarchyTree($parent->getName(), $allowedFiles), array($className), $output ); 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 e221386708f5849b1d52ac570a9370273847ef7e..1acd5420c06fc7d4310ffaa9ef238367cbdf288d 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 @@ -61,4 +61,5 @@ lib/Magento/Oauth/Exception.php lib/Magento/App/Helper/AbstractHelper.php lib/Magento/App/Helper/Context.php +lib/Magento/View/DesignLoader.php lib/Magento/Session/SidResolverInterface.php diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt index d4b10828388a66a92f88877ba3fb7f84de9ef477..77e48029dc0bfb3fc2061c89eca6d6e2f5d8da87 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/_files/blacklist/namespace.txt @@ -57,4 +57,5 @@ dev/tests/static/testsuite/Magento/Test/Php/Exemplar/CodeStyleTest/phpcs/input/n dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForConstructorIntegrity.php dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForContextAggregation.php dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php -dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForArgumentSequence.php \ No newline at end of file +dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForArgumentSequence.php +dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForTypeDuplication.php \ No newline at end of file diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php index 6ae4091c9574aaf5ebdd13ba4c4d6d83e71faec4..d3fc82cb56829497a30b59c55d9a9014f50055e3 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/LayoutTest.php @@ -296,6 +296,7 @@ class LayoutTest extends \PHPUnit_Framework_TestCase 'setInList', 'setInfoTemplate', 'setIsCollapsed', + 'setIsDisabled', 'setIsEnabled', 'setIsGuestNote', 'setIsHandle', 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 39c96db586410206af353ba951da77c78293ad98..993024bac9b1aaa7997f30e6ceb5759269596871 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 @@ -1741,4 +1741,18 @@ return array( array('Magento\Page\Block\Link\Current', 'Magento\View\Element\Html\Link\Current'), array('Magento\Page\Block\Links', 'Magento\View\Element\Html\Links'), array('Magento\Page\Block\Link', 'Magento\View\Element\Html\Link'), + array('Magento\Core\Model\Layout\Argument\HandlerInterface', 'Magento\View\Layout\Argument\HandlerInterface'), + array('Magento\Core\Model\Layout\Argument\HandlerFactory', 'Magento\View\Layout\Argument\HandlerFactory'), + array('Magento\Core\Model\Theme\Label', 'Magento\View\Design\Theme\Label'), + array('Magento\Core\Model\Theme\LabelFactory', 'Magento\View\Design\Theme\LabelFactory'), + array('Magento\Core\Model\DesignLoader', 'Magento\View\DesignLoader'), + array('Magento\Page\Block\Switcher', 'Magento\Core\Block\Switcher'), + array('Magento\Core\Model\Layout\PageType\Config', 'Magento\View\Layout\PageType\Config'), + array('Magento\Core\Model\Layout\PageType\Config\Converter', 'Magento\View\Layout\PageType\Config\Converter'), + array('Magento\Core\Model\Layout\PageType\Config\Reader', 'Magento\View\Layout\PageType\Config\Reader'), + array( + 'Magento\Core\Model\Layout\PageType\Config\SchemaLocator', + 'Magento\View\Layout\PageType\Config\SchemaLocator' + ), + array('Magento\Core\Model\Theme\CopyService', 'Magento\Theme\Model\CopyService'), ); diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php index 3cc13f9522f697d3d4e35466665fdb03bbd45d90..6ccaee11ed0dc574f1e148b3f331898cef3deca6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_config_nodes.php @@ -29,8 +29,6 @@ return array( '/config/global/fieldsets' => '', '/config/global/cache/betatypes' => '', '/config/admin/fieldsets' => '', - '/config/global/webhook' => - 'This configuration moved to Di configuration of \Magento\Webhook module models', '/config/general/locale' => 'This configuration moved to Di configuration of \Magento\Core\Model\Locale\Config model', '/config/global/can_use_base_url' => 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 d1099749d03526c305850e3f55d1164efdb9c555..718bf93d7207d2529962202c70b0b14025067e97 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 @@ -392,8 +392,6 @@ return array( '\Magento\Image\Adapter\AdapterInterface::ADAPTER_GD2' ), array('XML_PATH_IMAGE_TYPES', 'Magento\Adminhtml\Block\Catalog\Product\Frontend\Product\Watermark'), - array('XML_PATH_WEBHOOK', 'Magento\Webhook\Model\Source\Hook'), - array('XML_PATH_SUBSCRIPTIONS', 'Magento\Webhook\Model\Subscription\Config'), array('PAYMENT_INFO_TRANSPORT_SHIPPING_OVERRIDEN', 'Magento\Paypal\Model\Express\Checkout'), array( 'XML_PATH_USE_FRONTEND_SID', @@ -446,10 +444,26 @@ return array( 'Magento\Theme\Helper\Robots', 'Magento\Adminhtml\Block\Page\System\Config\Robots::XML_PATH_ROBOTS_DEFAULT_CUSTOM_INSTRUCTIONS', ), - array('XML_PATH_MERGE_CSS_FILES', 'Magento\View\Asset\MergeService'), - array('XML_PATH_MERGE_JS_FILES', 'Magento\View\Asset\MergeService'), - array('XML_PATH_MINIFICATION_ENABLED', 'Magento\View\Asset\MinifyService'), - array('XML_PATH_MINIFICATION_ADAPTER', 'Magento\View\Asset\MinifyService'), + array( + 'XML_PATH_MERGE_CSS_FILES', + 'Magento\View\Asset\MergeService', + 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_CSS_FILES' + ), + array( + 'XML_PATH_MERGE_JS_FILES', + 'Magento\View\Asset\MergeService', + 'Magento\Core\Model\Asset\Config::XML_PATH_MERGE_JS_FILES' + ), + array( + 'XML_PATH_MINIFICATION_ENABLED', + 'Magento\View\Asset\MinifyService', + 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ENABLED' + ), + array( + 'XML_PATH_MINIFICATION_ADAPTER', + 'Magento\View\Asset\MinifyService', + 'Magento\Core\Model\Asset\Config::XML_PATH_MINIFICATION_ADAPTER' + ), array('TYPE_BLOCK', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), array('TYPE_CONTAINER', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), array('TYPE_ACTION', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), @@ -463,4 +477,9 @@ return array( array('CONTAINER_OPT_HTML_CLASS', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), array('CONTAINER_OPT_HTML_ID', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), array('CONTAINER_OPT_LABEL', '\Magento\Core\Model\Layout', '\Magento\View\Layout\Element'), + array( + 'XML_PATH_THEME_ID', + '\Magento\Core\Model\View\Design', + '\Magento\View\DesignInterface::XML_PATH_THEME_ID', + ), ); 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 fa34f242ce40fc0295c8e6d3973387a1cba3cf69..7d3380c3fb68d30a4883c942c5f6e85773a83aab 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 @@ -1077,10 +1077,12 @@ return array( array('_isEnabled', 'Magento\View\Asset\MinifyService', 'isEnabled'), array('_getAdapter', 'Magento\View\Asset\MinifyService', 'getAdapter'), array('getShowPerPage', 'Magento\Theme\Block\Html\Pager', 'isShowPerPage'), + array('getPackageByUserAgent', '\Magento\Core\Model\View\Design'), array('setFrameTags', 'Magento\View\Element\AbstractBlock'), array('getMessagesBlock', 'Magento\View\Element\AbstractBlock'), array('setMessagesBlock', 'Magento\View\Element\AbstractBlock'), array('getUrlEncoded', 'Magento\View\Element\AbstractBlock'), array('getUrlBase64', 'Magento\View\Element\AbstractBlock'), array('getMessagesBlock', 'Magento\MultipleWishlist\Block\Info'), + array('addStoresToCollection', '\Magento\Rating\Model\Resource\Rating\Collection') ); 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 cf159184bd879cac1cb09b449cccea98b42c02c0..b36ee6c2cb77bdf529ececd71820c6e7fb97b501 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 @@ -14,7 +14,6 @@ app/code/Magento/Integration/view app/code/Magento/Theme/view app/code/Magento/User/view app/code/Magento/Webapi/view -app/code/Magento/Webhook/view dev/tests/integration/framework/Magento/TestFramework/Db/Mysql.php dev/tests/integration/framework/Magento/TestFramework/Db/Adapter/Mysql.php dev/tests/integration/framework/Magento/TestFramework/Db/ConnectionAdapter.php diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt index 1aa0a61d96ff31394a3cc6b53b2af60c05fb65c8..5899263d209e289f21072c38050208580c3798ce 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpcpd/blacklist/common.txt @@ -87,7 +87,6 @@ Magento/Tax/Model/Config/Price Magento/Usa/Model/Shipping/Carrier Magento/Webapi/Block/Adminhtml Magento/Webapi/Model -Magento/Webhook/Model Magento/Widget/Model/Widget/Instance Magento/Wishlist/Block Magento/Wishlist/Model diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt index 2cade8fb437c6414e03f7ed4dc806dc02cdf0e33..9af9066bb009df8eb58b02f0dd53d675bb35b9a9 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/whitelist/common.txt @@ -119,7 +119,6 @@ app/code/Magento/Sales/Model/Observer app/code/Magento/SalesRule/Model/Plugin app/code/Magento/Theme app/code/Magento/Webapi -app/code/Magento/Webhook app/code/Magento/Wishlist/Block/Link.php dev/shell dev/tests/integration diff --git a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php index 6285a8f0176b1be4094d4a000257b37cff4ca73e..9fec4ce355e7b56523e141f52b4b6532e3ecf75a 100644 --- a/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php +++ b/dev/tests/unit/framework/Magento/Test/Block/Adminhtml.php @@ -157,16 +157,16 @@ class Adminhtml extends \PHPUnit_Framework_TestCase $viewUrlMock, $viewConfigMock, $cacheStateMock, - $this->_dirMock, $this->_loggerMock, - $this->_filesystemMock, - $viewFileSystemMock, - $templatePoolMock, $appMock, - $appState, $escaperMock, $filterManagerMock, $this->_localeMock, + $this->_dirMock, + $this->_filesystemMock, + $viewFileSystemMock, + $templatePoolMock, + $appState, $this->_storeManagerMock, $authorizationMock, $backendSessionMock, diff --git a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php index b5dae34873c3b76b17149e160958fae0e56ca390..416cb8574e5513183c0a2f61476799eed88f2738 100644 --- a/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/App/Resource/Config/ReaderTest.php @@ -82,8 +82,7 @@ class ReaderTest extends \PHPUnit_Framework_TestCase $this->_converterMock, $this->_schemaLocatorMock, $this->_validationStateMock, - $this->_configLocalMock, - 'cacheId' + $this->_configLocalMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php new file mode 100644 index 0000000000000000000000000000000000000000..043a2c16eb850950e7c593d09e30d457848dc09c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Authz/Service/AuthorizationV1Test.php @@ -0,0 +1,93 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Authz\Service; + +use Magento\Authz\Model\UserIdentifier; +use Magento\User\Model\Role; + +class AuthorizationV1Test extends \PHPUnit_Framework_TestCase +{ + /** @var AuthorizationV1 */ + protected $_authzService; + + protected function setUp() + { + /** @var \PHPUnit_Framework_MockObject_MockObject|Role $roleMock */ + $roleMock = $this->getMock('Magento\User\Model\Role', ['load', 'delete', '__wakeup'], [], '', false); + $roleMock->expects($this->any())->method('load')->will($this->returnSelf()); + $roleMock->expects($this->any())->method('delete')->will($this->returnSelf()); + + /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\User\Model\RoleFactory $roleFactoryMock */ + $roleFactoryMock = $this->getMock('Magento\User\Model\RoleFactory', ['create'], [], '', false); + $roleFactoryMock->expects($this->any())->method('create')->will($this->returnValue($roleMock)); + + $this->_authzService = new AuthorizationV1( + $this->getMock('Magento\Acl\Builder', [], [], '', false), + $this->getMock('Magento\Authz\Model\UserIdentifier', [], [], '', false), + $roleFactoryMock, + $this->getMock('Magento\User\Model\Resource\Role\CollectionFactory', [], [], '', false), + $this->getMock('Magento\User\Model\RulesFactory', [], [], '', false), + $this->getMock('Magento\User\Model\Resource\Rules\CollectionFactory', [], [], '', false), + $this->getMock('Magento\Logger', [], [], '', false), + $this->getMock('Magento\Core\Model\Acl\RootResource', [], [], '', false) + ); + } + + public function testRemovePermissions() + { + $this->_authzService->removePermissions( + $this->_getUserIdentifierMock(UserIdentifier::USER_TYPE_INTEGRATION) + ); + } + + /** + * @expectedException \Magento\Service\Exception + */ + public function testRemovePermissionsException() + { + $this->_authzService->removePermissions( + $this->_getUserIdentifierMock(UserIdentifier::USER_TYPE_ADMIN) // Wrong user identifier type + ); + } + + /** + * @param string $getUserTypeValue + * @return UserIdentifier|\PHPUnit_Framework_MockObject_MockObject + */ + protected function _getUserIdentifierMock($getUserTypeValue) + { + /** @var UserIdentifier|\PHPUnit_Framework_MockObject_MockObject $userIdentiferMock */ + $userIdentiferMock = $this->getMock( + 'Magento\Authz\Model\UserIdentifier', ['getUserType', 'getUserId'], [], '', false + ); + + $userIdentiferMock + ->expects($this->any()) + ->method('getUserType') + ->will($this->returnValue($getUserTypeValue)); + + return $userIdentiferMock; + } +} diff --git a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ImportTest.php b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ImportTest.php index 30ea52e298ebef9d1d61211465a1c10dc67d83b2..d60be45be804cd12aea5b657107bf6b6994029f8 100644 --- a/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ImportTest.php +++ b/dev/tests/unit/testsuite/Magento/Backend/Block/System/Config/Form/Field/ImportTest.php @@ -55,7 +55,7 @@ class ImportTest extends \PHPUnit_Framework_TestCase $testData = array ('name' => 'test_name', 'html_id' => 'test_html_id'); $testHelper = new \Magento\TestFramework\Helper\ObjectManager($this); $this->_object = $testHelper->getObject('Magento\Backend\Block\System\Config\Form\Field\Import', array( - 'attributes' => $testData + 'data' => $testData )); $this->_object->setForm($this->_formMock); } diff --git a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php index 5b5af7168142a0e77c693d2d2cb9879714f5f51f..fa4010f20bba9b7a68957e1734a7f930acda0ba9 100644 --- a/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php +++ b/dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractTest.php @@ -60,9 +60,9 @@ class AbstractTest extends \PHPUnit_Framework_TestCase 'logger' => $loggerMock, 'currencyFactory' => $currencyFactoryMock, 'storeManager' => $storeManagerMock, - 'catalogProductType' => $productTypeMock, 'catalogData' => $this->_helper, 'config' => $configMock, + 'catalogProductType' => $productTypeMock, ) ); $resource = $this->getMock('StdClass', array('getMainTable')); diff --git a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php index 96db86e4a28f2bdeee8802af37e81fab7955f154..3ba87394aa555f06e3655fda61395d9c7ea35562 100644 --- a/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php +++ b/dev/tests/unit/testsuite/Magento/CatalogInventory/Block/Adminhtml/Form/Field/StockTest.php @@ -76,7 +76,7 @@ class StockTest extends \PHPUnit_Framework_TestCase 'factoryElement' => $this->_factoryElementMock, 'factoryCollection' => $this->_collectionFactoryMock, 'factoryText' => $this->_factoryTextMock, - 'attributes' => array( + 'data' => array( 'qty' => $this->_qtyMock, 'name' => self::ATTRIBUTE_NAME, ), diff --git a/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php new file mode 100644 index 0000000000000000000000000000000000000000..89eaca910803b9889e573664c25a8b3869814058 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Checkout/Block/Onepage/SuccessTest.php @@ -0,0 +1,82 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Checkout\Block\Onepage; + +class SuccessTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\TestFramework\Helper\ObjectManager + */ + protected $objectManager; + + protected function setUp() + { + $this->objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); + } + + /** + * @covers Magento\Checkout\Block\Onepage\Success::_prepareLastRecurringProfiles + */ + public function testToHtmlPreparesRecurringProfiles() + { + $checkoutSession = $this->getMock( + 'Magento\Checkout\Model\Session', + ['getLastRecurringProfileIds'], + [], + '', + false + ); + $checkoutSession->expects($this->once()) + ->method('getLastRecurringProfileIds') + ->will($this->returnValue([1, 2, 3])); + $collection = $this->getMock( + 'Magento\Sales\Model\Resource\Recurring\Profile\Collection', + ['addFieldToFilter'], + [], + '', + false + ); + $collection->expects($this->once())->method('addFieldToFilter') + ->with('profile_id', ['in' => [1, 2, 3]])->will($this->returnValue([])); + $recurringProfileCollectionFactory = $this->getMock( + 'Magento\Sales\Model\Resource\Recurring\Profile\CollectionFactory', + ['create'], + [], + '', + false + ); + $recurringProfileCollectionFactory->expects($this->once()) + ->method('create')->will($this->returnValue($collection)); + + /** @var \Magento\Checkout\Block\Onepage\Success $block */ + $block = $this->objectManager->getObject( + 'Magento\Checkout\Block\Onepage\Success', + array( + 'checkoutSession' => $checkoutSession, + 'recurringProfileCollectionFactory' => $recurringProfileCollectionFactory, + ) + ); + $this->assertEquals('', $block->toHtml()); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Code/Reader/ArgumentsReaderTest.php b/dev/tests/unit/testsuite/Magento/Code/Reader/ArgumentsReaderTest.php index dff309a0fd0f8fdfa1cdea72b1c5566eebba8d4b..5a53d84b43ae8b1ae5038355019300a96ca910f1 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Reader/ArgumentsReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Reader/ArgumentsReaderTest.php @@ -313,4 +313,13 @@ class ArgumentsReaderTest extends \PHPUnit_Framework_TestCase ); } + public function testGetAnnotations() + { + $class = new \ReflectionClass('\ClassWithSuppressWarnings'); + $expected = array( + 'SuppressWarnings' => 'Magento.TypeDuplication', + ); + $this->assertEquals($expected, $this->_model->getAnnotations($class)); + } } + diff --git a/dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php b/dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php index 202417430965f61c485879e8493ce55eb3577c62..a458c72f5de89a3285b6deda44008a9647dad548 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php +++ b/dev/tests/unit/testsuite/Magento/Code/Reader/_files/ClassesForArgumentsReader.php @@ -205,4 +205,32 @@ class ArgumentsOnSeparateLines extends firstClassForParentCall $this->_stdClassObject = $stdClassObject; $this->_secondClass = $secondClass; } -} \ No newline at end of file +} + +class ClassWithSuppressWarnings +{ + /** + * @var stdClass + */ + protected $argumentOne; + + /** + * @var ClassExtendsDefaultPhpType + */ + protected $argumentTwo; + + /** + * @param stdClass $stdClassObject + * @param ClassExtendsDefaultPhpType $secondClass + * + * @SuppressWarnings(Magento.TypeDuplication) + */ + public function __construct( + \stdClass $stdClassObject, + \ClassExtendsDefaultPhpType $secondClass + ) { + $this->argumentOne = $stdClassObject; + $this->argumentTwo = $secondClass; + } +} + diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php index 2d92c87e8dc167fbb6b7cd974088afe2c349b603..8a061fdbdb32a01f739bef694ffbcfd1a20e2521 100644 --- a/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/ArgumentSequenceTest.php @@ -43,8 +43,10 @@ class ArgumentSequenceTest extends \PHPUnit_Framework_TestCase $this->_fixturePath = realpath(__DIR__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ClassesForArgumentSequence.php'; - $this->_validator = $this->getMock('Magento\Code\Validator\ArgumentSequence', array('_isAllowedType')); - $this->_validator->expects($this->any())->method('_isAllowedType')->will($this->returnValue(true)); + $this->_validator = new \Magento\Code\Validator\ArgumentSequence(); + + /** Build internal cache */ + $this->_validator->validate('\ArgumentSequence\ParentClass'); } public function testValidSequence() diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php b/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php new file mode 100644 index 0000000000000000000000000000000000000000..84755ea7830467e32a9a69bd24519e78eee5d9b6 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/TypeDuplicationTest.php @@ -0,0 +1,75 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code\Validator; + +require_once ('_files/ClassesForTypeDuplication.php'); + +class TypeDuplicationTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \Magento\Code\Validator\TypeDuplication + */ + protected $_validator; + + /** + * @var string + */ + protected $_fixturePath; + + protected function setUp() + { + $this->_fixturePath = realpath(__DIR__) + . DIRECTORY_SEPARATOR . '_files' + . DIRECTORY_SEPARATOR . 'ClassesForTypeDuplication.php'; + $this->_validator = new \Magento\Code\Validator\TypeDuplication(); + } + + /** + * @param $className + * @dataProvider validClassesDataProvider + */ + public function testValidClasses($className) + { + $this->assertTrue($this->_validator->validate($className)); + } + + public function validClassesDataProvider() + { + return array( + 'Duplicated interface injection' => array('\TypeDuplication\ValidClassWithTheSameInterfaceTypeArguments'), + 'Class with sub type arguments' => array('\TypeDuplication\ValidClassWithSubTypeArguments'), + 'Class with SuppressWarnings' => array('\TypeDuplication\ValidClassWithSuppressWarnings'), + ); + } + + public function testInvalidClass() + { + $message = 'Argument type duplication in class TypeDuplication\InvalidClassWithDuplicatedTypes in ' + . $this->_fixturePath . PHP_EOL . 'Multiple type injection [\TypeDuplication\ArgumentBaseClass]'; + $this->setExpectedException('\Magento\Code\ValidationException', $message); + $this->_validator->validate('\TypeDuplication\InvalidClassWithDuplicatedTypes'); + } +} + diff --git a/dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForTypeDuplication.php b/dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForTypeDuplication.php new file mode 100644 index 0000000000000000000000000000000000000000..3f1a0871db851063ebf6e08c4df6fab9f04834b9 --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Code/Validator/_files/ClassesForTypeDuplication.php @@ -0,0 +1,175 @@ +<?php +/** + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace TypeDuplication; + +interface ArgumentInterface +{ + +} + +class ArgumentBaseClass +{ + +} + +class ArgumentClassOne extends ArgumentBaseClass +{ + +} + +class ValidClassWithTheSameInterfaceTypeArguments +{ + /** + * @var ArgumentInterface + */ + protected $argumentOne; + + /** + * @var ArgumentClassOne + */ + protected $argumentTwo; + + /** + * @var ArgumentInterface + */ + protected $argumentThree; + + /** + * @param ArgumentInterface $argumentOne + * @param ArgumentClassOne $argumentTwo + * @param ArgumentInterface $argumentThree + */ + public function __construct( + ArgumentInterface $argumentOne, + ArgumentClassOne $argumentTwo, + ArgumentInterface $argumentThree + ) { + $this->argumentOne = $argumentOne; + $this->argumentTwo = $argumentTwo; + $this->argumentThree = $argumentThree; + } +} + +class ValidClassWithSubTypeArguments +{ + /** + * @var ArgumentBaseClass + */ + protected $argumentOne; + + /** + * @var ArgumentClassOne + */ + protected $argumentTwo; + + /** + * @var ArgumentInterface + */ + protected $argumentThree; + + /** + * @param ArgumentBaseClass $argumentOne + * @param ArgumentClassOne $argumentTwo + * @param ArgumentInterface $argumentThree + */ + public function __construct( + ArgumentBaseClass $argumentOne, + ArgumentClassOne $argumentTwo, + ArgumentInterface $argumentThree + ) { + $this->argumentOne = $argumentOne; + $this->argumentTwo = $argumentTwo; + $this->argumentThree = $argumentThree; + } +} + +class ValidClassWithSuppressWarnings +{ + /** + * @var ArgumentBaseClass + */ + protected $argumentOne; + + /** + * @var ArgumentBaseClass + */ + protected $argumentTwo; + + /** + * @var ArgumentInterface + */ + protected $argumentThree; + + /** + * @param ArgumentBaseClass $argumentOne + * @param ArgumentBaseClass $argumentTwo + * @param ArgumentInterface $argumentThree + * + * @SuppressWarnings(Magento.TypeDuplication) + */ + public function __construct( + ArgumentBaseClass $argumentOne, + ArgumentBaseClass $argumentTwo, + ArgumentInterface $argumentThree + ) { + $this->argumentOne = $argumentOne; + $this->argumentTwo = $argumentTwo; + $this->argumentThree = $argumentThree; + } +} + +class InvalidClassWithDuplicatedTypes +{ + /** + * @var ArgumentBaseClass + */ + protected $argumentOne; + + /** + * @var ArgumentBaseClass + */ + protected $argumentTwo; + + /** + * @var ArgumentInterface + */ + protected $argumentThree; + + /** + * @param ArgumentBaseClass $argumentOne + * @param ArgumentBaseClass $argumentTwo + * @param ArgumentInterface $argumentThree + */ + public function __construct( + ArgumentBaseClass $argumentOne, + ArgumentBaseClass $argumentTwo, + ArgumentInterface $argumentThree + ) { + $this->argumentOne = $argumentOne; + $this->argumentTwo = $argumentTwo; + $this->argumentThree = $argumentThree; + } +} + diff --git a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/DesignTest.php b/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/DesignTest.php index 6bc8ea8479eac14507af9494daeac10755180f42..c86b9340e53cc20c4ec1b3d888f1dc0fe26c72f7 100644 --- a/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/DesignTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/App/Action/Plugin/DesignTest.php @@ -29,7 +29,7 @@ class DesignTest extends \PHPUnit_Framework_TestCase public function testAroundDispatch() { - $designLoaderMock = $this->getMock('Magento\Core\Model\DesignLoader', array(), array(), '', false); + $designLoaderMock = $this->getMock('Magento\View\DesignLoader', array(), array(), '', false); $invocationChainMock = $this->getMock('Magento\Code\Plugin\InvocationChain', array(), array(), '', false); $plugin = new \Magento\Core\App\Action\Plugin\Design($designLoaderMock); $designLoaderMock->expects($this->once())->method('load'); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php index e217d93ecdb24057754fc6de8d64b174c6214ab0..66bdeda698138efb2e095c01a0b8a1e1a26e144e 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DataService/Config/ReaderTest.php @@ -45,8 +45,8 @@ class ReaderTest extends \PHPUnit_Framework_TestCase ->getMock(); $this->_configReader = new \Magento\Core\Model\DataService\Config\Reader( - $this->_modulesReaderMock, - array($path) + array($path), + $this->_modulesReaderMock ); } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php index e6be4f17fcebac977087cf822be47ccaebe326b5..2a135c9ccbe11deb7fc0dc6c198ab9f2372d074f 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/DesignLoaderTest.php @@ -27,7 +27,7 @@ namespace Magento\Core\Model; class DesignLoaderTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\DesignLoader + * @var \Magento\View\DesignLoader */ protected $_model; @@ -51,7 +51,7 @@ class DesignLoaderTest extends \PHPUnit_Framework_TestCase $this->_appMock = $this->getMock('\Magento\Core\Model\App', 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\Core\Model\DesignLoader( + $this->_model = new \Magento\View\DesignLoader( $this->_requestMock, $this->_appMock, $this->_layoutMock diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php index 9d6f2107a37f2ba7b34a0c2b23d375cf50a79a01..36c0c0ce80c49c3c60ae5d714c9cc2f4f26830f4 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/Handler/ArrayTest.php @@ -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 * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) @@ -44,7 +42,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase protected function setUp() { - $this->_factoryMock = $this->getMock('Magento\Core\Model\Layout\Argument\HandlerFactory', array(), array(), + $this->_factoryMock = $this->getMock('Magento\View\Layout\Argument\HandlerFactory', array(), array(), '', false); $this->_model = new \Magento\Core\Model\Layout\Argument\Handler\ArrayHandler($this->_factoryMock); } @@ -58,7 +56,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase { $getHandlerCallback = function ($type) use ($expected) { $handlerModel = $this->getMock( - 'Magento\Core\Model\Layout\Argument\HandlerInterface', + 'Magento\View\Layout\Argument\HandlerInterface', array(), array(), '', @@ -130,7 +128,7 @@ class ArrayTest extends \PHPUnit_Framework_TestCase { $getHandlerCallback = function ($type) { $handlerModel = $this->getMock( - 'Magento\Core\Model\Layout\Argument\HandlerInterface', + 'Magento\View\Layout\Argument\HandlerInterface', array(), array(), '', diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/ProcessorTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/ProcessorTest.php index 0622ca079244b8e929584ed4b733495ae39ddc9d..63561c70d0eadf024b7ba7a8fc775d63120417fb 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/ProcessorTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/ProcessorTest.php @@ -57,7 +57,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase false ); $this->_handlerFactory = $this->getMock( - 'Magento\Core\Model\Layout\Argument\HandlerFactory', + 'Magento\View\Layout\Argument\HandlerFactory', array(), array(), '', @@ -78,7 +78,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase public function testProcess(array $argument, $isUpdater, $result) { $argumentHandlerMock = $this->getMock( - 'Magento\Core\Model\Layout\Argument\HandlerInterface', array(), array(), '', false + 'Magento\View\Layout\Argument\HandlerInterface', array(), array(), '', false ); $argumentHandlerMock->expects($this->once()) ->method('process') @@ -136,7 +136,7 @@ class ProcessorTest extends \PHPUnit_Framework_TestCase ); $argumentHandlerMock = $this->getMock( - 'Magento\Core\Model\Layout\Argument\HandlerInterface', array(), array(), '', false + 'Magento\View\Layout\Argument\HandlerInterface', array(), array(), '', false ); $argumentHandlerMock->expects($this->once()) ->method('parse') diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php index e1f9eedc4b95d79d4fc35bf6e83df673ab99d8a5..c2f826ef7baee26f997fb88d2ce00fe0a6acc138 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Layout/MergeTest.php @@ -281,4 +281,45 @@ class MergeTest extends \PHPUnit_Framework_TestCase $this->assertSame($expected, $this->_model->getAllDesignAbstractions()); } + + public function testIsPageLayoutDesignAbstractions() + { + $expected = array( + 'customer_account' => array( + 'name' => 'customer_account', + 'label' => 'Customer My Account (All Pages)', + 'design_abstraction' => 'custom' + ), + 'page_empty' => array( + 'name' => 'page_empty', + 'label' => 'All Empty Layout Pages', + 'design_abstraction' => 'page_layout' + ), + 'empty_data' => array(), + ); + + $this->assertTrue($this->_model->isPageLayoutDesignAbstraction($expected['page_empty'])); + $this->assertFalse($this->_model->isPageLayoutDesignAbstraction($expected['customer_account'])); + $this->assertFalse($this->_model->isPageLayoutDesignAbstraction($expected['empty_data'])); + } + + public function testIsCustomDesignAbstractions() + { + $expected = array( + 'customer_account' => array( + 'name' => 'customer_account', + 'label' => 'Customer My Account (All Pages)', + 'design_abstraction' => 'custom' + ), + 'page_empty' => array( + 'name' => 'page_empty', + 'label' => 'All Empty Layout Pages', + 'design_abstraction' => 'page_layout' + ), + 'empty_data' => array(), + ); + $this->assertTrue($this->_model->isCustomerDesignAbstraction($expected['customer_account'])); + $this->assertFalse($this->_model->isCustomerDesignAbstraction($expected['page_empty'])); + $this->assertFalse($this->_model->isCustomerDesignAbstraction($expected['empty_data'])); + } } diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/PhysicalTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/PhysicalTest.php index 5887ab1c6d431388e8c646592335874b70d880e9..4be90a7c623d030b50aec126eed43a96f410b9dd 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/PhysicalTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/PhysicalTest.php @@ -40,7 +40,7 @@ class PhysicalTest extends \PHPUnit_Framework_TestCase 'theme_title' => 'Test Theme' )); - $copyService = $this->getMock('Magento\Core\Model\Theme\CopyService', array('copy'), array(), '', false, false); + $copyService = $this->getMock('Magento\Theme\Model\CopyService', array('copy'), array(), '', false, false); $copyService->expects($this->once()) ->method('copy') ->will($this->returnValue($copyService)); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/StagingTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/StagingTest.php index 8e5f25f89b001df156c8dd9a95b3ba79b52a2a7a..2acb0e2300b233310c80b0de7279156e28569e0d 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/StagingTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/StagingTest.php @@ -49,7 +49,7 @@ class StagingTest extends \PHPUnit_Framework_TestCase ); $theme->expects($this->once())->method('getParentTheme')->will($this->returnValue($parentTheme)); - $themeCopyService = $this->getMock('Magento\Core\Model\Theme\CopyService', array('copy'), array(), '', false); + $themeCopyService = $this->getMock('Magento\Theme\Model\CopyService', array('copy'), array(), '', false); $themeCopyService->expects($this->once())->method('copy')->with($theme, $parentTheme); $object = new \Magento\Core\Model\Theme\Domain\Staging($theme, $themeCopyService); diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php index 6c8fc48481aa67ebfbc14438d892d981666a8e63..ffce739108ddb747cb1abb22d9eac2840dc17cbf 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php +++ b/dev/tests/unit/testsuite/Magento/Core/Model/Theme/Domain/VirtualTest.php @@ -54,7 +54,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase $themeFactory = $this->getMock('Magento\Core\Model\ThemeFactory', array('create'), array(), '', false); $themeFactory->expects($this->never())->method('create'); - $themeCopyService = $this->getMock('Magento\Core\Model\Theme\CopyService', array('copy'), array(), '', false); + $themeCopyService = $this->getMock('Magento\Theme\Model\CopyService', array('copy'), array(), '', false); $themeCopyService->expects($this->never())->method('copy'); $customizationConfig = $this->getMock('Magento\Theme\Model\Config\Customization', array(), array(), '', false); @@ -121,7 +121,7 @@ class VirtualTest extends \PHPUnit_Framework_TestCase $themeFactory = $this->getMock('Magento\Core\Model\ThemeFactory', array('create'), array(), '', false); $themeFactory->expects($this->once())->method('create')->will($this->returnValue($themeStaging)); - $themeCopyService = $this->getMock('Magento\Core\Model\Theme\CopyService', array('copy'), array(), '', false); + $themeCopyService = $this->getMock('Magento\Theme\Model\CopyService', array('copy'), array(), '', false); $themeCopyService->expects($this->once())->method('copy')->with($theme, $themeStaging); $customizationConfig = $this->getMock('Magento\Theme\Model\Config\Customization', array(), array(), '', false); diff --git a/dev/tests/unit/testsuite/Magento/Data/Form/Element/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Data/Form/Element/FactoryTest.php index 4075e037d7570459f3c68ff3b1027e431afafd31..cbd919f84d32f7732a21dd40dee10c45ee66189c 100644 --- a/dev/tests/unit/testsuite/Magento/Data/Form/Element/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Data/Form/Element/FactoryTest.php @@ -70,7 +70,7 @@ class FactoryTest extends \PHPUnit_Framework_TestCase */ public function testCreatePositiveWithNotEmptyConfig($type) { - $config = array('attributes' => array('attr1' => 'attr1', 'attr2' => 'attr2')); + $config = array('data' => array('attr1' => 'attr1', 'attr2' => 'attr2')); $className = 'Magento\Data\Form\Element\\' . ucfirst($type); $elementMock = $this->getMock($className, array(), array(), '', false); $this->_objectManagerMock->expects($this->once()) diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php index 3b49363cbea6983880f7e17cb8b5292098e5d1c2..855cd999125f9bedb2177ae368592bdefad6f1e5 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Controller/Varien/Router/StandardTest.php @@ -237,10 +237,10 @@ class StandardTest extends \PHPUnit_Framework_TestCase $this->getMock('Magento\Core\Model\StoreManagerInterface'), $this->getMock('Magento\Core\Model\Store\Config', array(), array(), '', false), $this->getMock('Magento\Core\Model\Url\SecurityInfoInterface'), + 'frontend', $routerListMock, $objectManager, - $rewriteServiceMock, - 'frontend' + $rewriteServiceMock ); return $router; } diff --git a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php index 79bf2e2878b865577e62e7b7d1e61df1502aa36c..be876ccb42c4c45970fc1e5b6667656f68c786a5 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/StateTest.php @@ -143,7 +143,7 @@ class StateTest extends \PHPUnit_Framework_TestCase $storeManager->expects($this->any()) ->method('setConfig') ->with( - $this->equalTo(\Magento\Core\Model\View\Design::XML_PATH_THEME_ID), + $this->equalTo(\Magento\View\DesignInterface::XML_PATH_THEME_ID), $this->equalTo(self::THEME_ID) ) ->will($this->returnSelf()); @@ -156,7 +156,7 @@ class StateTest extends \PHPUnit_Framework_TestCase $configMock->expects($this->any()) ->method('setNode') ->with( - $this->equalTo('default/' . \Magento\Core\Model\View\Design::XML_PATH_THEME_ID), + $this->equalTo('default/' . \Magento\View\DesignInterface::XML_PATH_THEME_ID), $this->equalTo(self::THEME_ID) ) ->will($this->returnSelf()); 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 e967a79dfc25e4d60cd84bef522044b7d460547a..038ad556ea007d81d1b5838c71637c10f80a36df 100644 --- a/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php +++ b/dev/tests/unit/testsuite/Magento/DesignEditor/Model/Theme/ContextTest.php @@ -44,7 +44,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase protected $_themeFactory; /** - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_copyService; @@ -66,7 +66,7 @@ class ContextTest extends \PHPUnit_Framework_TestCase ); $this->_themeFactory->expects($this->any())->method('create')->will($this->returnValue($this->_theme)); - $this->_copyService = $this->getMock('Magento\Core\Model\Theme\CopyService', array('copy'), array(), '', false); + $this->_copyService = $this->getMock('Magento\Theme\Model\CopyService', array('copy'), array(), '', false); $this->_model = new \Magento\DesignEditor\Model\Theme\Context( $this->_themeFactory, 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 bfba89de081ea6f72043281e3ee6946354e48d33..d2cf11e02269d2ad67cfa3f66d404f3dde15da51 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Controller/Adminhtml/IntegrationTest.php @@ -23,10 +23,15 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Controller\Adminhtml; use Magento\Integration\Block\Adminhtml\Integration\Edit\Tab\Info; +use Magento\Integration\Model\Integration as IntegrationModel; +/** + * @SuppressWarnings(PHPMD.TooManyFields) + */ class IntegrationTest extends \PHPUnit_Framework_TestCase { /** @var \PHPUnit_Framework_MockObject_MockObject */ @@ -62,6 +67,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_mockIntegrationSvc; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockOauthSvc; + /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_mockRegistry; @@ -74,6 +82,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_mockConfigScope; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_mockIntegrationData; + /** * Setup object manager and initialize mocks */ @@ -107,6 +118,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $this->_mockIntegrationSvc = $this->getMockBuilder('Magento\Integration\Service\IntegrationV1') ->disableOriginalConstructor() ->getMock(); + $this->_mockOauthSvc = $this->getMockBuilder('Magento\Integration\Service\OauthV1') + ->disableOriginalConstructor() + ->getMock(); $this->_mockRequest = $this->getMockBuilder('Magento\App\Request\Http') ->disableOriginalConstructor() ->getMock(); @@ -119,6 +133,9 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $this->_mockConfigScope = $this->getMockBuilder('Magento\Config\ScopeInterface') ->disableOriginalConstructor() ->getMock(); + $this->_mockIntegrationData = $this->getMockBuilder('Magento\Integration\Helper\Data') + ->disableOriginalConstructor() + ->getMock(); } public function testIndexAction() @@ -142,15 +159,19 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase public function testEditAction() { $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( - $this->returnValue($this->_getSampleIntegrationData())); + $this->returnValue($this->_getSampleIntegrationData()) + ); $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); // put data in session, the magic function getFormData is called so, must match __call method name $this->_mockBackendModSess->expects($this->any()) ->method('__call')->will( - $this->returnValue(array( + $this->returnValue( + array( Info::DATA_ID => 1, 'name' => 'testIntegration' - ))); + ) + ) + ); $this->_verifyLoadAndRenderLayout(); $integrationContr = $this->_createIntegrationController(); $integrationContr->editAction(); @@ -222,7 +243,7 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); // Have integration service throw an exception to test exception path - $exceptionMessage = 'an exception happened'; + $exceptionMessage = 'Internal error. Check exception log for details.'; $this->_mockIntegrationSvc->expects($this->any()) ->method('get') ->with(1) @@ -234,9 +255,26 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $integrationContr->saveAction(); } + public function testSaveActionIntegrationException() + { + $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); + + // Have integration service throw an exception to test exception path + $exceptionMessage = 'Internal error. Check exception log for details.'; + $this->_mockIntegrationSvc->expects($this->any()) + ->method('get') + ->with(1) + ->will($this->throwException(new \Magento\Integration\Exception($exceptionMessage))); + // Verify error + $this->_mockBackendModSess->expects($this->once())->method('addError') + ->with($this->equalTo($exceptionMessage)); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->saveAction(); + } + public function testSaveActionNew() { - $intData = $this->_getSampleIntegrationData(); + $intData = $this->_getSampleIntegrationData()->getData(); //No id when New Integration is Post-ed unset($intData[Info::DATA_ID]); $this->_mockRequest->expects($this->any())->method('getPost')->will($this->returnValue($intData)); @@ -244,7 +282,8 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $this->_mockIntegrationSvc->expects($this->any())->method('create')->with($this->anything()) ->will($this->returnValue($intData)); $this->_mockIntegrationSvc->expects($this->any())->method('get')->with(1)->will( - $this->returnValue(null)); + $this->returnValue(null) + ); // Use real translate model $this->_mockTranslateModel = null; // verify success message @@ -254,6 +293,113 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $integrationContr->saveAction(); } + public function testDeleteAction() + { + $intData = $this->_getSampleIntegrationData(); + $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockIntegrationSvc->expects($this->any())->method('delete')->with($this->anything()) + ->will($this->returnValue($intData)); + // Use real translate model + $this->_mockTranslateModel = null; + // verify success message + $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + ->with(__('The integration \'%1\' has been deleted.', $intData[Info::DATA_NAME])); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + + public function testDeleteActionWithConsumer() + { + $intData = $this->_getSampleIntegrationData(); + $intData[Info::DATA_CONSUMER_ID] = 1; + $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockIntegrationSvc->expects($this->once())->method('delete')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockOauthSvc->expects($this->once())->method('deleteConsumer')->with($this->anything()) + ->will($this->returnValue($intData)); + // Use real translate model + $this->_mockTranslateModel = null; + // verify success message + $this->_mockBackendModSess->expects($this->once())->method('addSuccess') + ->with(__('The integration \'%1\' has been deleted.', $intData[Info::DATA_NAME])); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + + public function testDeleteActionConfigSetUp() + { + $intData = $this->_getSampleIntegrationData(); + $intData[Info::DATA_SETUP_TYPE] = IntegrationModel::TYPE_CONFIG; + $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockIntegrationData->expects($this->once())->method('isConfigType')->with($intData) + ->will($this->returnValue(true)); + // verify error message + $this->_mockBackendModSess->expects($this->once())->method('addError') + ->with(__('Uninstall the extension to remove integration \'%1\'.', $intData[Info::DATA_NAME])); + $this->_mockIntegrationSvc->expects($this->never())->method('delete'); + // Use real translate model + $this->_mockTranslateModel = null; + // verify success message + $this->_mockBackendModSess->expects($this->never())->method('addSuccess'); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + + public function testDeleteActionMissingId() + { + $this->_mockIntegrationSvc->expects($this->never())->method('get'); + $this->_mockIntegrationSvc->expects($this->never())->method('delete'); + // Use real translate model + $this->_mockTranslateModel = null; + // verify error message + $this->_mockBackendModSess->expects($this->once())->method('addError') + ->with(__('Integration ID is not specified or is invalid.')); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + + public function testDeleteActionForServiceIntegrationException() + { + $intData = $this->_getSampleIntegrationData(); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + // Use real translate model + $this->_mockTranslateModel = null; + $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); + $invalidIdException = new \Magento\Integration\Exception($exceptionMessage); + $this->_mockIntegrationSvc->expects($this->once())->method('delete') + ->will($this->throwException($invalidIdException)); + $this->_mockBackendModSess->expects($this->once())->method('addError') + ->with($exceptionMessage); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + + public function testDeleteActionForServiceGenericException() + { + $intData = $this->_getSampleIntegrationData(); + $this->_mockIntegrationSvc->expects($this->any())->method('get')->with($this->anything()) + ->will($this->returnValue($intData)); + $this->_mockRequest->expects($this->once())->method('getParam')->will($this->returnValue('1')); + // Use real translate model + $this->_mockTranslateModel = null; + $exceptionMessage = __("Integration with ID '%1' doesn't exist.", $intData[Info::DATA_ID]); + $invalidIdException = new \Exception($exceptionMessage); + $this->_mockIntegrationSvc->expects($this->once())->method('delete') + ->will($this->throwException($invalidIdException)); + //Generic Exception(non-Service) should never add the message in session for user display + $this->_mockBackendModSess->expects($this->never())->method('addError'); + $integrationContr = $this->_createIntegrationController(); + $integrationContr->deleteAction(); + } + /** * Creates the IntegrationController to test. * @@ -303,8 +449,10 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase $subControllerParams = array( 'context' => $this->_mockBackendCntCtxt, 'integrationService' => $this->_mockIntegrationSvc, + 'oauthService' => $this->_mockOauthSvc, 'registry' => $this->_mockRegistry, - 'logger' => $loggerMock + 'logger' => $loggerMock, + 'integrationData' => $this->_mockIntegrationData ); /** Create IntegrationController to test */ $integrationContr = $this->_objectManagerHelper @@ -341,12 +489,12 @@ class IntegrationTest extends \PHPUnit_Framework_TestCase */ protected function _getSampleIntegrationData() { - return array( + return new \Magento\Object(array( Info::DATA_NAME => 'nameTest', Info::DATA_ID => '1', Info::DATA_EMAIL => 'test@magento.com', Info::DATA_ENDPOINT => 'http://magento.ll/endpoint', - Info::DATA_SETUP_TYPE => 0 - ); + Info::DATA_SETUP_TYPE => IntegrationModel::TYPE_MANUAL + )); } } diff --git a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php index 4bada97cadc2f681eb586c9dd7b60b0285f8b645..1006c704aae9e380cc6e9be54f37db5ac57e5ff3 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Helper/Oauth/ConsumerTest.php @@ -50,8 +50,8 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Integration\Helper\Oauth\Data */ protected $_dataHelper; - /** @var \Magento\Integration\Helper\Oauth\Consumer */ - protected $_consumerHelper; + /** @var \Magento\Integration\Service\OauthV1Interface */ + protected $_oauthService; /** @var \Magento\Logger */ protected $_loggerMock; @@ -91,6 +91,15 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase $this->_dataHelper = $this->getMockBuilder('Magento\Integration\Helper\Oauth\Data') ->disableOriginalConstructor() ->getMock(); + + $oauthHelperMock = $this->getMockBuilder('Magento\Oauth\Helper\Oauth') + ->disableOriginalConstructor() + ->getMock(); + + $tokenProviderMock = $this->getMockBuilder('Magento\Integration\Model\Oauth\Token\Provider') + ->disableOriginalConstructor() + ->getMock(); + $this->_httpClientMock = $this->getMockBuilder('Magento\HTTP\ZendClient') ->disableOriginalConstructor() ->getMock(); @@ -99,13 +108,15 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase ->setMethods(array('logException')) ->getMock(); - $this->_consumerHelper = new \Magento\Integration\Helper\Oauth\Consumer( + $this->_oauthService = new \Magento\Integration\Service\OauthV1( $this->_storeManagerMock, $this->_consumerFactory, $this->_tokenFactory, $this->_dataHelper, $this->_httpClientMock, - $this->_loggerMock + $this->_loggerMock, + $oauthHelperMock, + $tokenProviderMock ); } @@ -117,7 +128,7 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase unset($this->_dataHelper); unset($this->_httpClientMock); unset($this->_loggerMock); - unset($this->_consumerHelper); + unset($this->_oauthService); } public function testCreateConsumer() @@ -130,18 +141,14 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase 'key' => $key, 'secret' => $secret ); - $this->_consumerMock->expects($this->once()) ->method('save') ->will($this->returnSelf()); - $this->_consumerMock->expects($this->once()) - ->method('getData') - ->will($this->returnValue($consumerData)); - $responseData = $this->_consumerHelper->createConsumer($consumerData); + /** @var \Magento\Integration\Model\Oauth\Consumer $consumer */ + $consumer = $this->_oauthService->createConsumer($consumerData); - $this->assertEquals($key, $responseData['key'], 'Checking Oauth Consumer Key'); - $this->assertEquals($secret, $responseData['secret'], 'Checking Oauth Consumer Secret'); + $this->assertEquals($consumer, $this->_consumerMock, 'Consumer object was expected to be returned'); } public function testPostToConsumer() @@ -189,7 +196,7 @@ class ConsumerTest extends \PHPUnit_Framework_TestCase ->method('getConsumerPostTimeout') ->will($this->returnValue(120)); - $verifier = $this->_consumerHelper->postToConsumer($consumerId, 'http://www.magento.com'); + $verifier = $this->_oauthService->postToConsumer($consumerId, 'http://www.magento.com'); $this->assertEquals($oauthVerifier, $verifier, 'Checking Oauth Verifier'); } diff --git a/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php b/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php index 56f3cdaa8cef61342dc486eee8333cbd5121e48d..60e2d3406f3095b4ed396bdb4dd879361042f39a 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Model/ManagerTest.php @@ -98,11 +98,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase ) ) ); - $intLookupData1 = array( - Integration::ID => 1, + $intLookupData1 = new \Magento\Object(array( + 'id' => 1, Integration::NAME => 'TestIntegration1', Integration::SETUP_TYPE => 1, - ); + )); $intUpdateData1 = array( Integration::ID => 1, @@ -129,11 +129,11 @@ class ManagerTest extends \PHPUnit_Framework_TestCase $this->_integrationServiceMock->expects($this->at(2)) ->method('findByName') ->with('TestIntegration2') - ->will($this->returnValue(array())); + ->will($this->returnValue(new \Magento\Object(array()))); $this->_integrationServiceMock->expects($this->once()) ->method('update') ->with($intUpdateData1); $this->_integrationManager->processIntegrationConfig(array('TestIntegration1', 'TestIntegration2')); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php b/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php index 1ab78a52ff67f6172c73c431350550b591d1684f..5de95ae8eb8d69d08346d9f95ec01cef2d8d3c5f 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Oauth/OauthTest.php @@ -660,7 +660,11 @@ class OauthTest extends \PHPUnit_Framework_TestCase $this->_setupNonce(); $this->_setupToken(true, \Magento\Integration\Model\Oauth\Token::TYPE_ACCESS); $requiredParams = $this->_getAccessTokenRequiredParams(); - $this->assertTrue($this->_oauth->validateAccessTokenRequest($requiredParams, self::REQUEST_URL)); + $this->assertEquals( + 1, + $this->_oauth->validateAccessTokenRequest($requiredParams, self::REQUEST_URL), + "Consumer ID is invalid." + ); } /** @@ -716,7 +720,7 @@ class OauthTest extends \PHPUnit_Framework_TestCase $this->_setupConsumer(); $this->_setupToken(true, \Magento\Integration\Model\Oauth\Token::TYPE_ACCESS); - $this->assertTrue($this->_oauth->validateAccessToken($this->_oauthToken)); + $this->assertEquals(1, $this->_oauth->validateAccessToken($this->_oauthToken), "Consumer ID is invalid."); } public function testBuildAuthorizationHeader() diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php index 8db1c1718b8f3c52c40f634cbd83f89a589be2c3..f621310fa8e24e5de6df100d7a7503e448b3e0d4 100644 --- a/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/IntegrationV1Test.php @@ -23,14 +23,18 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Integration\Service; +use Magento\Integration\Model\Integration; + class IntegrationV1Test extends \PHPUnit_Framework_TestCase { const VALUE_INTEGRATION_ID = 1; const VALUE_INTEGRATION_NAME = 'Integration Name'; const VALUE_INTEGRATION_ANOTHER_NAME = 'Another Integration Name'; const VALUE_INTEGRATION_EMAIL = 'test@magento.com'; + const VALUE_INTEGRATION_SETUP_BACKEND = 0; const VALUE_INTEGRATION_ENDPOINT = 'http://magento.ll/endpoint'; /** @var \PHPUnit_Framework_MockObject_MockObject */ @@ -65,31 +69,37 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase 'load', 'loadByName', 'save', + 'delete', '__wakeup' ] ) ->getMock(); $this->_integrationData = array( - 'integration_id' => self::VALUE_INTEGRATION_ID, - 'name' => self::VALUE_INTEGRATION_NAME, - 'email' => self::VALUE_INTEGRATION_EMAIL, - 'endpoint' => self::VALUE_INTEGRATION_ENDPOINT + Integration::ID => self::VALUE_INTEGRATION_ID, + Integration::NAME => self::VALUE_INTEGRATION_NAME, + Integration::EMAIL => self::VALUE_INTEGRATION_EMAIL, + Integration::EMAIL => self::VALUE_INTEGRATION_ENDPOINT, + Integration::SETUP_TYPE => self::VALUE_INTEGRATION_SETUP_BACKEND ); $this->_integrationFactory->expects($this->any()) ->method('create') ->will($this->returnValue($this->_integrationMock)); - $authorizationMock = $this->getMock('Magento\Authz\Service\AuthorizationV1Interface'); $userIdentifierFactory = $this->getMockBuilder('Magento\Authz\Model\UserIdentifier\Factory') ->disableOriginalConstructor()->getMock(); + $oauthConsumerHelper = $this->getMockBuilder('Magento\Integration\Service\OauthV1') + ->disableOriginalConstructor()->getMock(); + $oauthConsumer = $this->getMockBuilder('Magento\Integration\Model\Oauth\Consumer') + ->disableOriginalConstructor()->getMock(); + $oauthConsumerHelper->expects($this->any())->method('createConsumer')->will($this->returnValue($oauthConsumer)); + $oauthConsumerHelper->expects($this->any())->method('loadConsumer')->will($this->returnValue($oauthConsumer)); $userIdentifier = $this->getMockBuilder('Magento\Authz\Model\UserIdentifier')->disableOriginalConstructor() ->getMock(); $userIdentifierFactory->expects($this->any())->method('create')->will($this->returnValue($userIdentifier)); $this->_service = new \Magento\Integration\Service\IntegrationV1( $this->_integrationFactory, - $authorizationMock, - $userIdentifierFactory + $oauthConsumerHelper ); $this->_emptyIntegrationMock = $this->getMockBuilder('Magento\Integration\Model\Integration') ->disableOriginalConstructor() @@ -103,6 +113,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase 'load', 'loadByName', 'save', + 'delete', '__wakeup' ] ) @@ -128,7 +139,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase ->method('save') ->will($this->returnSelf()); $this->_setValidIntegrationData(); - $resultData = $this->_service->create($this->_integrationData); + $resultData = $this->_service->create($this->_integrationData)->getData(); $this->assertSame($this->_integrationData, $resultData); } @@ -170,7 +181,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase ->method('save') ->will($this->returnSelf()); $this->_setValidIntegrationData(); - $integrationData = $this->_service->update($this->_integrationData); + $integrationData = $this->_service->update($this->_integrationData)->getData(); $this->assertEquals($this->_integrationData, $integrationData); } @@ -196,7 +207,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase ->method('getData') ->will($this->returnValue($integrationData)); - $updatedData = $this->_service->update($integrationData); + $updatedData = $this->_service->update($integrationData)->getData(); $this->assertEquals($integrationData, $updatedData); } @@ -238,13 +249,13 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase ->will($this->returnSelf()); $this->_integrationMock->expects($this->never()) ->method('save'); - $integrationData = $this->_service->get(self::VALUE_INTEGRATION_ID); + $integrationData = $this->_service->get(self::VALUE_INTEGRATION_ID)->getData(); $this->assertEquals($this->_integrationData, $integrationData); } /** * @expectedException \Magento\Integration\Exception - * @expectedExceptionMessage Integration with ID '1' doesn't exist. + * @expectedExceptionMessage Integration with ID '1' does not exist. */ public function testGetException() { @@ -256,7 +267,70 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase ->will($this->returnSelf()); $this->_integrationMock->expects($this->never()) ->method('save'); - $this->_service->get(self::VALUE_INTEGRATION_ID); + $this->_service->get(self::VALUE_INTEGRATION_ID)->getData(); + } + + public function testFindByName() + { + $this->_integrationMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_INTEGRATION_NAME, 'name') + ->will($this->returnValue($this->_integrationMock)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $integration = $this->_service->findByName(self::VALUE_INTEGRATION_NAME); + $this->assertEquals($this->_integrationData[Integration::NAME], $integration->getData()[Integration::NAME]); + } + + public function testFindByNameNotFound() + { + $this->_integrationMock->expects($this->any()) + ->method('load') + ->with(self::VALUE_INTEGRATION_NAME, 'name') + ->will($this->returnValue($this->_emptyIntegrationMock)); + $this->_emptyIntegrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue(null)); + $integration = $this->_service->findByName(self::VALUE_INTEGRATION_NAME); + $this->assertNull($integration->getData()); + } + + public function testDelete() + { + $this->_integrationMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue(self::VALUE_INTEGRATION_ID)); + $this->_integrationMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_INTEGRATION_ID) + ->will($this->returnValue($this->_integrationMock)); + $this->_integrationMock->expects($this->once()) + ->method('delete') + ->will($this->returnValue($this->_integrationMock)); + $this->_integrationMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_integrationData)); + $integrationData = $this->_service->delete(self::VALUE_INTEGRATION_ID); + $this->assertEquals($this->_integrationData[Integration::ID], $integrationData[Integration::ID]); + } + + + /** + * @expectedException \Magento\Integration\Exception + * @expectedExceptionMessage Integration with ID '1' does not exist. + */ + public function testDeleteException() + { + $this->_integrationMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(null)); + $this->_integrationMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + $this->_integrationMock->expects($this->never()) + ->method('delete'); + $this->_service->delete(self::VALUE_INTEGRATION_ID); } /** @@ -298,6 +372,7 @@ class IntegrationV1Test extends \PHPUnit_Framework_TestCase 'load', 'loadByName', 'save', + 'delete', '__wakeup' ] ) diff --git a/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php new file mode 100644 index 0000000000000000000000000000000000000000..c2db478ba0b3f0ce21672e17893ed63272769ebf --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Integration/Service/OauthV1Test.php @@ -0,0 +1,144 @@ +<?php +/** + * Test for \Magento\Integration\Service\OauthV1 + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Integration\Service; + +use Magento\Integration\Model\Integration; + +class OauthV1Test extends \PHPUnit_Framework_TestCase +{ + const VALUE_CONSUMER_ID = 1; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_consumerFactory; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $_consumerMock; + + /** @var \PHPUnit_Framework_MockObject_MockObject */ + private $_emptyConsumerMock; + + /** @var \Magento\Integration\Service\OauthV1 */ + private $_service; + + /** @var array */ + private $_consumerData; + + protected function setUp() + { + $this->_consumerFactory = $this->getMockBuilder('Magento\Integration\Model\Oauth\Consumer\Factory') + ->disableOriginalConstructor() + ->getMock(); + $this->_consumerMock = $this->getMockBuilder('Magento\Integration\Model\Oauth\Consumer') + ->disableOriginalConstructor() + ->setMethods( + [ + 'getData', + 'getId', + 'load', + 'save', + 'delete', + '__wakeup' + ] + ) + ->getMock(); + $this->_consumerData = array( + 'entity_id' => self::VALUE_CONSUMER_ID, + 'key' => 'jhgjhgjgjiyuiuyuyhhhjkjlklkj', + 'secret' => 'iuyytrfdsdfbnnhbmkkjlkjl', + 'created_at' => '', + 'updated_at' => '', + 'callback_url' => '', + 'rejected_callback_url' => '' + ); + $this->_consumerFactory->expects($this->any()) + ->method('create') + ->will($this->returnValue($this->_consumerMock)); + + $this->_service = new \Magento\Integration\Service\OauthV1( + $this->getMock('Magento\Core\Model\StoreManagerInterface', [], [], '', false), + $this->_consumerFactory, + $this->getMock('Magento\Integration\Model\Oauth\Token\Factory', [], [], '', false), + $this->getMock('Magento\Integration\Helper\Oauth\Data', [], [], '', false), + $this->getMock('Magento\HTTP\ZendClient', [], [], '', false), + $this->getMock('Magento\Logger', [], [], '', false), + $this->getMock('Magento\Oauth\Helper\Oauth', [], [], '', false), + $this->getMock('Magento\Integration\Model\Oauth\Token\Provider', [], [], '', false) + ); + $this->_emptyConsumerMock = $this->getMockBuilder('Magento\Integration\Model\Integration') + ->disableOriginalConstructor() + ->setMethods( + [ + 'getData', + 'load', + 'getId', + 'save', + 'delete', + '__wakeup' + ] + ) + ->getMock(); + $this->_emptyConsumerMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(null)); + } + + public function testDelete() + { + $this->_consumerMock->expects($this->once()) + ->method('getId') + ->will($this->returnValue(self::VALUE_CONSUMER_ID)); + $this->_consumerMock->expects($this->once()) + ->method('load') + ->with(self::VALUE_CONSUMER_ID) + ->will($this->returnValue($this->_consumerMock)); + $this->_consumerMock->expects($this->once()) + ->method('delete') + ->will($this->returnValue($this->_consumerMock)); + $this->_consumerMock->expects($this->any()) + ->method('getData') + ->will($this->returnValue($this->_consumerData)); + $consumerData = $this->_service->deleteConsumer(self::VALUE_CONSUMER_ID); + $this->assertEquals($this->_consumerData['entity_id'], $consumerData['entity_id']); + } + + /** + * @expectedException \Magento\Integration\Exception + * @expectedExceptionMessage Consumer with ID '1' does not exist. + */ + public function testDeleteException() + { + $this->_consumerMock->expects($this->any()) + ->method('getId') + ->will($this->returnValue(null)); + $this->_consumerMock->expects($this->once()) + ->method('load') + ->will($this->returnSelf()); + $this->_consumerMock->expects($this->never()) + ->method('delete'); + $this->_service->deleteConsumer(self::VALUE_CONSUMER_ID); + } +} diff --git a/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php b/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php index 204ad6cd46fd2ff9de5d08557492f0d4719798ec..ed249d833395fbc8743929707e156938eecf95dd 100644 --- a/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php +++ b/dev/tests/unit/testsuite/Magento/Interception/PluginList/PluginListTest.php @@ -86,8 +86,8 @@ class PluginListTest extends \PHPUnit_Framework_TestCase $omConfigMock, new \Magento\Interception\Definition\Runtime(), array('global'), - null, - 'interception' + 'interception', + null ); } diff --git a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php index 7838d12cf6e524bc3627318129ed293f9eb91c74..9fbb9b1636a5a0803d6f7d1bcfaf6160d6423944 100644 --- a/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php +++ b/dev/tests/unit/testsuite/Magento/Log/Model/ShellTest.php @@ -47,7 +47,7 @@ class ShellTest extends \PHPUnit_Framework_TestCase $dirMock = $this->getMock('Magento\App\Dir', array(), array(), '', false); $this->_model = $this->getMock('Magento\Log\Model\Shell', array('_applyPhpVariables'), - array($this->_factoryMock, $filesystemMock, 'entryPoint.php', $dirMock) + array($filesystemMock, 'entryPoint.php', $dirMock, $this->_factoryMock) ); } diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php index 48032b5262122159be41d3c5c3dff1dd0cee046b..09cf56e30d8ff51225341e80e083567fe57c9637 100644 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/FactoryTest.php @@ -20,8 +20,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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php index 30e58a9d0aa034ea3ad4bf2201431ff97f17c0d4..4babaac46b550466b81a5522ed035e6c28189a28 100644 --- a/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php +++ b/dev/tests/unit/testsuite/Magento/Outbound/Authentication/HmacTest.php @@ -20,8 +20,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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php index e240f5aab683df107d3b8d17dc62e3920ab6240a..3b21a5c896397634b77327df417fa96e273a2e4b 100644 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/FactoryTest.php @@ -20,8 +20,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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php index a74cd92d3a9b8f451dbc73e6b2a9600eebf9070b..5a455c8667d29235704afedf0ff59c046ecf0920 100644 --- a/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php +++ b/dev/tests/unit/testsuite/Magento/Outbound/Formatter/JsonTest.php @@ -20,8 +20,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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueHandlerTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueHandlerTest.php deleted file mode 100644 index 0d11268a158fe45e23e7fdb168b7e727502cc3b2..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Event/QueueHandlerTest.php +++ /dev/null @@ -1,181 +0,0 @@ -<?php -/** - * \Magento\PubSub\Event\QueueHandler - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Event; - -class QueueHandlerTest extends \PHPUnit_Framework_TestCase -{ - const TOPIC = 'some_topic'; - const ANOTHER_TOPIC = 'some_other_topic'; - - /** @var \Magento\PubSub\Event\QueueHandler */ - private $_queueHandler; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionMockB; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_eventQueueMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_jobQueueMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_jobFactoryMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subxCollectionMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMockB; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_jobMock; - - /** @var array Topics mapped to arrays of subscriptions */ - private $_actualJobsMap; - - - protected function setUp() - { - /** - * Mock objects - */ - $this->_subscriptionMockA = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - - $this->_subscriptionMockB = clone $this->_subscriptionMockA; - - $this->_eventQueueMock = $this->getMockBuilder('Magento\Webhook\Model\Event\QueueReader') - ->disableOriginalConstructor() - ->getMock(); - - $this->_jobQueueMock = $this->getMockBuilder('Magento\Webhook\Model\Job\QueueWriter') - ->disableOriginalConstructor() - ->getMock(); - - $this->_jobFactoryMock = $this->getMockBuilder('Magento\Webhook\Model\Job\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_subxCollectionMock = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription\Collection') - ->disableOriginalConstructor() - ->getMock(); - - $this->_eventMockA = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - - $this->_eventMockB = clone $this->_eventMockA; - - $this->_jobMock = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->disableOriginalConstructor() - ->getMock(); - - /** - * Method stubs - */ - $this->_eventQueueMock->expects($this->exactly(3)) - ->method('poll') - ->with() - ->will($this->onConsecutiveCalls( - $this->_eventMockA, - $this->_eventMockB, - null - )); - - $this->_eventMockA->expects($this->exactly(2)) //used in handle() and logJob() - ->method('getTopic') - ->with() - ->will($this->returnValue(self::TOPIC)); - - $this->_eventMockB->expects($this->exactly(2)) //used in handle() and logJob() - ->method('getTopic') - ->with() - ->will($this->returnValue(self::ANOTHER_TOPIC)); - - $subxByTopic = array( - array(self::TOPIC, array($this->_subscriptionMockA)), - array(self::ANOTHER_TOPIC, array($this->_subscriptionMockB)), - ); - - $this->_subxCollectionMock->expects($this->exactly(2)) - ->method('getSubscriptionsByTopic') - ->will($this->returnValueMap( $subxByTopic )); - - $callback = array($this, 'logJob'); - - $this->_jobFactoryMock->expects($this->exactly(2)) - ->method('create') - ->will($this->returnCallback($callback)); - } - - public function testHandle() - { - $this->_queueHandler = new \Magento\PubSub\Event\QueueHandler( - $this->_eventQueueMock, - $this->_jobQueueMock, - $this->_jobFactoryMock, - $this->_subxCollectionMock - ); - - /** - * Expected map of event topics to subscriptions. Values are arrays because one topic can map to multiple - * subscriptions. - */ - $expectedJobsMap = array( - self::TOPIC => array($this->_subscriptionMockA), - self::ANOTHER_TOPIC => array($this->_subscriptionMockB), - ); - - $this->_queueHandler->handle(); - - /** - * Verifies that QueueHandler effectively polls the queue, gets the topic, and creates jobs for every \ - * subscription associated with every event. - */ - $this->assertEquals($expectedJobsMap, $this->_actualJobsMap); - } - - /** - * Logs when a the job factory calls the create method stub - * - * @param $subscription - * @param $event - * @return \PHPUnit_Framework_MockObject_MockObject Is a mock of \Magento\Webhook\Model\Job - */ - public function logJob($subscription, $event) - { - $this->_actualJobsMap[$event->getTopic()][] = $subscription; - return $this->_jobMock; - } -} diff --git a/dev/tests/unit/testsuite/Magento/PubSub/Job/QueueHandlerTest.php b/dev/tests/unit/testsuite/Magento/PubSub/Job/QueueHandlerTest.php deleted file mode 100644 index f70469331135c0d877ca57d05603dc5f36df7055..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/PubSub/Job/QueueHandlerTest.php +++ /dev/null @@ -1,236 +0,0 @@ -<?php -/** - * \Magento\PubSub\Job\QueueHandler - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\PubSub\Job; - -class QueueHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\PubSub\Job\QueueHandler */ - private $_queueHandler; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionMockB; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_eventMockB; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_queueReaderMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_queueWriterMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_messageMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_messageMockB; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_msgFactoryMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_transportMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_endpointMockA; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_endpointMockB; - - protected function setUp() - { - // Object mocks - $this->_subscriptionMockA = $this->_makeMock('Magento\Webhook\Model\Subscription'); - $this->_subscriptionMockB = $this->_makeMock('Magento\Webhook\Model\Subscription'); - $this->_eventMockA = $this->_makeMock('Magento\Webhook\Model\Event'); - $this->_eventMockB = $this->_makeMock('Magento\Webhook\Model\Event'); - $this->_msgFactoryMock = $this->_makeMock('Magento\Outbound\Message\Factory'); - $this->_transportMock = $this->_makeMock('Magento\Outbound\Transport\Http'); - $this->_queueReaderMock = $this->_makeMock('Magento\Webhook\Model\Job\QueueReader'); - $this->_queueWriterMock = $this->_makeMock('Magento\Webhook\Model\Job\QueueWriter'); - $this->_messageMockA = $this->_makeMock('Magento\Outbound\Message'); - $this->_messageMockB = $this->_makeMock('Magento\Outbound\Message'); - $this->_endpointMockA = $this->_makeMock('Magento\Outbound\EndpointInterface'); - $this->_endpointMockB = $this->_makeMock('Magento\Outbound\EndpointInterface'); - - $this->_subscriptionMockA->expects($this->any()) - ->method('getEndpoint') - ->will($this->returnValue($this->_endpointMockA)); - - $this->_subscriptionMockB->expects($this->any()) - ->method('getEndpoint') - ->will($this->returnValue($this->_endpointMockB)); - - $this->_eventMockA->expects($this->any()) - ->method('getTopic') - ->will($this->returnValue('topicA')); - - $this->_eventMockA->expects($this->any()) - ->method('getBodyData') - ->will($this->returnValue(array('BodyDataA'))); - - $this->_eventMockB->expects($this->any()) - ->method('getTopic') - ->will($this->returnValue('topicB')); - - $this->_eventMockB->expects($this->any()) - ->method('getBodyData') - ->will($this->returnValue(array('BodyDataB'))); - } - - public function testHandle() - { - // Resources for stubs - $jobMsgMap = array( - array($this->_endpointMockA, 'topicA', array('BodyDataA'), $this->_messageMockA), - array($this->_endpointMockB, 'topicB', array('BodyDataB'), $this->_messageMockB), - ); - - $responseA = $this->_makeMock('Magento\Outbound\Transport\Http\Response'); - $responseB = $this->_makeMock('Magento\Outbound\Transport\Http\Response'); - - $responseA->expects($this->once()) - ->method('isSuccessful') - ->will($this->returnValue(true)); - - $responseB->expects($this->once()) - ->method('isSuccessful') - ->will($this->returnValue(false)); - - $msgResponseMap = array( - array($this->_messageMockA, $responseA), - array($this->_messageMockB, $responseB), - ); - - // Message factory create - $this->_msgFactoryMock->expects($this->exactly(2)) - ->method('create') - ->will($this->returnValueMap($jobMsgMap)); - - // Transport dispatch - $this->_transportMock->expects($this->exactly(2)) - ->method('dispatch') - ->will($this->returnValueMap($msgResponseMap)); - - // Job stubs - $jobMockA = $this->_makeMock('Magento\Webhook\Model\Job'); - $jobMockB = $this->_makeMock('Magento\Webhook\Model\Job'); - - $jobMockA->expects($this->once()) - ->method('complete'); - - $jobMockB->expects($this->once()) - ->method('handleFailure'); - - $jobMockA->expects($this->once()) - ->method('getSubscription') - ->with() - ->will($this->returnValue($this->_subscriptionMockA)); - - $jobMockB->expects($this->once()) - ->method('getSubscription') - ->with() - ->will($this->returnValue($this->_subscriptionMockB)); - - $jobMockA->expects($this->once()) - ->method('getEvent') - ->with() - ->will($this->returnValue($this->_eventMockA)); - - $jobMockB->expects($this->once()) - ->method('getEvent') - ->with() - ->will($this->returnValue($this->_eventMockB)); - - // Queue contains two jobs, and will then return null to stop the loop - $this->_queueReaderMock->expects($this->exactly(3)) - ->method('poll') - ->with() - ->will($this->onConsecutiveCalls( - $jobMockA, - $jobMockB, - null - )); - - $this->_queueHandler = new \Magento\PubSub\Job\QueueHandler( - $this->_queueReaderMock, - $this->_queueWriterMock, - $this->_transportMock, - $this->_msgFactoryMock - ); - - $this->_queueHandler->handle(); - } - - public function testHandleEmptyQueue() - { - $this->_expectedCodes = array (); - - // Queue contains no jobs - $this->_queueReaderMock->expects($this->once()) - ->method('poll') - ->with() - ->will($this->onConsecutiveCalls( - null - )); - - // Message factory create should never be called - $this->_msgFactoryMock->expects($this->never()) - ->method('create'); - - // Transport dispatch should never be called - $this->_transportMock->expects($this->never()) - ->method('dispatch'); - - $this->_queueHandler = new \Magento\PubSub\Job\QueueHandler( - $this->_queueReaderMock, - $this->_queueWriterMock, - $this->_transportMock, - $this->_msgFactoryMock - ); - - $this->_queueHandler->handle(); - } - - /** - * Generates a mock object of the given class - * - * @param string $className - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php index ec9102370906fc3ab0e24c577efbe3b03e3afff6..2ce7cfca655272fde3c4a25d3935fbdf2d7aaf16 100644 --- a/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/ConfigTest.php @@ -133,7 +133,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_configData->expects($this->at(2)) ->method('addFieldToFilter') - ->with('path', \Magento\Core\Model\View\Design::XML_PATH_THEME_ID) + ->with('path', \Magento\View\DesignInterface::XML_PATH_THEME_ID) ->will($this->returnValue(array($configEntity))); $this->_themeMock->expects($this->any()) @@ -176,7 +176,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase $this->_configData->expects($this->at(2)) ->method('addFieldToFilter') - ->with('path', \Magento\Core\Model\View\Design::XML_PATH_THEME_ID) + ->with('path', \Magento\View\DesignInterface::XML_PATH_THEME_ID) ->will($this->returnValue(array($configEntity))); $this->_themeMock->expects($this->any()) diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/CopyServiceTest.php b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php similarity index 97% rename from dev/tests/unit/testsuite/Magento/Core/Model/Theme/CopyServiceTest.php rename to dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php index 3e95d10f6e56d8749b3f4fc7e6c0b58bc58c668b..57555b66d73f31e437d5349857ddaa85a0a31c2c 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Theme/CopyServiceTest.php +++ b/dev/tests/unit/testsuite/Magento/Theme/Model/CopyServiceTest.php @@ -19,18 +19,18 @@ * needs please refer to http://www.magentocommerce.com for more information. * * @category Magento - * @package Magento_Core + * @package Magento_Theme * @subpackage unit_tests * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Theme; +namespace Magento\Theme\Model; class CopyServiceTest extends \PHPUnit_Framework_TestCase { /**#@+ - * @var \Magento\Core\Model\Theme\CopyService + * @var \Magento\Theme\Model\CopyService */ protected $_object; @@ -170,7 +170,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase $eventManager = $this->getMock('Magento\Event\ManagerInterface', array('dispatch'), array(), '', false); - $this->_object = new \Magento\Core\Model\Theme\CopyService( + $this->_object = new \Magento\Theme\Model\CopyService( $this->_filesystem, $this->_fileFactory, $this->_link, @@ -196,7 +196,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Theme\CopyService::_copyLayoutCustomization + * @covers \Magento\Theme\Model\CopyService::_copyLayoutCustomization */ public function testCopyLayoutUpdates() { @@ -269,7 +269,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Theme\CopyService::_copyDatabaseCustomization + * @covers \Magento\Theme\Model\CopyService::_copyDatabaseCustomization */ public function testCopyDatabaseCustomization() { @@ -348,7 +348,7 @@ class CopyServiceTest extends \PHPUnit_Framework_TestCase } /** - * @covers \Magento\Core\Model\Theme\CopyService::_copyFilesystemCustomization + * @covers \Magento\Theme\Model\CopyService::_copyFilesystemCustomization */ public function testCopyFilesystemCustomization() { diff --git a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/HandlerFactoryTest.php b/dev/tests/unit/testsuite/Magento/View/Layout/Argument/HandlerFactoryTest.php similarity index 85% rename from dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/HandlerFactoryTest.php rename to dev/tests/unit/testsuite/Magento/View/Layout/Argument/HandlerFactoryTest.php index 21f5ec47efea2ea0b555db72f125e48c6d7add6d..084dc8d337017cdcf2058be51e00c3355595a1ff 100644 --- a/dev/tests/unit/testsuite/Magento/Core/Model/Layout/Argument/HandlerFactoryTest.php +++ b/dev/tests/unit/testsuite/Magento/View/Layout/Argument/HandlerFactoryTest.php @@ -26,14 +26,14 @@ */ /** - * Test class for \Magento\Core\Model\Layout\Argument\HandlerFactory + * Test class for \Magento\View\Layout\Argument\HandlerFactory */ -namespace Magento\Core\Model\Layout\Argument; +namespace Magento\View\Layout\Argument; class HandlerFactoryTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Core\Model\Layout\Argument\HandlerFactory + * @var \Magento\View\Layout\Argument\HandlerFactory */ protected $_model; @@ -45,7 +45,14 @@ class HandlerFactoryTest extends \PHPUnit_Framework_TestCase protected function setUp() { $this->_objectManagerMock = $this->getMock('Magento\ObjectManager'); - $this->_model = new \Magento\Core\Model\Layout\Argument\HandlerFactory($this->_objectManagerMock); + $this->_model = new \Magento\View\Layout\Argument\HandlerFactory( + $this->_objectManagerMock, + array( + 'object' => 'Magento\Core\Model\Layout\Argument\Handler\Object', + 'options' => 'Magento\Core\Model\Layout\Argument\Handler\Options', + 'url' => 'Magento\Core\Model\Layout\Argument\Handler\Url', + ) + ); } protected function tearDown() diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php deleted file mode 100644 index d9a5df7ff5aa7446d0342837434e5136ec8d07f3..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/Tab/ResourceTest.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -/** - * Test for \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource block - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit\Tab; - -class ResourceTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule|PHPUnit_Framework_MockObject_MockObject - */ - protected $_ruleResource; - - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource - */ - protected $_block; - - protected function setUp() - { - $this->_ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') - ->disableOriginalConstructor() - ->setMethods(array('getResourceIdsByRole', '__wakeup')) - ->getMock(); - - $rootResource = new \Magento\Core\Model\Acl\RootResource('Magento_Webapi'); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\Role\Edit\Tab\Resource', array( - 'ruleResource' => $this->_ruleResource, - 'rootResource' => $rootResource - )); - } - - /** - * Test isEverythingAllowed method. - * - * @dataProvider isEverythingAllowedDataProvider - * @param array $selectedResources - * @param bool $expectedResult - */ - public function testIsEverythingAllowed($selectedResources, $expectedResult) - { - $apiRole = new \Magento\Object(array( - 'role_id' => 1 - )); - $apiRole->setIdFieldName('role_id'); - - $this->_block->setApiRole($apiRole); - - $this->_ruleResource->expects($this->once()) - ->method('getResourceIdsByRole') - ->with($apiRole->getId()) - ->will($this->returnValue($selectedResources)); - - $this->assertEquals($expectedResult, $this->_block->isEverythingAllowed()); - } - - /** - * @return array - */ - public function isEverythingAllowedDataProvider() - { - return array( - 'Not everything is allowed' => array( - array('customer', 'customer/get'), - false - ), - 'Everything is allowed' => array( - array('customer', 'customer/get', 'Magento_Webapi'), - true - ) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/TabsTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/TabsTest.php deleted file mode 100644 index e3066fd54f82f6351ae0c256d4bbd5af8b7162ad..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/Edit/TabsTest.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\Role\Edit; - -class TabsTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs - */ - protected $_block; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Model\Layout - */ - protected $_layout; - - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\App\RequestInterface - */ - protected $_request; - - protected function setUp() - { - /** @var \Magento\Backend\Model\Url|PHPUnit_Framework_MockObject_MockObject $urlBuilder */ - $urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') - ->disableOriginalConstructor() - ->getMock(); - - $this->_layout = $this->getMockBuilder('Magento\Core\Model\Layout') - ->disableOriginalConstructor() - ->setMethods(array('helper', 'getBlock')) - ->getMock(); - - $backendData = $this->getMock('Magento\Backend\Helper\Data', array(), array(), '', false); - $this->_request = $this->getMockForAbstractClass('Magento\App\RequestInterface', - array($backendData), '', false, false, true, array('getParam')); - - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $this->_helper->getObject('Magento\Webapi\Block\Adminhtml\Role\Edit\Tabs', array( - 'urlBuilder' => $urlBuilder, - 'layout' => $this->_layout, - 'request' => $this->_request - )); - } - - /** - * Test _construct method. - */ - public function testConstruct() - { - $this->assertEquals('page_tabs', $this->_block->getId()); - $this->assertEquals('edit_form', $this->_block->getDestElementId()); - $this->assertEquals('Role Information', $this->_block->getTitle()); - } - - /** - * Test for _beforeToHtml method. - * - * @dataProvider beforeToHtmlDataProvider - * @param object $apiRole - * @param array $expectedTabIds - */ - public function testBeforeToHtml($apiRole, $expectedTabIds) - { - $this->_block->setApiRole($apiRole); - - $mainBlock = $this->_helper->getObject('Magento\View\Element\Text'); - $resourceBlock = $this->_helper->getObject('Magento\View\Element\Text'); - $userBlock = $this->_helper->getObject('Magento\View\Element\Text'); - - $this->_layout->expects($this->any()) - ->method('getBlock') - ->will($this->returnValueMap(array( - array('webapi.role.edit.tab.main', $mainBlock), - array('webapi.role.edit.tab.resource', $resourceBlock), - array('webapi.role.edit.tab.users.grid', $userBlock), - ))); - - $this->_request->expects($this->any())->method('getParam')->will($this->returnValueMap(array( - array('active_tab', null, 'main_section') - ))); - - // TODO: do checks using toHtml() when DI is implemented for abstract blocks - $toHtmlMethod = new \ReflectionMethod($this->_block, '_beforeToHtml'); - $toHtmlMethod->setAccessible(true); - $toHtmlMethod ->invoke($this->_block); - - $this->assertEquals($expectedTabIds, $this->_block->getTabsIds()); - $this->assertEquals($apiRole, $mainBlock->getApiRole()); - $this->assertEquals($apiRole, $resourceBlock->getApiRole()); - } - - /** - * @return array - */ - public function beforeToHtmlDataProvider() - { - return array( - array( - new \Magento\Object(array( - 'role_id' => 1, - 'role_name' => 'some_role' - )), - array('main_section', 'resource_section', 'user_section'), - ) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php deleted file mode 100644 index 975d2519397d13d45c88f546768bcb94ac99c47d..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/Role/EditTest.php +++ /dev/null @@ -1,158 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Block\Adminhtml\Role\Edit - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\Role; - -class EditTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\App\RequestInterface|PHPUnit_Framework_MockObject_MockObject - */ - protected $_request; - - /** - * @var \Magento\Backend\Model\Url|PHPUnit_Framework_MockObject_MockObject - */ - protected $_urlBuilder; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Core\Helper\Data - */ - protected $_escaper; - - /** - * @var \Magento\Webapi\Block\Adminhtml\Role\Edit - */ - protected $_block; - - protected function setUp() - { - $this->_urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') - ->setMethods(array('getUrl')) - ->disableOriginalConstructor() - ->getMock(); - - $this->_request = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - - $this->_request->expects($this->any()) - ->method('getParam') - ->with('role_id') - ->will($this->returnValue(1)); - - $this->_escaper = $this->getMockBuilder('Magento\Escaper') - ->disableOriginalConstructor() - ->setMethods(array('escapeHtml')) - ->getMock(); - - $context = $this->getMockBuilder('Magento\Backend\Block\Template\Context') - ->disableOriginalConstructor() - ->setMethods(array('getEscaper', 'getUrlBuilder', 'getRequest')) - ->getMock(); - - $context->expects($this->any()) - ->method('getEscaper') - ->will($this->returnValue($this->_escaper)); - - $context->expects($this->any()) - ->method('getUrlBuilder') - ->will($this->returnValue($this->_urlBuilder)); - - $context->expects($this->any()) - ->method('getRequest') - ->will($this->returnValue($this->_request)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\Role\Edit', array( - 'context' => $context - )); - } - - /** - * Test _construct method. - */ - public function testConstruct() - { - $this->assertAttributeEquals('Magento_Webapi', '_blockGroup', $this->_block); - $this->assertAttributeEquals('adminhtml_role', '_controller', $this->_block); - $this->assertAttributeEquals('role_id', '_objectId', $this->_block); - $this->_assertBlockHasButton(1, 'save', 'Save API Role'); - $this->_assertBlockHasButton(0, 'delete', 'Delete API Role'); - } - - /** - * Test getSaveAndContinueUrl method. - */ - public function testGetSaveAndContinueUrl() - { - $expectedUrl = 'save_and_continue_url'; - $this->_urlBuilder - ->expects($this->once()) - ->method('getUrl') - ->with('adminhtml/*/save', array('_current' => true, 'continue' => true)) - ->will($this->returnValue($expectedUrl)); - - $this->assertEquals($expectedUrl, $this->_block->getSaveAndContinueUrl()); - } - - /** - * Test getHeaderText method. - */ - public function testGetHeaderText() - { - $apiRole = new \Magento\Object(); - $this->_block->setApiRole($apiRole); - $this->assertEquals('New API Role', $this->_block->getHeaderText()); - - $apiRole->setId(1)->setRoleName('Test Role'); - - $this->_escaper->expects($this->once()) - ->method('escapeHtml') - ->with($apiRole->getRoleName()) - ->will($this->returnArgument(0)); - - $this->assertEquals("Edit API Role 'Test Role'", $this->_block->getHeaderText()); - } - - /** - * Asserts that block has button with ID and label at level. - * - * @param int $level - * @param string $buttonId - * @param string $label - */ - protected function _assertBlockHasButton($level, $buttonId, $label) - { - $buttonsProperty = new \ReflectionProperty($this->_block, '_buttons'); - $buttonsProperty->setAccessible(true); - $buttons = $buttonsProperty->getValue($this->_block); - $this->assertInternalType('array', $buttons, 'Cannot get block buttons.'); - $this->assertArrayHasKey($level, $buttons, "Block doesn't have buttons at level $level"); - $this->assertArrayHasKey($buttonId, $buttons[$level], "Block doesn't have '$buttonId' button at level $level"); - $this->assertArrayHasKey('label', $buttons[$level][$buttonId], "Block button doesn't have label."); - $this->assertEquals($label, $buttons[$level][$buttonId]['label'], "Block button label has unexpected value."); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/RoleTest.php deleted file mode 100644 index 98283ab6d10252ebc6019fcc84017c0d9c7ab585..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/RoleTest.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Block\Adminhtml\Role - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml; - -class RoleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Backend\Model\Url|PHPUnit_Framework_MockObject_MockObject - */ - protected $_urlBuilder; - - /** - * @var \Magento\Webapi\Block\Adminhtml\Role - */ - protected $_block; - - protected function setUp() - { - $this->_urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') - ->disableOriginalConstructor() - ->getMock(); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\Role', array( - 'urlBuilder' => $this->_urlBuilder - )); - } - - /** - * Test _construct method. - */ - public function testConstruct() - { - $this->assertAttributeEquals('Magento_Webapi', '_blockGroup', $this->_block); - $this->assertAttributeEquals('adminhtml_role', '_controller', $this->_block); - $this->assertAttributeEquals('API Roles', '_headerText', $this->_block); - $this->_assertBlockHasButton(0, 'add', 'Add New API Role'); - } - - /** - * Test getCreateUrl method. - */ - public function testGetCreateUrl() - { - $expectedUrl = 'create_url'; - $this->_urlBuilder - ->expects($this->once()) - ->method('getUrl') - ->with('adminhtml/*/edit', array()) - ->will($this->returnValue($expectedUrl)); - - $this->assertEquals($expectedUrl, $this->_block->getCreateUrl()); - } - - /** - * Asserts that block has button with ID and label at level. - * - * @param int $level - * @param string $buttonId - * @param string $label - */ - protected function _assertBlockHasButton($level, $buttonId, $label) - { - $buttonsProperty = new \ReflectionProperty($this->_block, '_buttons'); - $buttonsProperty->setAccessible(true); - $buttons = $buttonsProperty->getValue($this->_block); - $this->assertInternalType('array', $buttons, 'Cannot get block buttons.'); - $this->assertArrayHasKey($level, $buttons, "Block doesn't have buttons at level $level"); - $this->assertArrayHasKey($buttonId, $buttons[$level], "Block doesn't have '$buttonId' button at level $level"); - $this->assertArrayHasKey('label', $buttons[$level][$buttonId], "Block button doesn't have label."); - $this->assertEquals($label, $buttons[$level][$buttonId]['label'], "Block button label has unexpected value."); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php deleted file mode 100644 index 189829aebe69850cae066134425ed69ea456c292..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/User/EditTest.php +++ /dev/null @@ -1,143 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Block\Adminhtml\User\Edit - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml\User; - -class EditTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\App\RequestInterface|PHPUnit_Framework_MockObject_MockObject - */ - protected $_request; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Escaper - */ - protected $_escaper; - - /** - * @var \Magento\Webapi\Block\Adminhtml\User\Edit - */ - protected $_block; - - protected function setUp() - { - $this->_request = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - - $this->_request->expects($this->any()) - ->method('getParam') - ->with('user_id') - ->will($this->returnValue(1)); - - $this->_escaper = $this->getMockBuilder('Magento\Escaper') - ->disableOriginalConstructor() - ->setMethods(array('escapeHtml')) - ->getMock(); - - $urlBuilder = $this->getMockBuilder('Magento\Backend\Model\Url') - ->setMethods(array('getUrl')) - ->disableOriginalConstructor() - ->getMock(); - - $context = $this->getMockBuilder('Magento\Backend\Block\Template\Context') - ->disableOriginalConstructor() - ->setMethods(array('getEscaper', 'getUrlBuilder', 'getRequest')) - ->getMock(); - - $context->expects($this->any()) - ->method('getEscaper') - ->will($this->returnValue($this->_escaper)); - - $context->expects($this->any()) - ->method('getUrlBuilder') - ->will($this->returnValue($urlBuilder)); - - $context->expects($this->any()) - ->method('getRequest') - ->will($this->returnValue($this->_request)); - - $objectManager = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $objectManager->getObject('Magento\Webapi\Block\Adminhtml\User\Edit', array( - 'context' => $context - )); - } - - /** - * Test _construct method. - */ - public function testConstruct() - { - $this->assertAttributeEquals('Magento_Webapi', '_blockGroup', $this->_block); - $this->assertAttributeEquals('adminhtml_user', '_controller', $this->_block); - $this->assertAttributeEquals('user_id', '_objectId', $this->_block); - $this->_assertBlockHasButton(1, 'save', 'label', 'Save API User'); - $this->_assertBlockHasButton(1, 'save', 'id', 'save_button'); - $this->_assertBlockHasButton(0, 'delete', 'label', 'Delete API User'); - } - - /** - * Test getHeaderText method. - */ - public function testGetHeaderText() - { - $apiUser = new \Magento\Object(); - $this->_block->setApiUser($apiUser); - $this->assertEquals('New API User', $this->_block->getHeaderText()); - - $apiUser->setId(1)->setApiKey('test-api'); - - $this->_escaper->expects($this->once()) - ->method('escapeHtml') - ->with($apiUser->getApiKey()) - ->will($this->returnArgument(0)); - - - $this->assertEquals("Edit API User 'test-api'", $this->_block->getHeaderText()); - } - - /** - * Asserts that block has button with ID and attribute at level. - * - * @param int $level - * @param string $buttonId - * @param string $attributeName - * @param string $attributeValue - */ - protected function _assertBlockHasButton($level, $buttonId, $attributeName, $attributeValue) - { - $buttonsProperty = new \ReflectionProperty($this->_block, '_buttons'); - $buttonsProperty->setAccessible(true); - $buttons = $buttonsProperty->getValue($this->_block); - $this->assertInternalType('array', $buttons, 'Cannot get block buttons.'); - $this->assertArrayHasKey($level, $buttons, "Block doesn't have buttons at level $level"); - $this->assertArrayHasKey($buttonId, $buttons[$level], "Block doesn't have '$buttonId' button at level $level"); - $this->assertArrayHasKey($attributeName, $buttons[$level][$buttonId], - "Block button doesn't have attribute $attributeName"); - $this->assertEquals($attributeValue, $buttons[$level][$buttonId][$attributeName], - "Block button $attributeName' has unexpected value."); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/UserTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/UserTest.php deleted file mode 100644 index faddcb74a7bdaf3a3e9488421fe8c64b738c033a..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Block/Adminhtml/UserTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Block\Adminhtml\User - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Block\Adminhtml; - -class UserTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Block\Adminhtml\User - */ - protected $_block; - - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('Magento\Webapi\Block\Adminhtml\User', array( - // TODO: Remove injecting of 'urlBuilder' after MAGENTOTWO-5038 complete - 'urlBuilder' => $this->getMockBuilder('Magento\Backend\Model\Url') - ->disableOriginalConstructor() - ->getMock(), - )); - } - - /** - * Test _construct method. - */ - public function testConstruct() - { - $this->assertAttributeEquals('Magento_Webapi', '_blockGroup', $this->_block); - $this->assertAttributeEquals('adminhtml_user', '_controller', $this->_block); - $this->assertAttributeEquals('API Users', '_headerText', $this->_block); - $this->_assertBlockHasButton(0, 'add', 'Add New API User'); - } - - /** - * Asserts that block has button with ID and label at level. - * - * @param int $level - * @param string $buttonId - * @param string $label - */ - protected function _assertBlockHasButton($level, $buttonId, $label) - { - $buttonsProperty = new \ReflectionProperty($this->_block, '_buttons'); - $buttonsProperty->setAccessible(true); - $buttons = $buttonsProperty->getValue($this->_block); - $this->assertInternalType('array', $buttons, 'Cannot get block buttons.'); - $this->assertArrayHasKey($level, $buttons, "Block doesn't have buttons at level $level"); - $this->assertArrayHasKey($buttonId, $buttons[$level], "Block doesn't have '$buttonId' button at level $level"); - $this->assertArrayHasKey('label', $buttons[$level][$buttonId], "Block button doesn't have label."); - $this->assertEquals($label, $buttons[$level][$buttonId]['label'], "Block button label has unexpected value."); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php index 0bd36e0d0075f248c3292f3bee2c6c8a985596a5..a6c70f4cf83a48ec7b40dafad93285d1290522fd 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/RestTest.php @@ -57,6 +57,9 @@ class RestTest extends \PHPUnit_Framework_TestCase /** @var \Magento\Oauth\Helper\Request */ protected $_oauthHelperMock; + /** @var \Magento\Authz\Service\AuthorizationV1Interface */ + protected $_authzServiceMock; + const SERVICE_METHOD = \Magento\Webapi\Model\Rest\Config::KEY_METHOD; const SERVICE_ID = \Magento\Webapi\Model\Rest\Config::KEY_CLASS; @@ -103,6 +106,10 @@ class RestTest extends \PHPUnit_Framework_TestCase ->disableOriginalConstructor() ->getMock(); + $this->_authzServiceMock = $this->getMockBuilder('Magento\Authz\Service\AuthorizationV1Interface') + ->disableOriginalConstructor() + ->getMock(); + /** Init SUT. */ $this->_restController = new \Magento\Webapi\Controller\Rest( $this->_requestMock, @@ -111,7 +118,8 @@ class RestTest extends \PHPUnit_Framework_TestCase $this->_objectManagerMock, $this->_appStateMock, $this->_oauthServiceMock, - $this->_oauthHelperMock + $this->_oauthHelperMock, + $this->_authzServiceMock ); // Set default expectations used by all tests @@ -156,18 +164,6 @@ class RestTest extends \PHPUnit_Framework_TestCase $this->assertEquals($expectedMsg, $exceptionArray[0]->getMessage()); } - /** - * Test dispatch method with \Exception throwing. - */ - public function testDispatchAuthenticationException() - { - $this->markTestIncomplete( - "Test should be fixed after \Magento\Webapi\Controller\Rest::dispatch() enforces authentication" - ); - $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); - $this->_serviceMock->expects($this->any())->method(self::SERVICE_METHOD)->will($this->returnValue(array())); - } - /** * Test Secure Request and Secure route combinations * @@ -180,6 +176,7 @@ class RestTest extends \PHPUnit_Framework_TestCase ->expects($this->any())->method(self::SERVICE_METHOD)->will($this->returnValue(array())); $this->_routeMock->expects($this->any())->method('isSecure')->will($this->returnValue($isSecureRoute)); $this->_requestMock->expects($this->any())->method('isSecure')->will($this->returnValue($isSecureRequest)); + $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true)); $this->_restController->dispatch($this->_requestMock); $this->assertFalse($this->_responseMock->isException()); } @@ -218,6 +215,7 @@ class RestTest extends \PHPUnit_Framework_TestCase $this->_serviceMock->expects($this->any())->method(self::SERVICE_METHOD)->will($this->returnValue(array())); $this->_routeMock->expects($this->any())->method('isSecure')->will($this->returnValue(true)); $this->_requestMock->expects($this->any())->method('isSecure')->will($this->returnValue(false)); + $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true)); // Override default prepareResponse. It should never be called in this case $this->_responseMock->expects($this->never())->method('prepareResponse'); @@ -238,6 +236,7 @@ class RestTest extends \PHPUnit_Framework_TestCase $this->_serviceMock->expects($this->any())->method(self::SERVICE_METHOD)->will($this->returnValue("invalid")); $this->_routeMock->expects($this->any())->method('isSecure')->will($this->returnValue(false)); $this->_requestMock->expects($this->any())->method('isSecure')->will($this->returnValue(false)); + $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true)); // Override default prepareResponse. It should never be called in this case $this->_responseMock->expects($this->never())->method('prepareResponse'); @@ -250,4 +249,17 @@ class RestTest extends \PHPUnit_Framework_TestCase $exceptionArray = $this->_responseMock->getException(); $this->assertEquals($expectedMsg, $exceptionArray[0]->getMessage()); } + + public function testAuthorizationFailed() + { + $this->_appStateMock->expects($this->any())->method('isInstalled')->will($this->returnValue(true)); + $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(false)); + + $this->_restController->dispatch($this->_requestMock); + /** Ensure that response contains proper error message. */ + $expectedMsg = 'Not Authorized.'; + $this->assertTrue($this->_responseMock->isException()); + $exceptionArray = $this->_responseMock->getException(); + $this->assertEquals($expectedMsg, $exceptionArray[0]->getMessage()); + } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/HandlerTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/HandlerTest.php index fd54f3a7887e59aa8546cd0c337d3962a90149b6..127bb4b0150d71eaa72ffa6e72afa387a0d47bad 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/HandlerTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Controller/Soap/HandlerTest.php @@ -1,7 +1,5 @@ <?php /** - * Test for \Magento\Webapi\Controller\Soap\Handler. - * * Magento * * NOTICE OF LICENSE @@ -23,202 +21,115 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ + namespace Magento\Webapi\Controller\Soap; +/** + * Test for \Magento\Webapi\Controller\Soap\Handler. + */ class HandlerTest extends \PHPUnit_Framework_TestCase { /** @var \Magento\Webapi\Controller\Soap\Handler */ protected $_handler; - /** @var \Magento\Core\Model\App */ - protected $_appMock; - /** @var \Magento\ObjectManager */ protected $_objectManagerMock; - /** @var \Magento\Webapi\Controller\Soap\Security */ - protected $_soapSecurityMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ protected $_apiConfigMock; - /** @var \PHPUnit_Framework_MockObject_MockObject */ + /** @var \Magento\Webapi\Controller\Soap\Request */ protected $_requestMock; + /** @var \PHPUnit_Framework_MockObject_MockObject */ + protected $_authzServiceMock; + /** @var array */ protected $_arguments; protected function setUp() { - $this->markTestIncomplete("Needs to be fixed after service layer implementation."); /** Prepare mocks for SUT constructor. */ $this->_apiConfigMock = $this->getMockBuilder('Magento\Webapi\Model\Soap\Config') ->setMethods( - array( - 'getServiceNameByOperation', - 'getControllerClassByOperationName', - 'getMethodNameByOperation', - ) + array('getServiceMethodInfo') )->disableOriginalConstructor() ->getMock(); + $this->_requestMock = $this->getMockBuilder('Magento\Webapi\Controller\Soap\Request') ->setMethods(array('getRequestedServices')) ->disableOriginalConstructor() ->getMock(); - $this->_appMock = $this->getMockBuilder('Magento\Core\Model\App')->disableOriginalConstructor()->getMock(); - $this->_objectManagerMock = $this->getMockBuilder('Magento\ObjectManager')->disableOriginalConstructor() + $this->_objectManagerMock = $this->getMockBuilder('Magento\ObjectManager') + ->disableOriginalConstructor() + ->getMock(); + + $this->_authzServiceMock = $this->getMockBuilder('Magento\Authz\Service\AuthorizationV1Interface') + ->disableOriginalConstructor() ->getMock(); - $this->_soapSecurityMock = $this->getMockBuilder('Magento\Webapi\Controller\Soap\Security') - ->disableOriginalConstructor()->getMock(); /** Initialize SUT. */ $this->_handler = new \Magento\Webapi\Controller\Soap\Handler( - $this->_appMock, $this->_requestMock, $this->_objectManagerMock, $this->_apiConfigMock, - $this->_soapSecurityMock + $this->_authzServiceMock ); + parent::setUp(); } protected function tearDown() { unset($this->_handler); + unset($this->_objectManagerMock); unset($this->_apiConfigMock); unset($this->_requestMock); + unset($this->_authzServiceMock); parent::tearDown(); } - public function testCallEmptyUsernameTokenException() - { - /** Prepare mocks for SUT constructor. */ - $this->_handler->setRequestHeaders(array('invalidHeader')); - $this->setExpectedException( - 'Magento\Webapi\Model\Soap\Fault', - 'WS-Security UsernameToken is not found in SOAP-request.' - ); - /** Execute SUT. */ - $this->_handler->__call('operation', array()); - } - - public function testCallMethodNotFoundException() - { - /** Prepare mock for _getOperationVersion() method. */ - $this->_requestMock->expects($this->once()) - ->method('getRequestedServices') - ->will($this->returnValue(array('serviceName' => 'v1'))); - /** Create the arguments map of returned values for getServiceNameByOperation() method. */ - $getServiceValueMap = array( - array('operation', null, 'serviceName'), - array('operation', 'v1', false) - ); - $this->_apiConfigMock->expects($this->any()) - ->method('getServiceNameByOperation') - ->will($this->returnValueMap($getServiceValueMap)); - $this->setExpectedException( - 'Magento\Webapi\Model\Soap\Fault', - 'Method "operation" is not found.' - ); - /** Execute SUT. */ - $this->_prepareSoapRequest(); - $this->_handler->__call('operation', $this->_arguments); - } - - public function testCallInvalidOperationVersionException() - { - /** Prepare mock for _getOperationVersion() method. */ - $this->_requestMock->expects($this->once()) - ->method('getRequestedServices') - ->will($this->returnValue(array('serviceName' => 'v1'))); - $this->_apiConfigMock->expects($this->once()) - ->method('getServiceNameByOperation') - ->will($this->returnValue(false)); - $this->setExpectedException( - 'Magento\Webapi\Model\Soap\Fault', - 'The version of "operationName" operation cannot be identified.' - ); - /** Execute SUT. */ - $this->_prepareSoapRequest(); - $this->_handler->__call('operationName', $this->_arguments); - } - public function testCall() { - /** Prepare mock for SUT. */ - $this->_prepareSoapRequest(); - $method = 'Get'; - $service = 'serviceName'; - $operation = $service . $method; + $requestedServices = array('requestedServices'); $this->_requestMock->expects($this->once()) ->method('getRequestedServices') - ->will($this->returnValue(array($service => 'v1'))); - $this->_apiConfigMock->expects($this->any()) - ->method('getServiceNameByOperation') - ->will($this->returnValue($service)); - $this->_apiConfigMock->expects($this->once()) - ->method('validateVersionNumber') - ->with(1, $service); - $versionAfterFallback = 'V1'; - $action = $method . $versionAfterFallback; + ->will($this->returnValue($requestedServices)); + $operationName = 'soapOperation'; + $className = 'Magento\Object'; + $methodName = 'testMethod'; + $isSecure = false; + $aclResources = array('Magento_TestModule::resourceA'); $this->_apiConfigMock->expects($this->once()) - ->method('getControllerClassByOperationName') - ->with($operation) - ->will($this->returnValue('Vendor\Module\Controller\Webapi\Resource')); - $controllerMock = $this->getMockBuilder('Vendor\Module\Controller\Webapi\Resource') + ->method('getServiceMethodInfo') + ->with($operationName, $requestedServices) + ->will( + $this->returnValue( + array( + \Magento\Webapi\Model\Soap\Config::KEY_CLASS => $className, + \Magento\Webapi\Model\Soap\Config::KEY_METHOD => $methodName, + \Magento\Webapi\Model\Soap\Config::KEY_IS_SECURE => $isSecure, + \Magento\Webapi\Model\Soap\Config::KEY_ACL_RESOURCES => $aclResources + ) + ) + ); + + $this->_authzServiceMock->expects($this->once())->method('isAllowed')->will($this->returnValue(true)); + $serviceMock = $this->getMockBuilder($className) ->disableOriginalConstructor() - ->setMethods(array($action)) + ->setMethods(array($methodName)) ->getMock(); - $this->_apiConfigMock->expects($this->once()) - ->method('getMethodNameByOperation') - ->with($operation, '1') - ->will($this->returnValue($method)); - $this->_apiConfigMock->expects($this->once()) - ->method('identifyVersionSuffix') - ->with($operation, '1', $controllerMock) - ->will($this->returnValue($versionAfterFallback)); - $this->_apiConfigMock->expects($this->once()) - ->method('checkDeprecationPolicy') - ->with($service, $method, $versionAfterFallback); - $arguments = reset($this->_arguments); - $arguments = get_object_vars($arguments); + $expectedResult = array('foo' => 'bar'); - $controllerMock->expects($this->once()) - ->method($action) - ->with($arguments['customerId']) - ->will($this->returnValue($expectedResult)); + $serviceMock->expects($this->once())->method($methodName)->will($this->returnValue($expectedResult)); + $this->_objectManagerMock->expects($this->once())->method('get')->with($className) + ->will($this->returnValue($serviceMock)); /** Execute SUT. */ $this->assertEquals( - (object)array(\Magento\Webapi\Controller\Soap\Handler::RESULT_NODE_NAME => $expectedResult), - $this->_handler->__call($operation, $this->_arguments) - ); - } - - /** - * Process security header and prepare request arguments. - */ - protected function _prepareSoapRequest() - { - /** Process security header by __call() method. */ - $this->_handler->setRequestHeaders(array(\Magento\Webapi\Controller\Soap\Security::HEADER_SECURITY)); - $usernameToken = new \stdClass(); - // @codingStandardsIgnoreStart - $usernameToken->UsernameToken = new \stdClass(); - $usernameToken->UsernameToken->Username = 'username'; - $usernameToken->UsernameToken->Password = 'password'; - $usernameToken->UsernameToken->Nonce = 'nonce'; - $usernameToken->UsernameToken->Created = 'created'; - // @codingStandardsIgnoreEnd - $this->_handler->__call( - \Magento\Webapi\Controller\Soap\Security::HEADER_SECURITY, - array($usernameToken) + $expectedResult, + $this->_handler->__call($operationName, array((object)array('field' => 1))) ); - - /** Override arguments for process action header. */ - $request = new \stdClass(); - $request->customerId = 1; - $this->_arguments = array($request); } } diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/DomTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/DomTest.php deleted file mode 100644 index 4711e7be63ed17c204a2ed239d55ee0124a62aa6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/DomTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource\Config\Converter; - -class DomTest extends \Magento\Acl\Resource\Config\Converter\DomTest -{ - protected function setUp() - { - $this->_converter = new \Magento\Webapi\Model\Acl\Resource\Config\Converter\Dom(); - } - - /** - * @return array - */ - public function convertWithValidDomDataProvider() - { - return array( - array( - include __DIR__ . DIRECTORY_SEPARATOR . '_files' - . DIRECTORY_SEPARATOR . 'converted_valid_webapi_acl.php', - file_get_contents( - __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'valid_webapi_acl.xml' - ), - ), - ); - } - - /** - * @return array - */ - public function convertWithInvalidDomDataProvider() - { - return array_merge( - parent::convertWithInvalidDomDataProvider(), - array( - array( - 'mapping without "id" attribute' => '<?xml version="1.0"?><config><mapping>' - . '<resource parent="Custom_Module::parent_id" /></mapping></config>' - ), - array( - 'mapping without "parent" attribute' => '<?xml version="1.0"?><config><mapping>' - . '<resource id="Custom_Module::id" /></mapping></config>' - ), - ) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/converted_valid_webapi_acl.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/converted_valid_webapi_acl.php deleted file mode 100644 index 5fdbf756e2d654a4aafefc4409fdc069268d5b3d..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/converted_valid_webapi_acl.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -return array( - 'config' => array( - 'acl' => array( - 'resources' => array( - array( - 'id' => 'Custom_Module::resource_one', - 'title' => 'Resource One Title', - 'sortOrder' => 20, - 'disabled' => false, - 'children' => array(), - ), - ), - ), - 'mapping' => array( - array( - 'id' => 'Custom_Module::resource_child', - 'parent' => 'Custom_Module::parent_resource', - ), - array( - 'id' => 'Custom_Module::resource_two', - 'parent' => 'Custom_Module::resource_one', - ), - ), - ), -); diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/valid_webapi_acl.xml b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/valid_webapi_acl.xml deleted file mode 100644 index 890f42e5f80df3dfda4c136eb2f8ac4080a9f4cf..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/Converter/_files/valid_webapi_acl.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Framework - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <mapping> - <!-- commented text --> - <resource id="Custom_Module::resource_child" parent="Custom_Module::parent_resource" /> - <resource id="Custom_Module::resource_two" parent="Custom_Module::resource_one" /> - </mapping> - <acl> - <resources> - <!-- commented text --> - <resource id="Custom_Module::resource_one" title="Resource One Title" sortOrder="20" /> - </resources> - </acl> -</config> diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php deleted file mode 100644 index 7409022424dd4b697159a53de8ed892299fdadae..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/Config/SchemaLocatorTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource\Config; - -class SchemaLocatorTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_moduleReaderMock; - - /** - * @var \Magento\Webapi\Model\Acl\Resource\Config\SchemaLocator - */ - protected $_model; - - protected function setUp() - { - $this->_moduleReaderMock = $this->getMock( - 'Magento\Module\Dir\Reader', array(), array(), '', false - ); - $this->_moduleReaderMock->expects($this->once()) - ->method('getModuleDir')->with('etc', 'Magento_Webapi')->will($this->returnValue('schema_dir')); - $this->_model = new \Magento\Webapi\Model\Acl\Resource\Config\SchemaLocator($this->_moduleReaderMock); - } - - public function testGetSchema() - { - $this->assertEquals('schema_dir' . DIRECTORY_SEPARATOR . 'acl.xsd', $this->_model->getSchema()); - } - - public function testGetPerFileSchema() - { - $this->assertEquals(null, $this->_model->getPerFileSchema()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/ProviderTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/ProviderTest.php deleted file mode 100644 index c4720bd8437c6b1ab435dcfcd66b5cb5b39e1907..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Resource/ProviderTest.php +++ /dev/null @@ -1,70 +0,0 @@ -<?php -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Resource; - -class ProviderTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Acl\Resource\Provider - */ - protected $_model; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configReaderMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_configScopeMock; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_treeBuilderMock; - - protected function setUp() - { - $this->_configReaderMock = $this->getMock( - 'Magento\Webapi\Model\Acl\Resource\Config\Reader\Filesystem', array(), array(), '', false - ); - $this->_configScopeMock = $this->getMock('Magento\Config\ScopeInterface'); - $this->_treeBuilderMock = - $this->getMock('Magento\Acl\Resource\TreeBuilder', array(), array(), '', false); - $this->_model = new \Magento\Webapi\Model\Acl\Resource\Provider( - $this->_configReaderMock, - $this->_configScopeMock, - $this->_treeBuilderMock - ); - } - - public function testGetAclVirtualResources() - { - $aclResourceConfig['config']['mapping'] = array('ExpectedValue'); - $this->_configReaderMock->expects($this->once()) - ->method('read')->with(null)->will($this->returnValue($aclResourceConfig)); - $this->assertEquals($aclResourceConfig['config']['mapping'], $this->_model->getAclVirtualResources()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/FactoryTest.php deleted file mode 100644 index 7dda4a2c89554761a67499eb47c8f6aae3e4721e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/FactoryTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\Role\Factory. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Acl\Role\Factory - */ - protected $_model; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Acl\Role - */ - protected $_expectedObject; - - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - - $this->_expectedObject = $this->getMockBuilder('Magento\Webapi\Model\Acl\Role') - ->disableOriginalConstructor() - ->getMock(); - - $this->_model = $helper->getObject('Magento\Webapi\Model\Acl\Role\Factory', array( - 'objectManager' => $this->_objectManager, - )); - } - - /** - * Test create method. - */ - public function testCreate() - { - $arguments = array('property' => 'value'); - $this->_objectManager->expects($this->once()) - ->method('create') - ->with('Magento\Webapi\Model\Acl\Role', $arguments) - ->will($this->returnValue($this->_expectedObject)); - $this->assertEquals($this->_expectedObject, $this->_model->create($arguments)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/InRoleUserUpdaterTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/InRoleUserUpdaterTest.php deleted file mode 100644 index bae65f936186aeea08042c37a078a7b1b0dd4fb1..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/InRoleUserUpdaterTest.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\Role\InRoleUserUpdater. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class InRoleUserUpdaterTest extends \PHPUnit_Framework_TestCase -{ - public function testUpdate() - { - $roleId = 5; - $expectedValues = array(7, 8, 9); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $request = $this->getMockBuilder('Magento\App\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); - $request->expects($this->any())->method('getParam')->will($this->returnValueMap(array( - array('role_id', null, $roleId) - ))); - - $userResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\User') - ->disableOriginalConstructor() - ->getMock(); - $userResource->expects($this->once())->method('getRoleUsers') - ->with($roleId)->will($this->returnValue($expectedValues)); - - /** @var \Magento\Webapi\Model\Acl\Role\InRoleUserUpdater $model */ - $model = $helper->getObject('Magento\Webapi\Model\Acl\Role\InRoleUserUpdater', array( - 'request' => $request, - 'userResource' => $userResource - )); - - $this->assertEquals($expectedValues, $model->update(array())); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/UsersUpdaterTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/UsersUpdaterTest.php deleted file mode 100644 index d23f30d099733be45420fb792ac4fc30e30e9901..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/Role/UsersUpdaterTest.php +++ /dev/null @@ -1,138 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\Role\UsersUpdater - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\Role; - -class UsersUpdaterTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \Magento\Backend\Helper\Data|PHPUnit_Framework_MockObject_MockObject - */ - protected $_backendHelper; - - /** - * @var \Magento\App\RequestInterface|PHPUnit_Framework_MockObject_MockObject - */ - protected $_request; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\User\Collection|PHPUnit_Framework_MockObject_MockObject - */ - protected $_collection; - - protected function setUp() - { - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_backendHelper = $this->getMockBuilder('Magento\Backend\Helper\Data') - ->disableOriginalConstructor() - ->setMethods(array('prepareFilterString')) - ->getMock(); - $this->_backendHelper->expects($this->any())->method('prepareFilterString')->will($this->returnArgument(0)); - - $this->_request = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - $this->_collection = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\User\Collection') - ->disableOriginalConstructor() - ->getMock(); - } - - /** - * @dataProvider updateDataProvider - * @param int $roleId - * @param array $filters - * @param bool $isAjax - * @param mixed $param - */ - public function testUpdate($roleId, $filters, $isAjax, $param) - { - $this->_request->expects($this->any())->method('getParam')->will($this->returnValueMap(array( - array('role_id', null, $roleId), - array('filter', '', $filters), - ))); - $this->_request->expects($this->any())->method('isAjax')->will($this->returnValue($isAjax)); - - if ($param) { - $this->_collection->expects($this->once())->method('addFieldToFilter')->with('role_id', $param); - } else { - $this->_collection->expects($this->never())->method('addFieldToFilter'); - } - - /** @var \Magento\Webapi\Model\Acl\Role\UsersUpdater $model */ - $model = $this->_helper->getObject('Magento\Webapi\Model\Acl\Role\UsersUpdater', array( - 'request' => $this->_request, - 'backendHelper' => $this->_backendHelper - )); - $this->assertEquals($this->_collection, $model->update($this->_collection)); - } - - /** - * @return array - */ - public function updateDataProvider() - { - return array( - 'Yes' => array( - 3, - array('in_role_users' => 1), - true, - 3 - ), - 'No' => array( - 4, - array('in_role_users' => 0), - true, - array( - array('neq' => 4), - array('is' => 'NULL') - ) - ), - 'Any' => array( - 5, - array(), - true, - null - ), - 'Yes_on_ajax' => array( - 6, - array(), - false, - 6 - ), - 'Any_without_role_id' => array( - null, - array('in_role_users' => 1), - true, - null - ) - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php deleted file mode 100644 index 1717286cf8b523a3db39f4f52fe0d8b787332af6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RoleTest.php +++ /dev/null @@ -1,122 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\User - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class RoleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\Role|PHPUnit_Framework_MockObject_MockObject - */ - protected $_roleService; - - protected function setUp() - { - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - - $this->_roleService = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Role') - ->disableOriginalConstructor() - ->setMethods(array('getIdFieldName', 'getReadConnection', '__wakeup')) - ->getMock(); - - $this->_roleService->expects($this->any()) - ->method('getIdFieldName') - ->withAnyParameters() - ->will($this->returnValue('id')); - - $this->_roleService->expects($this->any()) - ->method('getReadConnection') - ->withAnyParameters() - ->will($this->returnValue($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))); - } - - /** - * Create Role model. - * - * @param \Magento\Webapi\Model\Resource\Acl\Role $roleService - * @param \Magento\Webapi\Model\Resource\Acl\Role_Collection $serviceCollection - * @return \Magento\Webapi\Model\Acl\Role - */ - protected function _createModel($roleService, $serviceCollection = null) - { - return $this->_helper->getObject('Magento\Webapi\Model\Acl\Role', array( - 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), - 'resource' => $roleService, - 'resourceCollection' => $serviceCollection - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel($this->_roleService); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\Role', '_resourceName', $model); - $this->assertAttributeEquals('id', '_idFieldName', $model); - } - - /** - * Test GET collection and _construct - */ - public function testGetCollection() - { - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - - /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ - $collection = $this->getMock( - 'Magento\Webapi\Model\Resource\Acl\Role\Collection', - array('_initSelect', 'setModel'), - array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $this->_roleService) - ); - - $collection->expects($this->any())->method('setModel')->with('Magento\Webapi\Model\Resource\Acl\Role'); - - $model = $this->_createModel($this->_roleService, $collection); - $result = $model->getCollection(); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\Role', '_resourceModel', $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php deleted file mode 100644 index 981d84710ed7deaa835d93918e4a2e3fd0ca638b..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/RuleTest.php +++ /dev/null @@ -1,146 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\Rule - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class RuleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule|PHPUnit_Framework_MockObject_MockObject - */ - protected $_ruleResource; - - protected function setUp() - { - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - - $this->_ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') - ->disableOriginalConstructor() - ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection', '__wakeup')) - ->getMock(); - - $this->_ruleResource->expects($this->any()) - ->method('getIdFieldName') - ->withAnyParameters() - ->will($this->returnValue('id')); - - $this->_ruleResource->expects($this->any()) - ->method('getReadConnection') - ->withAnyParameters() - ->will($this->returnValue($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))); - } - - /** - * Create Rule model. - * - * @param \Magento\Webapi\Model\Resource\Acl\Rule|PHPUnit_Framework_MockObject_MockObject $ruleResource - * @param \Magento\Webapi\Model\Resource\Acl\User\Collection $resourceCollection - * @return \Magento\Webapi\Model\Acl\Rule - */ - protected function _createModel($ruleResource, $resourceCollection = null) - { - return $this->_helper->getObject('Magento\Webapi\Model\Acl\Rule', array( - 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), - 'resource' => $ruleResource, - 'resourceCollection' => $resourceCollection - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel($this->_ruleResource); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\Rule', '_resourceName', $model); - $this->assertAttributeEquals('id', '_idFieldName', $model); - } - - /** - * Test getRoleUsers() method. - */ - public function testGetRoleUsers() - { - $this->_ruleResource->expects($this->once()) - ->method('saveResources') - ->withAnyParameters() - ->will($this->returnSelf()); - - $model = $this->_createModel($this->_ruleResource); - $result = $model->saveResources(); - $this->assertInstanceOf('Magento\Webapi\Model\Acl\Rule', $result); - } - - /** - * Test GET collection and _construct - */ - public function testGetCollection() - { - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - - /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ - $collection = $this->getMock( - 'Magento\Webapi\Model\Resource\Acl\Rule\Collection', - array('_initSelect', 'setModel', 'getSelect'), - array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $this->_ruleResource) - ); - $collection->expects($this->any())->method('setModel')->with('Magento\Webapi\Model\Resource\Acl\Role'); - $collection->expects($this->any()) - ->method('getSelect') - ->withAnyParameters() - ->will($this->returnValue($this->getMock('Magento\DB\Select', array(), array(), '', false))); - - $model = $this->_createModel($this->_ruleResource, $collection); - - // Test _construct - $result = $model->getCollection(); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\Rule', '_resourceModel', $result); - - // Test getByRole - $resultColl = $result->getByRole(1); - $this->assertInstanceOf('Magento\Webapi\Model\Resource\Acl\Rule\Collection', $resultColl); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/FactoryTest.php deleted file mode 100644 index 0166c2d26a767148b9fd0cedede7b79183e98d10..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/FactoryTest.php +++ /dev/null @@ -1,75 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\User\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\User; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Acl\User\Factory - */ - protected $_model; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Acl\User - */ - protected $_expectedObject; - - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - - $this->_expectedObject = $this->getMockBuilder('Magento\Webapi\Model\Acl\User') - ->disableOriginalConstructor() - ->getMock(); - - $this->_model = $helper->getObject('Magento\Webapi\Model\Acl\User\Factory', array( - 'objectManager' => $this->_objectManager, - )); - } - - /** - * Test create method. - */ - public function testCreate() - { - $arguments = array('property' => 'value'); - $this->_objectManager->expects($this->once()) - ->method('create') - ->with('Magento\Webapi\Model\Acl\User', $arguments) - ->will($this->returnValue($this->_expectedObject)); - $this->assertEquals($this->_expectedObject, $this->_model->create($arguments)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php deleted file mode 100644 index 39e93a96f109a28cc79202421ae1f6fdf08976d5..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/User/RoleUpdaterTest.php +++ /dev/null @@ -1,68 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\User\RoleUpdater - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl\User; - -class RoleUpdaterTest extends \PHPUnit_Framework_TestCase -{ - public function testUpdate() - { - $userId = 5; - $expectedRoleId = 3; - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $request = $this->getMockBuilder('Magento\App\RequestInterface') - ->disableOriginalConstructor() - ->getMock(); - $request->expects($this->any())->method('getParam')->will($this->returnValueMap(array( - array('user_id', null, $userId) - ))); - - $userModel = $this->getMockBuilder('Magento\Webapi\Model\Acl\User') - ->setMethods(array('getRoleId', 'load', '__wakeup')) - ->disableOriginalConstructor() - ->getMock(); - $userModel->expects($this->once())->method('load') - ->with($userId, null)->will($this->returnSelf()); - $userModel->expects($this->once())->method('getRoleId') - ->with()->will($this->returnValue($expectedRoleId)); - - $userFactory = $this->getMockBuilder('Magento\Webapi\Model\Acl\User\Factory') - ->setMethods(array('create')) - ->disableOriginalConstructor() - ->getMock(); - $userFactory->expects($this->once())->method('create') - ->with(array())->will($this->returnValue($userModel)); - - /** @var \Magento\Webapi\Model\Acl\Role\InRoleUserUpdater $model */ - $model = $helper->getObject('Magento\Webapi\Model\Acl\User\RoleUpdater', array( - 'request' => $request, - 'userFactory' => $userFactory - )); - - $this->assertEquals($expectedRoleId, $model->update(array())); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php deleted file mode 100644 index 90dfa12a5cd9afcf99865bd6f622fa0ce49f463a..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Acl/UserTest.php +++ /dev/null @@ -1,168 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Acl\User - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Acl; - -class UserTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Resource\Acl\User|PHPUnit_Framework_MockObject_MockObject - */ - protected $_userService; - - protected function setUp() - { - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - - $this->_userService = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\User') - ->disableOriginalConstructor() - ->setMethods(array('getIdFieldName', 'getRoleUsers', 'load', 'getReadConnection', '__wakeup')) - ->getMock(); - - $this->_userService->expects($this->any()) - ->method('getIdFieldName') - ->withAnyParameters() - ->will($this->returnValue('id')); - - $this->_userService->expects($this->any()) - ->method('getReadConnection') - ->withAnyParameters() - ->will($this->returnValue($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))); - } - - /** - * Create User model. - * - * @param \Magento\Webapi\Model\Resource\Acl\User $userService - * @param \Magento\Webapi\Model\Resource\Acl\User_Collection $serviceCollection - * @return \Magento\Webapi\Model\Acl\User - */ - protected function _createModel($userService, $serviceCollection = null) - { - return $this->_helper->getObject('Magento\Webapi\Model\Acl\User', array( - 'eventDispatcher' => $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false), - 'cacheManager' => $this->getMock('Magento\App\CacheInterface', array(), array(), '', false), - 'resource' => $userService, - 'resourceCollection' => $serviceCollection - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel($this->_userService); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\User', '_resourceName', $model); - $this->assertAttributeEquals('id', '_idFieldName', $model); - } - - /** - * Test getRoleUsers() method. - */ - public function testGetRoleUsers() - { - $this->_userService->expects($this->once()) - ->method('getRoleUsers') - ->with(1) - ->will($this->returnValue(array(1))); - - $model = $this->_createModel($this->_userService); - - $result = $model->getRoleUsers(1); - - $this->assertEquals(array(1), $result); - } - - /** - * Test loadByKey() method. - */ - public function testLoadByKey() - { - $this->_userService->expects($this->once()) - ->method('load') - ->with($this->anything(), 'key', 'api_key') - ->will($this->returnSelf()); - - $model = $this->_createModel($this->_userService); - - $result = $model->loadByKey('key'); - $this->assertInstanceOf('Magento\Webapi\Model\Acl\User', $result); - } - - /** - * Test public getters. - */ - public function testPublicGetters() - { - $model = $this->_createModel($this->_userService); - - $model->setData('secret', 'secretKey'); - - $this->assertEquals('secretKey', $model->getSecret()); - $this->assertEquals('', $model->getCallBackUrl()); - } - - /** - * Test GET collection and _construct - */ - public function testGetCollection() - { - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $fetchStrategy = $this->getMockForAbstractClass('Magento\Data\Collection\Db\FetchStrategyInterface'); - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - - /** @var \PHPUnit_Framework_MockObject_MockObject $collection */ - $collection = $this->getMock( - 'Magento\Webapi\Model\Resource\Acl\User\Collection', - array('_initSelect', 'setModel'), - array($entityFactory, $logger, $fetchStrategy, $eventManager, null, $this->_userService) - ); - - $collection->expects($this->any())->method('setModel')->with('Magento\Webapi\Model\Acl\User'); - - $model = $this->_createModel($this->_userService, $collection); - $result = $model->getCollection(); - - $this->assertAttributeEquals('Magento\Webapi\Model\Resource\Acl\User', '_resourceModel', $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/ResourceTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/ResourceTest.php deleted file mode 100644 index 833899981fdb62ab96f3d648f40d5a5fddfc5284..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/ResourceTest.php +++ /dev/null @@ -1,135 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Authorization\Loader\Resource - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -class ResourceTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Authorization\Loader\Resource - */ - protected $_model; - - /** - * @var \Magento\Acl - */ - protected $_acl; - - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_resourceProvider; - - /** - * Set up before test. - */ - protected function setUp() - { - $fixturePath = __DIR__ . '/../../_files/'; - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $resource = new \Magento\Acl\Resource('test resource'); - - /** @var $resourceFactory \Magento\Acl\ResourceFactory */ - $resourceFactory = $this->getMock('Magento\Acl\ResourceFactory', - array('createResource'), array(), '', false); - $resourceFactory->expects($this->any()) - ->method('createResource') - ->will($this->returnValue($resource)); - - $this->_resourceProvider = $this->getMock('Magento\Webapi\Model\Acl\Resource\ProviderInterface'); - $this->_resourceProvider->expects($this->once()) - ->method('getAclResources') - ->will($this->returnValue(include $fixturePath . 'acl.php')); - - $this->_model = $this->_helper->getObject('Magento\Webapi\Model\Authorization\Loader\Resource', array( - 'resourceFactory' => $resourceFactory, - 'resourceProvider' => $this->_resourceProvider, - )); - - $this->_acl = $this->getMock( - 'Magento\Acl', array('has', 'addResource', 'deny', 'getResources'), array(), '', false - ); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Resource::populateAcl. - */ - public function testPopulateAcl() - { - $aclFilePath = __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' - . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'acl.xml'; - $aclDom = new \DOMDocument(); - $aclDom->loadXML(file_get_contents($aclFilePath)); - $domConverter = new \Magento\Webapi\Model\Acl\Resource\Config\Converter\Dom(); - $aclResourceConfig = $domConverter->convert($aclDom); - - $this->_resourceProvider->expects($this->once()) - ->method('getAclVirtualResources') - ->will($this->returnValue($aclResourceConfig['config']['mapping'])); - - $this->_acl->expects($this->once()) - ->method('getResources') - ->will($this->returnValue(array('customer/get', 'customer/create'))); - $this->_acl->expects($this->exactly(2)) - ->method('deny') - ->with(null, $this->logicalOr('customer/get', 'customer/create')); - $this->_acl->expects($this->exactly(2)) - ->method('has') - ->with($this->logicalOr('customer/get', 'customer/list')) - ->will($this->returnValueMap(array( - array('customer/get', true), - array('customer/list', false) - ))); - $this->_acl->expects($this->exactly(7)) - ->method('addResource'); - - $this->_model->populateAcl($this->_acl); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Resource::populateAcl with invalid Virtual resources DOM. - */ - public function testPopulateAclWithInvalidDOM() - { - $this->_resourceProvider->expects($this->once()) - ->method('getAclVirtualResources') - ->will($this->returnValue(array())); - - $this->_acl->expects($this->once()) - ->method('getResources') - ->will($this->returnValue(array('customer/get', 'customer/list'))); - $this->_acl->expects($this->exactly(2)) - ->method('deny') - ->with(null, $this->logicalOr('customer/get', 'customer/list')); - - $this->_model->populateAcl($this->_acl); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php deleted file mode 100644 index 7a9f10ce4c016a8785de0c7cc380cafd764b6d0f..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RoleTest.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Authorization\Loader\Role - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -class RoleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Role - */ - protected $_resourceModelMock; - - /** - * @var \Magento\Webapi\Model\Authorization\Loader\Role - */ - protected $_model; - - /** - * @var \Magento\Webapi\Model\Authorization\Role\Factory - */ - protected $_roleFactory; - - /** - * @var \Magento\Acl - */ - protected $_acl; - - /** - * Set up before test. - */ - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_resourceModelMock = $this->getMock('Magento\Webapi\Model\Resource\Acl\Role', - array('getRolesIds', '__wakeup'), array(), '', false); - - $this->_roleFactory = $this->getMock('Magento\Webapi\Model\Authorization\Role\Factory', - array('createRole'), array(), '', false); - - $this->_acl = $this->getMock('Magento\Acl', array('addRole', 'deny'), array(), '', - false); - - $this->_model = $helper->getObject('Magento\Webapi\Model\Authorization\Loader\Role', array( - 'roleResource' => $this->_resourceModelMock, - 'roleFactory' => $this->_roleFactory, - )); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Role::populateAcl. - * - * Test with existing role IDs. - */ - public function testPopulateAclWithRoles() - { - $roleOne = new \Magento\Webapi\Model\Authorization\Role(3); - $roleTwo = new \Magento\Webapi\Model\Authorization\Role(4); - $roleIds = array(3, 4); - $createRoleMap = array( - array(array('roleId' => 3), $roleOne), - array(array('roleId' => 4), $roleTwo), - ); - $this->_resourceModelMock->expects($this->once()) - ->method('getRolesIds') - ->will($this->returnValue($roleIds)); - - $this->_roleFactory->expects($this->exactly(count($roleIds))) - ->method('createRole') - ->will($this->returnValueMap($createRoleMap)); - - $this->_acl->expects($this->exactly(count($roleIds))) - ->method('addRole') - ->with($this->logicalOr($roleOne, $roleTwo)); - - $this->_acl->expects($this->exactly(count($roleIds))) - ->method('deny') - ->with($this->logicalOr($roleOne, $roleTwo)); - - $this->_model->populateAcl($this->_acl); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Role::populateAcl. - * - * Test with No existing role IDs. - */ - public function testPopulateAclWithNoRoles() - { - $this->_resourceModelMock->expects($this->once()) - ->method('getRolesIds') - ->will($this->returnValue(array())); - - $this->_roleFactory->expects($this->never()) - ->method('createRole'); - - $this->_acl->expects($this->never()) - ->method('addRole'); - - $this->_acl->expects($this->never()) - ->method('deny'); - - $this->_model->populateAcl($this->_acl); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php deleted file mode 100644 index f2a238264d42097a713c496324ccac939a616211..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Loader/RuleTest.php +++ /dev/null @@ -1,119 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Authorization\Loader\Rule - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Loader; - -class RuleTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Resource\Acl\Rule - */ - protected $_ruleResource; - - /** - * @var \Magento\Webapi\Model\Authorization\Loader\Rule - */ - protected $_model; - - /** - * @var \Magento\Acl - */ - protected $_acl; - - /** - * Set up before test - */ - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_ruleResource = $this->getMock('Magento\Webapi\Model\Resource\Acl\Rule', - array('getRuleList', '__wakeup'), array(), '', false); - - $this->_acl = $this->getMock('Magento\Acl', array('has', 'hasRole', 'allow'), array(), '', false); - - $this->_model = $helper->getObject('Magento\Webapi\Model\Authorization\Loader\Rule', array( - 'ruleResource' => $this->_ruleResource, - )); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Rule::populateAcl. - */ - public function testPopulateAcl() - { - $ruleList = array( - array('role_id' => 5, 'resource_id' => 7), - array('role_id' => 5, 'resource_id' => 8), - array('role_id' => 6, 'resource_id' => 7) - ); - $hasMap = array( - array(7, true), - array(8, false) - ); - $hasRoleMap = array( - array(5, true), - array(6, false), - array(5, true) - ); - - $this->_ruleResource->expects($this->once()) - ->method('getRuleList') - ->will($this->returnValue($ruleList)); - - $this->_acl->expects($this->exactly(count($hasMap))) - ->method('has') - ->with($this->logicalOr(7, 8)) - ->will($this->returnValueMap($hasMap)); - $this->_acl->expects($this->exactly(count($hasRoleMap))) - ->method('hasRole') - ->with($this->logicalOr(5, 6)) - ->will($this->returnValueMap($hasRoleMap)); - $this->_acl->expects($this->once()) - ->method('allow') - ->with(5, 7); - - $this->_model->populateAcl($this->_acl); - } - - /** - * Test for \Magento\Webapi\Model\Authorization\Loader\Rule::populateAcl without rules. - */ - public function testPopulateAclWithoutRules() - { - $this->_ruleResource->expects($this->once()) - ->method('getRuleList') - ->will($this->returnValue(array())); - - $this->_acl->expects($this->never()) - ->method('has'); - $this->_acl->expects($this->never()) - ->method('hasRole'); - $this->_acl->expects($this->never()) - ->method('allow'); - - $this->_model->populateAcl($this->_acl); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Role/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Role/FactoryTest.php deleted file mode 100644 index ba6629b4dae7f048747e2107b53e189c56010815..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/Role/FactoryTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Authorization\Role\Factory - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization\Role; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\Webapi\Model\Authorization\Role\Factory - */ - protected $_model; - - /** - * @var \Magento\ObjectManager - */ - protected $_objectManager; - - /** - * @var \Magento\Webapi\Model\Authorization\Role - */ - protected $_expectedObject; - - protected function setUp() - { - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockForAbstractClass('Magento\ObjectManager', array(), '', - true, true, true, array('create')); - - $this->_expectedObject = $this->getMock('Magento\Webapi\Model\Authorization\Role', array(), array(), '', false); - - $this->_model = $helper->getObject('Magento\Webapi\Model\Authorization\Role\Factory', array( - 'objectManager' => $this->_objectManager, - )); - } - - public function testCreateRole() - { - $arguments = array('5', '6'); - - $this->_objectManager->expects($this->once()) - ->method('create') - ->with('Magento\Webapi\Model\Authorization\Role', $arguments) - ->will($this->returnValue($this->_expectedObject)); - $this->assertEquals($this->_expectedObject, $this->_model->createRole($arguments)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/RoleLocatorTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/RoleLocatorTest.php deleted file mode 100644 index d3b838e90889ca7fdc93dd8713f5502e1f0c178b..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Authorization/RoleLocatorTest.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Authorization\RoleLoactor - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Authorization; - -class RoleLocatorTest extends \PHPUnit_Framework_TestCase -{ - public function testGetAclRoleId() - { - $expectedRoleId = '557'; - $roleLocator = new \Magento\Webapi\Model\Authorization\RoleLocator(array( - 'roleId' => $expectedRoleId - )); - $this->assertEquals($expectedRoleId, $roleLocator->getAclRoleId()); - } - - public function testSetRoleId() - { - $roleLocator = new \Magento\Webapi\Model\Authorization\RoleLocator; - $expectedRoleId = '557'; - $roleLocator->setRoleId($expectedRoleId); - $this->assertAttributeEquals($expectedRoleId, '_roleId', $roleLocator); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/XsdTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/XsdTest.php new file mode 100644 index 0000000000000000000000000000000000000000..ed66896c304b5c62dc8f3c5f2d53974bd457fcde --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/XsdTest.php @@ -0,0 +1,222 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Webapi\Model\Config; + +/** + * Test for validation rules implemented by XSD schema for API integration configuration. + */ +class XsdTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var string + */ + protected $_schemaFile; + + protected function setUp() + { + $this->_schemaFile = BP . '/app/code/Magento/Webapi/etc/webapi.xsd'; + } + + /** + * @param string $fixtureXml + * @param array $expectedErrors + * @dataProvider exemplarXmlDataProvider + */ + public function testExemplarXml($fixtureXml, array $expectedErrors) + { + $messageFormat = '%message%'; + $dom = new \Magento\Config\Dom($fixtureXml, array(), null, $messageFormat); + $actualResult = $dom->validate($this->_schemaFile, $actualErrors); + $this->assertEquals(empty($expectedErrors), $actualResult, "Validation result is invalid."); + $this->assertEquals($expectedErrors, $actualErrors, "Validation errors does not match."); + } + + /** + * @return array + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function exemplarXmlDataProvider() + { + return array( + /** Valid configurations */ + 'valid' => array( + // @codingStandardsIgnoreStart + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + <rest-route httpMethod="POST" method="create" isSecure="1" resources="Magento_TestModule1::resource1,Magento_TestModule1::resource2"></rest-route> + </service> + </config>', + array() + ), + 'valid with several entities' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + <rest-route httpMethod="GET" method="items" resources="Magento_TestModule1::resource2"></rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_TestModule1::resource3"></rest-route> + <rest-route httpMethod="PUT" method="update" resources="Magento_TestModule1::resource1,Magento_TestModule1::resource2">/:id</rest-route> + </service> + + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + <rest-route httpMethod="GET" method="items" resources="Magento_TestModule1::resource2"></rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_TestModule1::resource3"></rest-route> + <rest-route httpMethod="PUT" method="update" resources="Magento_TestModule1::resource1,Magento_TestModule1::resource2">/:id</rest-route> + <rest-route httpMethod="DELETE" method="delete" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + <rest-route httpMethod="GET" method="items" resources="Magento_TestModule1::resource2"></rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_TestModule1::resource3"></rest-route> + <rest-route httpMethod="PUT" method="update" resources="Magento_TestModule1::resource1,Magento_TestModule1::resource2">/:id</rest-route> + <rest-route httpMethod="DELETE" method="delete" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + </config>', + array() + ), + + /** Missing required nodes */ + 'empty root node' => array( + '<config/>', + array("Element 'config': Missing child element(s). Expected is ( service ).") + ), + 'empty rest-route' => array( + '<config> + <service/> + </config>', + array("Element 'service': Missing child element(s). Expected is ( rest-route ).") + ), + 'invalid rest-routes' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface"> + <rest-route> + <invalid></invalid> + </rest-route> + </service> + </config>', + array("Element 'rest-route': Element content is not allowed, because the content type is a simple type definition.") + ), + 'irrelevant root node' => array( + '<invalid/>', + array("Element 'invalid': No matching global declaration available for the validation root.") + ), + + /** Excessive nodes */ + 'irrelevant node in root' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface"> + <rest-route> + </rest-route> + </service> + <invalid/> + </config>', + array("Element 'invalid': This element is not expected. Expected is ( service ).") + ), + 'irrelevant node in service' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface"> + <rest-route> + </rest-route> + <invalid/> + </service> + </config>', + array("Element 'invalid': This element is not expected. Expected is ( rest-route ).") + ), + 'irrelevant node in rest-routes' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface"> + <rest-route> + <invalid/> + </rest-route> + </service> + </config>', + array("Element 'rest-route': Element content is not allowed, because the content type is a simple type definition.") + ), + + /** Excessive attributes */ + 'invalid attribute in root' => array( + '<config invalid="invalid"> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + </config>', + array("Element 'config', attribute 'invalid': The attribute 'invalid' is not allowed.") + ), + 'invalid attribute in service' => array( + '<config> + <service invalid="invalid" class="Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + </config>', + array("Element 'service', attribute 'invalid': The attribute 'invalid' is not allowed.") + ), + 'invalid attribute in rest-routes' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> + <rest-route invalid="invalid" httpMethod="GET" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + </config>', + array("Element 'rest-route', attribute 'invalid': The attribute 'invalid' is not allowed.") + ), + + /** Invalid values */ + 'rest-route with invalid httpMethod' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route httpMethod="INVALID" method="item" resources="Magento_TestModule1::resource1">/:id</rest-route> + </service> + </config>', + array( + "Element 'rest-route', attribute 'httpMethod': [facet 'enumeration'] " + . "The value 'INVALID' is not an element of the set {'GET', 'PUT', 'POST', 'DELETE'}.", + "Element 'rest-route', attribute 'httpMethod': 'INVALID' is not a valid value of the local atomic type.") + ), + 'rest-route with invalid isSecure key type' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route isSecure="Invalid"></rest-route> + </service> + </config>', + array( + "Element 'rest-route', attribute 'isSecure': " + . "'Invalid' is not a valid value of the atomic type 'xs:boolean'.") + ), + 'rest-route with invalid resources type' => array( + '<config> + <service class="Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> + <rest-route resources="Invalid"></rest-route> + </service> + </config>', + array( + "Element 'rest-route', attribute 'resources': [facet 'pattern'] " + . "The value 'Invalid' is not accepted by the pattern '.+::.+(, ?.+::.+)*'.", + "Element 'rest-route', attribute 'resources': 'Invalid' is not a valid value of the atomic type 'resourcesType'." + ) + ) + ); + // @codingStandardsIgnoreEnd + } +} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php index ab528f2622e07cb35a454a273df84ecaa23b9738..2c6241ab4333339e4fd7551953af0c4a44617000 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.php @@ -30,7 +30,8 @@ return array( 'httpMethod' => 'GET', 'method' => 'item', 'route' => '/:id', - 'isSecure' => false + 'isSecure' => false, + 'resources' => array('Magento_Test1::resource1') ) ) ), @@ -42,19 +43,22 @@ return array( 'httpMethod' => 'GET', 'method' => 'item', 'route' => '/:id', - 'isSecure' => false + 'isSecure' => false, + 'resources' => array('Magento_Test1::resource1', 'Magento_Test1::resource2') ), 'create' => array( 'httpMethod' => 'POST', 'method' => 'create', 'route' => '', - 'isSecure' => false + 'isSecure' => false, + 'resources' => array('Magento_Test1::resource1', 'Magento_Test1::resource2') ), 'delete' => array( 'httpMethod' => 'DELETE', 'method' => 'delete', 'route' => '/:id', - 'isSecure' => true + 'isSecure' => true, + 'resources' => array('Magento_Test1::resource2') ), ) ), diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml index 2ab43187f04b0c08853d71683c9122623fd2bb37..d2761bffeade9da8ebc2e8f3b8888ff4ac60efa5 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Config/_files/webapi.xml @@ -25,14 +25,15 @@ --> <config> <service class="\Magento\TestModule1\Service\AllSoapAndRestV1Interface" baseUrl="/V1/testmodule1"> - <rest-route httpMethod="GET" method="item">/:id</rest-route> + <rest-route httpMethod="GET" method="item" resources="Magento_Test1::resource1">/:id</rest-route> </service> <service class="\Magento\TestModule1\Service\AllSoapAndRestV2Interface" baseUrl="/V2/testmodule1"> - <rest-route httpMethod="GET" method="item">/:id</rest-route> - <rest-route httpMethod="POST" method="create"></rest-route> - <rest-route httpMethod="DELETE" method="delete" isSecure="true">/:id</rest-route> + <rest-route httpMethod="GET" method="item" resources="Magento_Test1::resource1, Magento_Test1::resource2">/:id</rest-route> + <rest-route httpMethod="POST" method="create" resources="Magento_Test1::resource1,Magento_Test1::resource2"></rest-route> + <rest-route httpMethod="DELETE" method="delete" isSecure="true" resources="Magento_Test1::resource2">/:id</rest-route> </service> + <!--TODO: All service methods must have resources that's why all of them must be declared explicitly--> <service class="\Magento\TestModule1\Service\AllSoapAndRestV3Interface"/> </config> diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/IntegrationServiceV1Test.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/IntegrationServiceV1Test.php new file mode 100644 index 0000000000000000000000000000000000000000..82c0ea916b99a7fa534186d318a73470efa7215c --- /dev/null +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/IntegrationServiceV1Test.php @@ -0,0 +1,90 @@ +<?php +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Webapi\Model\Plugin; + +use Magento\Authz\Model\UserIdentifier; +use Magento\Integration\Model\Integration; + +class IntegrationServiceV1Test extends \PHPUnit_Framework_TestCase +{ + /** + * Authorization service mock + * + * @var \Magento\Authz\Service\AuthorizationV1 + */ + protected $_authzServiceMock; + + /** + * Mock for UserIdentifier Factory + * + * @var \Magento\Authz\Model\UserIdentifier\Factory + */ + protected $_userIdentifierFactoryMock; + + /** + * API setup plugin + * + * @var \Magento\Webapi\Model\Plugin\IntegrationServiceV1 + */ + protected $_integrationV1Plugin; + + public function setUp() + { + $this->_authzServiceMock = $this->getMockBuilder('\Magento\Authz\Service\AuthorizationV1') + ->disableOriginalConstructor() + ->setMethods(['removePermissions'])->getMock(); + $this->_userIdentifierFactoryMock = $this->getMockBuilder('\Magento\Authz\Model\UserIdentifier\Factory') + ->disableOriginalConstructor() + ->setMethods(['create'])->getMock(); + $this->_integrationV1Plugin = new \Magento\Webapi\Model\Plugin\IntegrationServiceV1( + $this->_authzServiceMock, + $this->_userIdentifierFactoryMock + ); + } + + public function testAfterDelete() + { + $integrationsData = array( + Integration::ID => 1, + Integration::NAME => 'TestIntegration1', + Integration::EMAIL => 'test-integration1@magento.com', + Integration::ENDPOINT => 'http://endpoint.com', + Integration::SETUP_TYPE => 1, + ); + $userIdentifierMock = $this->getMockBuilder('\Magento\Authz\Model\UserIdentifier') + ->disableOriginalConstructor() + ->getMock(); + $this->_authzServiceMock->expects($this->once()) + ->method('removePermissions')->with($userIdentifierMock); + $this->_userIdentifierFactoryMock->expects($this->at(0)) + ->method('create') + ->with(UserIdentifier::USER_TYPE_INTEGRATION, 1) + ->will($this->returnValue($userIdentifierMock)); + $this->_authzServiceMock->expects($this->once()) + ->method('removePermissions') + ->with($userIdentifierMock); + $this->_integrationV1Plugin->afterDelete($integrationsData); + } +} \ No newline at end of file diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php index bb019df395fb28ee8bec3a5af693352779697bcd..c169850b13fb7363d7bf1ffdd5d76a06906af8aa 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Plugin/SetupTest.php @@ -128,20 +128,20 @@ class SetupTest extends \PHPUnit_Framework_TestCase ) ); - $integrationsData1 = array( - Integration::ID => 1, + $integrationsData1 = new \Magento\Object(array( + 'id' => 1, Integration::NAME => 'TestIntegration1', Integration::EMAIL => 'test-integration1@magento.com', Integration::ENDPOINT => 'http://endpoint.com', Integration::SETUP_TYPE => 1, - ); + )); - $integrationsData2 = array( - Integration::ID => 2, + $integrationsData2 = new \Magento\Object(array( + 'id' => 2, Integration::NAME => 'TestIntegration2', Integration::EMAIL => 'test-integration2@magento.com', Integration::SETUP_TYPE => 1, - ); + )); $this->_integrationServiceMock->expects($this->at(0)) ->method('findByName') @@ -179,4 +179,4 @@ class SetupTest extends \PHPUnit_Framework_TestCase $this->_apiSetupPlugin->afterInitIntegrationProcessing(array('TestIntegration1', 'TestIntegration2')); } -} \ No newline at end of file +} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php deleted file mode 100644 index cf5cceef84e9ff5b7f8665bd60783096b3640e22..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/AbstractTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Abstract test class for \Magento\Webapi\Model\Resource\Acl. Added to eliminate copy-paste. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -abstract class AbstractTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_helper; - - /** - * @var \Magento\ObjectManager|PHPUnit_Framework_MockObject_MockObject - */ - protected $_objectManager; - - /** - * @var \Magento\App\Resource|PHPUnit_Framework_MockObject_MockObject - */ - protected $_resource; - - /** - * @var \Magento\DB\Adapter\Pdo\Mysql|PHPUnit_Framework_MockObject_MockObject - */ - protected $_adapter; - - protected function setUp() - { - $this->_helper = new \Magento\TestFramework\Helper\ObjectManager($this); - - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMockForAbstractClass(); - } - - abstract public function testConstructor(); -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php deleted file mode 100644 index c39b323879c8d816ea73ce1a3c0cc7a9dad72b59..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RoleTest.php +++ /dev/null @@ -1,150 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Resource\Acl\Role - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class RoleTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest -{ - /** - * Create resource model. - * - * @param \Magento\DB\Select $selectMock - * @return \Magento\Webapi\Model\Resource\Acl\Role - */ - protected function _createModel($selectMock = null) - { - $this->_resource = $this->getMockBuilder('Magento\App\Resource') - ->disableOriginalConstructor() - ->setMethods(array('getConnection', 'getTableName')) - ->getMock(); - - $this->_resource->expects($this->any()) - ->method('getTableName') - ->withAnyParameters() - ->will($this->returnArgument(0)); - - $this->_adapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') - ->disableOriginalConstructor() - ->setMethods(array('select', 'fetchCol', 'fetchPairs')) - ->getMock(); - - $this->_adapter->expects($this->any()) - ->method('fetchCol') - ->withAnyParameters() - ->will($this->returnValue(array(1))); - - $this->_adapter->expects($this->any()) - ->method('fetchPairs') - ->withAnyParameters() - ->will($this->returnValue(array('key' => 'value'))); - - if (!$selectMock) { - $selectMock = new \Magento\DB\Select( - $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false)); - } - - $this->_adapter->expects($this->any()) - ->method('select') - ->withAnyParameters() - ->will($this->returnValue($selectMock)); - - $this->_resource->expects($this->any()) - ->method('getConnection') - ->withAnyParameters() - ->will($this->returnValue($this->_adapter)); - - return $this->_helper->getObject('Magento\Webapi\Model\Resource\Acl\Role', array( - 'resource' => $this->_resource, - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel(); - - $this->assertAttributeEquals('webapi_role', '_mainTable', $model); - $this->assertAttributeEquals('role_id', '_idFieldName', $model); - } - - /** - * Test _initUniqueFields(). - */ - public function testGetUniqueFields() - { - $model = $this->_createModel(); - $fields = $model->getUniqueFields(); - - $this->assertEquals(array(array('field' => 'role_name', 'title' => 'Role Name')), $fields); - } - - /** - * Test getRolesList(). - */ - public function testGetRolesList() - { - $selectMock = $this->getMockBuilder('Magento\DB\Select') - ->setConstructorArgs(array($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))) - ->setMethods(array('from', 'order')) - ->getMock(); - - $selectMock->expects($this->once()) - ->method('from') - ->with('webapi_role', array('role_id', 'role_name')) - ->will($this->returnSelf()); - - $selectMock->expects($this->once()) - ->method('order') - ->with('role_name') - ->will($this->returnSelf()); - - $model = $this->_createModel($selectMock); - $result = $model->getRolesList(); - $this->assertEquals(array('key' => 'value'), $result); - } - - /** - * Test getRolesIds(). - */ - public function testGetRolesIds() - { - $selectMock = $this->getMockBuilder('Magento\DB\Select') - ->setConstructorArgs(array($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))) - ->setMethods(array('from', 'order')) - ->getMock(); - - $selectMock->expects($this->once()) - ->method('from') - ->with('webapi_role', array('role_id')) - ->will($this->returnSelf()); - - $model = $this->_createModel($selectMock); - - $result = $model->getRolesIds(); - $this->assertEquals(array(1), $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php deleted file mode 100644 index dc5c59d30c886edf0a5bae9171192d7baa482910..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/RuleTest.php +++ /dev/null @@ -1,207 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Resource\Acl\Rule - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class RuleTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest -{ - /** - * Create resource model. - * - * @param \Magento\DB\Select $selectMock - * @return \Magento\Webapi\Model\Resource\Acl\Rule - */ - protected function _createModel($selectMock = null) - { - $this->_resource = $this->getMockBuilder('Magento\App\Resource') - ->disableOriginalConstructor() - ->setMethods(array('getConnection', 'getTableName')) - ->getMock(); - - $this->_resource->expects($this->any()) - ->method('getTableName') - ->withAnyParameters() - ->will($this->returnArgument(0)); - - $this->_adapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') - ->disableOriginalConstructor() - ->setMethods(array('select', 'fetchCol', 'fetchAll', - 'beginTransaction', 'commit', 'rollback', 'insertArray', 'delete')) - ->getMock(); - - $this->_adapter->expects($this->any()) - ->method('fetchCol') - ->withAnyParameters() - ->will($this->returnValue(array(1))); - - $this->_adapter->expects($this->any()) - ->method('fetchAll') - ->withAnyParameters() - ->will($this->returnValue(array(array('key' => 'value')))); - - if (!$selectMock) { - $selectMock = new \Magento\DB\Select( - $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false)); - } - - $this->_adapter->expects($this->any()) - ->method('select') - ->withAnyParameters() - ->will($this->returnValue($selectMock)); - - $this->_adapter->expects($this->any()) - ->method('beginTransaction') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_resource->expects($this->any()) - ->method('getConnection') - ->withAnyParameters() - ->will($this->returnValue($this->_adapter)); - - return $this->_helper->getObject('Magento\Webapi\Model\Resource\Acl\Rule', array( - 'resource' => $this->_resource, - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel(); - - $this->assertAttributeEquals('webapi_rule', '_mainTable', $model); - $this->assertAttributeEquals('rule_id', '_idFieldName', $model); - } - - /** - * Test getRuleList(). - */ - public function testGetRuleList() - { - $selectMock = $this->getMockBuilder('Magento\DB\Select') - ->setConstructorArgs(array($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))) - ->setMethods(array('from')) - ->getMock(); - - $selectMock->expects($this->once()) - ->method('from') - ->with('webapi_rule', array('resource_id', 'role_id')) - ->will($this->returnSelf()); - - $model = $this->_createModel($selectMock); - $result = $model->getRuleList(); - $this->assertEquals(array(array('key' => 'value')), $result); - } - - /** - * Test getResourceIdsByRole(). - */ - public function testGetResourceIdsByRole() - { - $selectMock = $this->getMockBuilder('Magento\DB\Select') - ->setConstructorArgs(array($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))) - ->setMethods(array('from', 'where')) - ->getMock(); - - $selectMock->expects($this->once()) - ->method('from') - ->with('webapi_rule', array('resource_id')) - ->will($this->returnSelf()); - - $selectMock->expects($this->once()) - ->method('where') - ->with('role_id = ?', 1) - ->will($this->returnSelf()); - - $model = $this->_createModel($selectMock); - $result = $model->getResourceIdsByRole(1); - $this->assertEquals(array(1), $result); - } - - /** - * Test saveResources(). - */ - public function testSaveResources() - { - // Init rule resource. - $ruleResource = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Rule') - ->disableOriginalConstructor() - ->setMethods(array('saveResources', 'getIdFieldName', 'getReadConnection', 'getResources', '__wakeup')) - ->getMock(); - - $ruleResource->expects($this->any()) - ->method('getIdFieldName') - ->withAnyParameters() - ->will($this->returnValue('id')); - - $ruleResource->expects($this->any()) - ->method('getReadConnection') - ->withAnyParameters() - ->will($this->returnValue($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))); - - // Init rule. - $rule = $this->getMockBuilder('Magento\Webapi\Model\Acl\Rule') - ->setConstructorArgs(array( - 'context' => $this->getMock('Magento\Core\Model\Context', array(), array(), '', false), - 'coreRegistry' => $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false), - 'resource' => $ruleResource - )) - ->setMethods(array('getResources')) - ->getMock(); - - $rule->expects($this->once()) - ->method('getResources') - ->withAnyParameters() - ->will($this->returnValue(array('ResourceName'))); - - $model = $this->_createModel(); - - // Init adapter. - $this->_adapter->expects($this->any()) - ->method('delete') - ->withAnyParameters() - ->will($this->returnValue(array())); - - $this->_adapter->expects($this->once()) - ->method('insertArray') - ->with('webapi_rule', array('role_id', 'resource_id'), - array(array('role_id' => 1, 'resource_id' => 'ResourceName'))) - ->will($this->returnValue(1)); - - $rule->setRoleId(1); - $model->saveResources($rule); - - // Init adapter. - $this->_adapter->expects($this->any()) - ->method('delete') - ->withAnyParameters() - ->will($this->throwException(new \Zend_Db_Adapter_Exception('DB \Exception'))); - - $this->setExpectedException('Zend_Db_Adapter_Exception', 'DB \Exception'); - $model->saveResources($rule); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php deleted file mode 100644 index cb385823df3d2868e8d5c44f290657fd3da68019..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Resource/Acl/UserTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php -/** - * Test class for \Magento\Webapi\Model\Resource\Acl\User - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webapi\Model\Resource\Acl; - -class UserTest extends \Magento\Webapi\Model\Resource\Acl\AbstractTest -{ - /** - * Create resource model. - * - * @param \Magento\DB\Select $selectMock - * @return \Magento\Webapi\Model\Resource\Acl\User - */ - protected function _createModel($selectMock = null) - { - $this->_resource = $this->getMockBuilder('Magento\App\Resource') - ->disableOriginalConstructor() - ->setMethods(array('getConnection', 'getTableName')) - ->getMock(); - - $this->_resource->expects($this->any()) - ->method('getTableName') - ->withAnyParameters() - ->will($this->returnArgument(0)); - - $this->_adapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') - ->disableOriginalConstructor() - ->setMethods(array('select', 'fetchCol')) - ->getMock(); - - if (!$selectMock) { - $selectMock = new \Magento\DB\Select( - $this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false)); - } - - $this->_adapter->expects($this->any()) - ->method('select') - ->withAnyParameters() - ->will($this->returnValue($selectMock)); - - $this->_adapter->expects($this->any()) - ->method('fetchCol') - ->withAnyParameters() - ->will($this->returnValue(array(1))); - - $this->_resource->expects($this->any()) - ->method('getConnection') - ->withAnyParameters() - ->will($this->returnValue($this->_adapter)); - - return $this->_helper->getObject('Magento\Webapi\Model\Resource\Acl\User', array( - 'resource' => $this->_resource, - )); - } - - /** - * Test constructor. - */ - public function testConstructor() - { - $model = $this->_createModel(); - - $this->assertAttributeEquals('webapi_user', '_mainTable', $model); - $this->assertAttributeEquals('user_id', '_idFieldName', $model); - } - - /** - * Test _initUniqueFields(). - */ - public function testGetUniqueFields() - { - $model = $this->_createModel(); - $fields = $model->getUniqueFields(); - - $this->assertEquals(array(array('field' => 'api_key', 'title' => 'API Key')), $fields); - } - - /** - * Test getRoleUsers(). - */ - public function testGetRoleUsers() - { - $selectMock = $this->getMockBuilder('Magento\DB\Select') - ->setConstructorArgs(array($this->getMock('Magento\DB\Adapter\Pdo\Mysql', array(), array(), '', false))) - ->setMethods(array('from', 'where')) - ->getMock(); - - $selectMock->expects($this->once()) - ->method('from') - ->with('webapi_user', array('user_id')) - ->will($this->returnSelf()); - - $selectMock->expects($this->once()) - ->method('where') - ->with('role_id = ?', 1) - ->will($this->returnSelf()); - - $model = $this->_createModel($selectMock); - $result = $model->getRoleUsers(1); - $this->assertEquals(array(1), $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php index fcdac66585cd6958cdbb509ccefe7706c6795370..a26d906b84d09a44b19fd1935b82329598d5065e 100644 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php +++ b/dev/tests/unit/testsuite/Magento/Webapi/Model/Soap/ConfigTest.php @@ -124,7 +124,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'httpMethod' => 'GET', 'method' => 'someMethod', 'route' => '', - 'isSecure' => false + 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource1') ) ) ), @@ -136,7 +137,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'httpMethod' => 'GET', 'method' => 'someMethod', 'route' => '', - 'isSecure' => false + 'isSecure' => false, + 'resources' => array('Magento_TestModule1::resource2') ) ) ) @@ -148,7 +150,8 @@ class ConfigTest extends \PHPUnit_Framework_TestCase 'someMethod' => array( 'method' => 'someMethod', 'inputRequired' => '', - 'isSecure' => '' + 'isSecure' => '', + 'resources' => array('Magento_TestModule1::resource1') ) ), 'class' => 'Magento\Module\Service\FooV1Interface' diff --git a/dev/tests/unit/testsuite/Magento/Webapi/Model/Source/Acl/RoleTest.php b/dev/tests/unit/testsuite/Magento/Webapi/Model/Source/Acl/RoleTest.php deleted file mode 100644 index 2d98d33b745b950ac0e5475960fa6dbe597a61b5..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webapi/Model/Source/Acl/RoleTest.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_Webapi - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ - -/** - * Test for \Magento\Webapi\Model\Source\Acl\Role. - */ -namespace Magento\Webapi\Model\Source\Acl; - -class RoleTest extends \PHPUnit_Framework_TestCase -{ - /** - * Check output format. - * - * @dataProvider toOptionsHashDataProvider - * - * @param bool $addEmpty - * @param array $data - * @param array $expected - */ - public function testToOptionHashFormat($addEmpty, $data, $expected) - { - $resourceMock = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\Role') - ->setMethods(array('getRolesList', '__wakeup')) - ->disableOriginalConstructor() - ->getMock(); - $resourceMock->expects($this->any()) - ->method('getRolesList') - ->will($this->returnValue($data)); - - $factoryMock = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\RoleFactory') - ->setMethods(array('create')) - ->disableOriginalConstructor() - ->getMock(); - $factoryMock->expects($this->any()) - ->method('create') - ->will($this->returnValue($resourceMock)); - - $model = new \Magento\Webapi\Model\Source\Acl\Role($factoryMock); - - $options = $model->toOptionHash($addEmpty); - $this->assertEquals($expected, $options); - } - - /** - * Data provider for testing toOptionHash. - * - * @return array - */ - public function toOptionsHashDataProvider() - { - return array( - 'with empty' => array( - true, array('1' => 'role 1', '2' => 'role 2'), array('' => '', '1' => 'role 1', '2' => 'role 2') - ), - 'without empty' => array( - false, array('1' => 'role 1', '2' => 'role 2'), array('1' => 'role 1', '2' => 'role 2') - ), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.php deleted file mode 100644 index 039b7243163de3fc05b9c52d498f080feedcacdc..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/ActivateTest.php +++ /dev/null @@ -1,88 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Activate - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -class ActivateTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Activate */ - private $_block; - - /** @var \Magento\Core\Model\Url */ - private $_urlBuilder; - - /** @var array */ - private $_subscription = array( - 'subscription_id' => 333, - 'name' => 'test_subscription', - 'topics' => array('customer/created', 'customer/updated') - ); - - protected function setUp() - { - $this->_urlBuilder = $this->getMock('Magento\UrlInterface'); - - /** @var $coreData \Magento\Core\Helper\Data */ - $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - - $registry = $this->getMock('Magento\Core\Model\Registry', array('registry'), array(), '', false); - $registry->expects($this->once()) - ->method('registry') - ->with('current_subscription') - ->will($this->returnValue($this->_subscription)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('\Magento\Webhook\Block\Adminhtml\Registration\Activate', - array( - 'coreData' => $coreData, - 'registry' => $registry, - 'urlBuilder' => $this->_urlBuilder - ) - ); - } - - public function testGetAcceptUrl() - { - $url = 'example.url.com/id/333'; - $this->_urlBuilder->expects($this->once()) - ->method('getUrl') - ->with('adminhtml/*/accept', array('id' => 333)) - ->will($this->returnValue($url)); - - $this->assertEquals($url, $this->_block->getAcceptUrl()); - } - - public function testGetSubscriptionName() - { - $this->assertEquals($this->_subscription['name'], $this->_block->getSubscriptionName()); - } - - public function testGetSubscriptionTopics() - { - $this->assertEquals($this->_subscription['topics'], $this->_block->getSubscriptionTopics()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php deleted file mode 100644 index 43ef524f09a7eb15c958d94567c40e645d952b04..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/Form/ContainerTest.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Create\Form\Container - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create\Form; - -class ContainerTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Activate */ - private $_block; - - /** @var \Magento\Core\Model\Url */ - private $_urlBuilder; - - /** @var array */ - private $_subscription = array( - 'subscription_id' => 333, - 'name' => 'test_subscription', - 'topics' => array('customer/created', 'customer/updated') - ); - - protected function setUp() - { - $this->_urlBuilder = $this->getMock('Magento\UrlInterface'); - - /** @var $coreData \Magento\Core\Helper\Data */ - $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - - $registry = $this->getMock('Magento\Core\Model\Registry', array('registry'), array(), '', false); - $registry->expects($this->once()) - ->method('registry') - ->with('current_subscription') - ->will($this->returnValue($this->_subscription)); - - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('\Magento\Webhook\Block\Adminhtml\Registration\Create\Form\Container', - array( - 'coreData' => $coreData, - 'registry' => $registry, - 'urlBuilder' => $this->_urlBuilder - ) - ); - } - - public function testGetAcceptUrl() - { - $url = 'example.url.com/id/333'; - $this->_urlBuilder->expects($this->once()) - ->method('getUrl') - ->with('adminhtml/*/register', array('id' => 333)) - ->will($this->returnValue($url)); - - $this->assertEquals($url, $this->_block->getSubmitUrl()); - } - - public function testGetSubscriptionName() - { - $this->assertEquals($this->_subscription['name'], $this->_block->getSubscriptionName()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php deleted file mode 100644 index 3ed8ac7b65b87e2dbe69fe5cfe675c2adb705c75..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/Create/FormTest.php +++ /dev/null @@ -1,111 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Create\Form - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration\Create; - -class FormTest extends \Magento\Test\Block\Adminhtml -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_formMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_formFactoryMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_dataFormMock; - - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - /** @var string[] */ - private $_actualIds; - - protected function setUp() - { - parent::setUp(); - $this->_registry = new \Magento\Core\Model\Registry(); - $this->_formFactoryMock = $this->getMock('Magento\Data\FormFactory', array('create'), - array(), '', false, false); - - $this->_dataFormMock = $this->_makeMock('Magento\Data\Form'); - $this->_setStub($this->_formFactoryMock, 'create', $this->_dataFormMock); - - $selectMock = $this->_makeMock('Magento\DB\Select'); - $collectionMock = $this->_makeMock('Magento\Data\Collection\Db'); - $this->_setStub($collectionMock, 'getSelect', $selectMock); - - $arguments = array( - $this->_context, - $this->_registry, - $this->_formFactoryMock, - ); - - $methods = array( - 'getId', - 'sortColumnsByOrder', - '_prepareMassactionBlock', - '_prepareFilterButtons', - 'getChildBlock', - '_toHtml', - '_saveCache', - '_afterToHtml', - 'addColumn' - - ); - - $this->_formMock = $this->getMock( - 'Magento\Webhook\Block\Adminhtml\Registration\Create\Form', - $methods, - $arguments); - } - - public function testPrepareColumns() - { - $columnsSetMock = $this->_makeMock('Magento\Backend\Block\Widget\Grid\ColumnSet'); - $this->_setStub($this->_formMock, 'getChildBlock', $columnsSetMock); - - $this->_dataFormMock->expects($this->exactly(4)) - ->method('addField') - ->will($this->returnCallback(array($this, 'logAddFieldArguments'))); - - // Intended to call _prepareColumns - $this->_formMock->toHtml(); - - $expectedIds = array('company', 'email', 'apikey', 'apisecret'); - $this->assertEquals($expectedIds, $this->_actualIds); - } - - /** - * Logs addField's id argument for later verification - * - * @param string $actualId - */ - public function logAddFieldArguments($actualId) - { - $this->_actualIds[] = $actualId; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php deleted file mode 100644 index e5c0a7471121c053fd3760a04becbb9ad47b9c92..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Registration/FailedTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Registration\Failed - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Registration; - -class FailedTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Block\Adminhtml\Registration\Failed */ - private $_block; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_lastMessage; - - protected function setUp() - { - - /** @var $coreData \Magento\Core\Helper\Data */ - $coreData = $this->getMock('Magento\Core\Helper\Data', array(), array(), '', false); - - $this->_lastMessage = $this->getMockBuilder('Magento\Message\AbstractMessage') - ->disableOriginalConstructor() - ->getMock(); - $messages = $this->getMockBuilder('Magento\Message\Collection') - ->disableOriginalConstructor() - ->getMock(); - $messages->expects($this->any()) - ->method('getLastAddedMessage') - ->will($this->returnValue($this->_lastMessage)); - $session = $this->getMockBuilder('Magento\Backend\Model\Session') - ->disableOriginalConstructor() - ->getMock(); - $session->expects($this->once()) - ->method('getMessages') - ->will($this->returnValue($messages)); - $helper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_block = $helper->getObject('\Magento\Webhook\Block\Adminhtml\Registration\Failed', - array( - 'coreData' => $coreData, - 'backendSession' => $session - ) - ); - } - - public function testGetSessionError() - { - $errorMessage = 'Some error message'; - $this->_lastMessage->expects($this->once()) - ->method('toString') - ->will($this->returnValue($errorMessage)); - - $this->assertEquals($errorMessage, $this->_block->getSessionError()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php deleted file mode 100644 index 991b7431b5f80bc01601b63f2eff8b6d71693a59..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Edit/FormTest.php +++ /dev/null @@ -1,126 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Edit\Form - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Edit; - -class FormTest extends \Magento\Test\Block\Adminhtml -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_formMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_formFactoryMock; - - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_formatMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_authenticationMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_hookMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_dataFormMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_fieldsetMock; - - /** @var string[] */ - private $_actualIds; - - public function testPrepareColumns() - { - $this->_formFactoryMock = $this->getMock('Magento\Data\FormFactory', array('create'), - array(), '', false, false); - $this->_registry = new \Magento\Core\Model\Registry(); - $this->_formatMock = $this->_makeMock('Magento\Webhook\Model\Source\Format'); - $this->_authenticationMock = $this->_makeMock('Magento\Webhook\Model\Source\Authentication'); - $this->_hookMock = $this->_makeMock('Magento\Webhook\Model\Source\Hook'); - - $selectMock = $this->_makeMock('Magento\DB\Select'); - $collectionMock = $this->_makeMock('Magento\Data\Collection\Db'); - $this->_setStub($collectionMock, 'getSelect', $selectMock); - - // Primary test logic - $this->_dataFormMock = $this->_makeMock('Magento\Data\Form'); - $this->_setStub($this->_formFactoryMock, 'create', $this->_dataFormMock); - $this->_fieldsetMock = $this->_makeMock('Magento\Data\Form\Element\Fieldset'); - $this->_setStub($this->_dataFormMock, 'addFieldset', $this->_fieldsetMock); - $this->_fieldsetMock->expects($this->atLeastOnce()) - ->method('addField') - ->will($this->returnCallback(array($this, 'logAddFieldArguments'))); - - // Arguments passed to UUT's constructor - $arguments = array( - $this->_context, - $this->_registry, - $this->_formFactoryMock, - $this->_formatMock, - $this->_authenticationMock, - $this->_hookMock, - array($collectionMock) - ); - - // Parent methods, not being tested, to mock out - $methods = array( - 'getId', - 'sortColumnsByOrder', - '_prepareMassactionBlock', - '_prepareFilterButtons', - 'getChildBlock', - '_toHtml', - '_saveCache', - '_afterToHtml', - 'addColumn' - ); - - $this->_formMock = $this->getMock('Magento\Webhook\Block\Adminhtml\Subscription\Edit\Form', $methods, - $arguments); - $columnsSetMock = $this->_makeMock('Magento\Backend\Block\Widget\Grid\ColumnSet'); - $this->_setStub($this->_formMock, 'getChildBlock', $columnsSetMock); - - // Intended to call _prepareColumns - $this->_formMock->toHtml(); - - $expectedIds = array('name', 'endpoint_url', 'format', 'authentication_type', 'topics'); - $this->assertEquals($expectedIds, $this->_actualIds); - } - - /** - * Logs addField's id argument for later verification - * - * @param string $actualId - */ - public function logAddFieldArguments($actualId) - { - $this->_actualIds[] = $actualId; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php deleted file mode 100644 index 1eae04230b764148d726fe2a1e29b6722b3cad99..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/EditTest.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Edit - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription; - -class EditTest extends \Magento\Test\Block\Adminhtml -{ - /** @var \Magento\Core\Model\Registry */ - private $_registry; - - /** @var \Magento\Webhook\Block\Adminhtml\Subscription\Edit */ - private $_block; - - public function testGetHeaderTestExisting() - { - $subscriptionData = array( - \Magento\Webhook\Block\Adminhtml\Subscription\Edit::DATA_SUBSCRIPTION_ID => true, - 'alias' => 'alias_value'); - - $this->_registry = new \Magento\Core\Model\Registry(); - $this->_registry->register( - \Magento\Webhook\Block\Adminhtml\Subscription\Edit::REGISTRY_KEY_CURRENT_SUBSCRIPTION, - $subscriptionData); - $this->_block = new \Magento\Webhook\Block\Adminhtml\Subscription\Edit( - $this->_context, - $this->_registry - ); - $this->assertEquals('Edit Subscription', $this->_block->getHeaderText()); - - $this->_registry->unregister( - \Magento\Webhook\Block\Adminhtml\Subscription\Edit::REGISTRY_KEY_CURRENT_SUBSCRIPTION - ); - } - - public function testGetHeaderTestNew() - { - $this->_registry = new \Magento\Core\Model\Registry(); - $this->_block = new \Magento\Webhook\Block\Adminhtml\Subscription\Edit( - $this->_context, - $this->_registry - ); - - $this->assertEquals('Add Subscription', $this->_block->getHeaderText()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php deleted file mode 100644 index 3ccb5da64ae66b8965ee04a88295d078d4671c27..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/Subscription/Grid/Renderer/ActionTest.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer; - -class ActionTest extends \PHPUnit_Framework_TestCase -{ - public function testRenderWrongType() - { - $context = $this->getMockBuilder('Magento\Backend\Block\Context') - ->disableOriginalConstructor() - ->getMock(); - $gridRenderer = new \Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\Action($context); - $row = $this->getMockBuilder('Magento\Object') - ->disableOriginalConstructor() - ->getMock(); - - $renderedRow = $gridRenderer->render($row); - - $this->assertEquals('', $renderedRow); - } - - /** - * @dataProvider renderDataProvider - * @param int $status - * @param string $contains - */ - public function testRender($status, $contains) - { - $urlBuilder = $this->getMock('Magento\Core\Model\Url', array('getUrl'), array(), '', false); - $urlBuilder->expects($this->any()) - ->method('getUrl') - ->will($this->returnArgument(0)); - $translator = $this->getMock('Magento\Core\Model\Translate', array('translate'), array(), '', false); - $context = $this->getMockBuilder('Magento\Backend\Block\Context') - ->disableOriginalConstructor() - ->getMock(); - $context->expects($this->once()) - ->method('getUrlBuilder') - ->will($this->returnValue($urlBuilder)); - $context->expects($this->any()) - ->method('getTranslator') - ->will($this->returnValue($translator)); - $gridRenderer = new \Magento\Webhook\Block\Adminhtml\Subscription\Grid\Renderer\Action($context); - $row = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $row->expects($this->any()) - ->method('getStatus') - ->will($this->returnValue($status)); - $row->expects($this->any()) - ->method('getId') - ->will($this->returnValue(42)); - - $renderedRow = $gridRenderer->render($row); - - $this->assertFalse(false === strpos($renderedRow, '<a href="'), $renderedRow); - $this->assertFalse(false === strpos($renderedRow, $contains), $renderedRow); - $this->assertFalse(false === strpos($renderedRow, '</a>'), $renderedRow); - } - - /** - * Data provider for our testRender() - * - * @return array - */ - public function renderDataProvider() - { - return array( - array(\Magento\Webhook\Model\Subscription::STATUS_ACTIVE, 'revoke'), - array(\Magento\Webhook\Model\Subscription::STATUS_REVOKED, 'activate'), - array(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE, 'activate'), - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php deleted file mode 100644 index d6c5cb6b813a58a84f4ef4aa9f6164aa0890cf1b..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Block/Adminhtml/SubscriptionTest.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * \Magento\Webhook\Block\Adminhtml\Subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Block\Adminhtml; - -class SubscriptionTest extends \Magento\Test\Block\Adminhtml -{ - /** - * @var \Magento\TestFramework\Helper\ObjectManager - */ - protected $_objectManagerHelper; - - public function testConstruct() - { - $this->_objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $block = $this->_objectManagerHelper->getObject( - '\Magento\Webhook\Block\Adminhtml\Subscription', array()); - - - $this->assertEquals('Subscriptions', $block->getHeaderText()); - $this->assertEquals('Add Subscription', $block->getAddButtonLabel()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php deleted file mode 100644 index 681e9f3b34b859506fd5f03d787b94319c2355b1..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/RegistrationTest.php +++ /dev/null @@ -1,364 +0,0 @@ -<?php -/** - * \Magento\Webhook\Controller\Adminhtml\Webhook\Registration - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -class RegistrationTest extends \PHPUnit_Framework_TestCase -{ - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - - /** @var \Magento\Webhook\Controller\Adminhtml\Webhook\Registration */ - protected $_registrationContr; - - /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ - protected $_objectManagerHelper; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockApp; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfig; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEventManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockTranslateModel; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockLayoutFilter; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendModSess; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendCntCtxt; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRequest; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockSubSvc; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockResponse; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendHlpData; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfigScope; - - protected function setUp() - { - /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ - $this->_objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockBackendHlpData = $this->getMockBuilder('Magento\Backend\Helper\Data') - ->disableOriginalConstructor() - ->getMock(); - - // Initialize mocks which are used in several test cases - $this->_mockApp = $this->getMockBuilder('Magento\Core\Model\App') - ->setMethods( array('getConfig')) - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockConfig = $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor() - ->getMock(); - $this->_mockApp->expects($this->any())->method('getConfig')->will($this->returnValue($this->_mockConfig)); - $this->_mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockLayoutFilter = $this->getMockBuilder('Magento\Core\Model\Layout\Filter\Acl') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockBackendModSess = $this->getMockBuilder('Magento\Backend\Model\Session') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockTranslateModel = $this->getMockBuilder('Magento\Core\Model\Translate') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockConfigScope = $this->getMockBuilder('Magento\Config\ScopeInterface') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockSubSvc = $this->getMockBuilder('Magento\Webhook\Service\SubscriptionV1') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockRequest = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockResponse = $this->getMock('Magento\App\Response\Http'); - } - - public function testActivateActionException() - { - $expectedMessage = 'not subscribed'; - $this->_mockSubSvc->expects($this->any())->method('get') - ->will($this->throwException(new \Magento\Core\Exception($expectedMessage))); - - // verify the error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($expectedMessage)); - $registrationContr = $this->_createRegistrationController(); - $registrationContr->activateAction(); - } - - public function testActivateAction() - { - $this->_verifyLoadAndRenderLayout(); - $this->_registrationContr = $this->_createRegistrationController(); - $this->_registrationContr->activateAction(); - } - - public function testAcceptAction() - { - // Verify redirect to registration - $this->_mockBackendHlpData->expects($this->once()) - ->method('getUrl') - ->with($this->equalTo('*/webhook_registration/user'), array('id' => '')); - $this->_registrationContr = $this->_createRegistrationController(); - $this->_registrationContr->acceptAction(); - } - - public function testAcceptActionNotSubscribed() - { - $expectedMessage = 'not subscribed'; - $this->_mockSubSvc->expects($this->any())->method('get') - ->will($this->throwException(new \Magento\Core\Exception($expectedMessage))); - - // verify the error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($expectedMessage)); - - $registrationContr = $this->_createRegistrationController(); - $registrationContr->acceptAction(); - } - - public function testUserAction() - { - $this->_verifyLoadAndRenderLayout(); - $this->_registrationContr = $this->_createRegistrationController(); - $this->_registrationContr->userAction(); - } - - public function testUserActionNotSubscribed() - { - $expectedMessage = 'not subscribed'; - $this->_mockSubSvc->expects($this->any())->method('get') - ->will($this->throwException(new \Magento\Core\Exception($expectedMessage))); - - // verify the error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($expectedMessage)); - - $registrationContr = $this->_createRegistrationController(); - $registrationContr->userAction(); - } - - public function testRegisterActionNoData() - { - // Use real translate model - $this->_mockTranslateModel = null; - - // Verify error message - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('API Key, API Secret and Contact Email are required fields.')); - $registrationContr = $this->_createRegistrationController(); - $registrationContr->registerAction(); - } - - public function testRegisterActionInvalidEmail() - { - - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - // Use real translate model - $this->_mockTranslateModel = null; - - // Verify error message - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('Invalid Email address provided')); - $registrationContr = $this->_createRegistrationController(); - $registrationContr->registerAction(); - } - - public function testRegisterAction() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'test@example.com'), - array('company', null, 'Example') - ) - )); - - $this->_mockSubSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - $this->_mockSubSvc->expects($this->any())->method('update')->will($this->returnArgument(0)); - - $registrationContr = $this->_createRegistrationController(); - - // Verify redirect to success page - $this->_mockBackendHlpData->expects($this->once()) - ->method('getUrl') - ->with($this->equalTo('adminhtml/webhook_registration/succeeded'), array('id' => '1')); - - $registrationContr->registerAction(); - } - - public function testFailedAction() - { - $this->_verifyLoadAndRenderLayout(); - $this->_registrationContr = $this->_createRegistrationController(); - $this->_registrationContr->failedAction(); - } - - public function testSucceededAction() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - ) - )); - - $this->_verifyLoadAndRenderLayout(); - - $this->_mockSubSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest' ) - )); - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been activated.')); - - $this->_registrationContr = $this->_createRegistrationController(); - $this->_registrationContr->succeededAction(); - } - - public function testSucceededActionNotSubscribed() - { - $this->_verifyLoadAndRenderLayout(); - $this->_mockSubSvc = $this->getMockBuilder('Magento\Webhook\Service\SubscriptionV1') - ->disableOriginalConstructor() - ->getMock(); - $expectedMessage = 'not subscribed'; - $this->_mockSubSvc->expects($this->any())->method('get') - ->will($this->throwException(new \Magento\Core\Exception($expectedMessage))); - // verify the error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($expectedMessage)); - - $registrationContr = $this->_createRegistrationController(); - $registrationContr->succeededAction(); - } - - /** - * Creates the RegistrationController to test. - * @return \Magento\Webhook\Controller\Adminhtml\Webhook\Registration - */ - protected function _createRegistrationController() - { - // Mock Layout passed into constructor - $layoutMock = $this->getMockBuilder('Magento\Core\Model\Layout') - ->disableOriginalConstructor() - ->getMock(); - $layoutMergeMock = $this->getMockBuilder('Magento\Core\Model\Layout\Merge') - ->disableOriginalConstructor() - ->getMock(); - $layoutMock->expects($this->any())->method('getUpdate')->will($this->returnValue($layoutMergeMock)); - $testElement = new \Magento\Simplexml\Element('<test>test</test>'); - $layoutMock->expects($this->never())->method('getNode')->will($this->returnValue($testElement)); - $blockMock = $this->getMockBuilder('Magento\View\Element\AbstractBlock') - ->disableOriginalConstructor() - ->getMock(); - $layoutMock->expects($this->any())->method('getMessagesBlock')->will($this->returnValue($blockMock)); - - $contextParameters = array( - 'layout' => $layoutMock, - 'objectManager' => $this->_mockObjectManager, - 'session' => $this->_mockBackendModSess, - 'request' => $this->_mockRequest, - 'response' => $this->_mockResponse, - 'helper' => $this->_mockBackendHlpData, - 'translator' => $this->_mockTranslateModel, - ); - - $this->_mockBackendCntCtxt = $this->_objectManagerHelper - ->getObject('Magento\Backend\App\Action\Context', $contextParameters); - - $regControllerParams = array( - 'context' => $this->_mockBackendCntCtxt, - 'subscriptionService' => $this->_mockSubSvc, - ); - - /** @var \Magento\Webhook\Controller\Adminhtml\Webhook\Registration $registrationContr */ - $registrationContr = $this->_objectManagerHelper - ->getObject('Magento\Webhook\Controller\Adminhtml\Webhook\Registration', - $regControllerParams); - return $registrationContr; - } - - /** - * Common mock 'expect' pattern. - * Calls that need to be mocked out when - * \Magento\Backend\Controller\AbstractAction loadLayout() and renderLayout() are called. - */ - protected function _verifyLoadAndRenderLayout() - { - $map = array( - array('Magento\Core\Model\Config', $this->_mockConfig), - array('Magento\Core\Model\Layout\Filter\Acl', $this->_mockLayoutFilter), - array('Magento\Backend\Model\Session', $this->_mockBackendModSess), - array('Magento\Config\ScopeInterface', $this->_mockConfigScope), - ); - $this->_mockObjectManager->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($map)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php deleted file mode 100644 index 4507de7b301fb9edfd3bed3fefcd9f9b12062bf2..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Controller/Adminhtml/Webhook/SubscriptionTest.php +++ /dev/null @@ -1,606 +0,0 @@ -<?php -/** - * \Magento\Webhook\Controller\Adminhtml\Webhook\Subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Controller\Adminhtml\Webhook; - -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - - /** @var \Magento\Webhook\Controller\Adminhtml\Webhook\Subscription */ - protected $_subscriptionContr; - - /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ - protected $_objectManagerHelper; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockApp; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockLayoutFilter; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfig; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEventManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockTranslateModel; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendModSess; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockBackendCntCtxt; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockSubscriptionSvc; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRegistry; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRequest; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockResponse; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfigScope; - - /** - * Setup object manager and initialize mocks - */ - protected function setUp() - { - /** @var \Magento\TestFramework\Helper\ObjectManager $objectManagerHelper */ - $this->_objectManagerHelper = new \Magento\TestFramework\Helper\ObjectManager($this); - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - - // Initialize mocks which are used in several test cases - $this->_mockApp = $this->getMockBuilder('Magento\Core\Model\App') - ->setMethods( array('getConfig')) - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockConfig = $this->getMockBuilder('Magento\Core\Model\Config')->disableOriginalConstructor() - ->getMock(); - $this->_mockApp->expects($this->any())->method('getConfig')->will($this->returnValue($this->_mockConfig)); - $this->_mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockLayoutFilter = $this->getMockBuilder('Magento\Core\Model\Layout\Filter\Acl') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockBackendModSess = $this->getMockBuilder('Magento\Backend\Model\Session') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockTranslateModel = $this->getMockBuilder('Magento\Core\Model\Translate') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockSubscriptionSvc = $this->getMockBuilder('Magento\Webhook\Service\SubscriptionV1') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockRequest = $this->getMockBuilder('Magento\App\Request\Http') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockResponse = $this->getMockBuilder('Magento\App\Response\Http') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockRegistry = $this->getMockBuilder('Magento\Core\Model\Registry') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockConfigScope = $this->getMockBuilder('Magento\Config\ScopeInterface') - ->disableOriginalConstructor() - ->getMock(); - } - - public function testIndexAction() - { - $this->_verifyLoadAndRenderLayout(); - - // renderLayout - $this->_subscriptionContr = $this->_createSubscriptionController(); - $this->_subscriptionContr->indexAction(); - } - - public function testNewAction() - { - // verify the request is forwarded to 'edit' action - $this->_mockRequest->expects($this->any())->method('setActionName')->with('edit') - ->will( $this->returnValue($this->_mockRequest)); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->newAction(); - } - - public function testEditActionHasData() - { - // put data in session, the magic function getFormData is called so, must match __call method name - $this->_mockBackendModSess->expects($this->any()) - ->method('__call')->will($this->returnValue(array('testkey' =>'testvalue'))); - - $this->_verifyLoadAndRenderLayout(); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->editAction(); - } - - public function testEditActionNoDataAdd() - { - // Set the registry object to return 'new' so the 'Add Subscription' path is followed - $this->_mockRegistry->expects($this->any())->method('registry')->will($this->returnValue('new')); - - $this->_verifyLoadAndRenderLayout(); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->editAction(); - } - - public function testEditException() - { - $exceptionMessage = 'An exception happened'; - // have load layout throw an exception - $this->_mockRegistry->expects($this->any()) - ->method('registry') - ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); - - // verify the error - $this->_mockBackendModSess->expects($this->once()) - ->method('addError') - ->with($this->equalTo($exceptionMessage)); - - $this->_subscriptionContr = $this->_createSubscriptionController(); - $this->_subscriptionContr->editAction(); - } - - public function testSaveAction() - { - // Use real translate model - $this->_mockTranslateModel = null; - - $this->_mockRequest->expects($this->any()) - ->method('getPost')->will($this->returnValue(array('apikey' => 'abc'))); - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); - - $this->_mockSubscriptionSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been saved.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->saveAction(); - } - - public function testSaveActionNoData() - { - // Use real translate model - $this->_mockTranslateModel = null; - - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - // verify the error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('The subscription \'\' has not been saved, as no data was provided.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->saveAction(); - } - - public function testSaveActionException() - { - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); - - // Have subscription service throw an exception to test exception path - $exceptionMessage = 'an exception happened'; - $this->_mockSubscriptionSvc->expects($this->any()) - ->method('get') - ->with(1) - ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); - - // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($exceptionMessage)); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->saveAction(); - } - - public function testSaveActionNew() - { - // Set the registry object to return 'new' so the 'create' path is followed - $this->_mockRegistry->expects($this->any())->method('registry')->will($this->returnValue('new')); - - $this->_mockRequest->expects($this->any())->method('getPost') - ->will($this->returnValue(array('apikey' => 'abc'))); - $this->_mockRequest->expects($this->any())->method('getParam')->will($this->returnValue('1')); - - $this->_mockSubscriptionSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - - // Use real translate model - $this->_mockTranslateModel = null; - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been saved.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->saveAction(); - } - - /** - * Test Save when action is not new, but there is no ID - */ - public function testSaveActionNoId() - { - // Set the registry object to return 'new' so the 'create' path is followed - $this->_mockRegistry->expects($this->any())->method('registry')->will($this->returnValue('old')); - - $this->_mockRequest->expects($this->any())->method('getPost') - ->will($this->returnValue(array('apikey' => 'abc', 'name' => 'testSubscription'))); - - // Use real translate model - $this->_mockTranslateModel = null; - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'testSubscription\' has been saved.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->saveAction(); - } - - /** - * Test deleteAction when subscription is an alias, not created by user. - */ - public function testDeleteActionAlias() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - $this->_mockSubscriptionSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2'), - 'alias' => 'true' - ) - )); - - // Use real translate model - $this->_mockTranslateModel = null; - // Verify error message - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('The subscription \'nameTest\' can not be removed.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->deleteAction(); - } - - public function testDeleteAction() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - $this->_mockSubscriptionSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - - // Use real translate model - $this->_mockTranslateModel = null; - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been removed.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->deleteAction(); - } - - public function testDeleteActionException () - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - - $this->_mockSubscriptionSvc->expects($this->any())->method('get')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - - // Have subscription service throw an exception to go down exception path - $exceptionMessage = 'Exceptions happen.'; - $this->_mockSubscriptionSvc->expects($this->any()) - ->method('delete') - ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); - - // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($exceptionMessage)); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->deleteAction(); - } - - public function testRevokeAction() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - $this->_mockSubscriptionSvc->expects($this->any())->method('revoke')->will($this->returnValue( - array( 'name' => 'nameTest', - 'subscription_id' => '1', - 'topics' => array('topic1', 'topic2')) - )); - - // Use real translate model - $this->_mockTranslateModel = null; - - // verify success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been revoked.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->revokeAction(); - } - - public function testRevokeActionNoData() - { - // Verify error - $this->_mockTranslateModel = null; - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('No Subscription ID was provided with the request.')); - $this->_subscriptionContr = $this->_createSubscriptionController(); - $this->_subscriptionContr->revokeAction(); - } - - public function testRevokeActionException() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - // Have subscription service throw an exception to go down exception path - $exceptionMessage = 'Exceptions happen.'; - $this->_mockSubscriptionSvc->expects($this->any()) - ->method('revoke') - ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); - - // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($exceptionMessage)); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->revokeAction(); - } - - public function testActivateAction() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - $this->_mockSubscriptionSvc->expects($this->once())->method('activate')->with(1)->will($this->returnValue( - array( 'name' => 'nameTest') - )); - - // Use real translate model - $this->_mockTranslateModel = null; - - // success message - $this->_mockBackendModSess->expects($this->once())->method('addSuccess') - ->with($this->equalTo('The subscription \'nameTest\' has been activated.')); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->activateAction(); - } - - public function testActivateActionNoData() - { - // Use real translate model - $this->_mockTranslateModel = null; - - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo('No Subscription ID was provided with the request.')); - $this->_subscriptionContr = $this->_createSubscriptionController(); - $this->_subscriptionContr->activateAction(); - } - - public function testActivateActionException() - { - $this->_mockRequest->expects($this->any())->method('getParam') - ->will( $this->returnValueMap( - array( - array('id', null, '1'), - array('apikey', null, '2'), - array('apisecret', null, 'secret'), - array('email', null, 'invalid.email.example.com'), - array('company', null, 'Example') - ) - )); - - // Have subscription service throw an exception to go down exception path - $exceptionMessage = 'An exception occurred'; - $this->_mockSubscriptionSvc->expects($this->any()) - ->method('activate') - ->will($this->throwException(new \Magento\Core\Exception($exceptionMessage))); - - // Verify error - $this->_mockBackendModSess->expects($this->once())->method('addError') - ->with($this->equalTo($exceptionMessage)); - - $subscriptionContr = $this->_createSubscriptionController(); - $subscriptionContr->activateAction(); - } - - /** - * Creates the SubscriptionController to test. - * - * @return \Magento\Webhook\Controller\Adminhtml\Webhook\Subscription - */ - protected function _createSubscriptionController() - { - // Mock Layout passed into constructor - $viewMock = $this->getMock('Magento\App\ViewInterface'); - $layoutMock = $this->getMock('Magento\View\LayoutInterface'); - $layoutMergeMock = $this->getMockBuilder('Magento\Core\Model\Layout\Merge') - ->disableOriginalConstructor() - ->getMock(); - $layoutMock->expects($this->any())->method('getUpdate')->will($this->returnValue($layoutMergeMock)); - $testElement = new \Magento\Simplexml\Element('<test>test</test>'); - $layoutMock->expects($this->any())->method('getNode')->will($this->returnValue($testElement)); - - // for _setActiveMenu - $viewMock->expects($this->any())->method('getLayout')->will($this->returnValue($layoutMock)); - $blockMock = $this->getMockBuilder('Magento\Backend\Block\Menu') - ->disableOriginalConstructor() - ->getMock(); - $menuMock = $this->getMockBuilder('Magento\Backend\Model\Menu') - ->disableOriginalConstructor() - ->getMock(); - $menuMock->expects($this->any())->method('getParentItems')->will($this->returnValue(array())); - $blockMock->expects($this->any())->method('getMenuModel')->will($this->returnValue($menuMock)); - - $layoutMock->expects($this->any())->method('getMessagesBlock')->will($this->returnValue($blockMock)); - $layoutMock->expects($this->any())->method('getBlock')->will($this->returnValue($blockMock)); - - $title = $this->getMock('Magento\App\Action\Title', array(), array(), '', false); - $title->expects($this->any())->method('add')->will($this->returnValue($title)); - $contextParameters = array( - 'view' => $viewMock, - 'objectManager' => $this->_mockObjectManager, - 'session' => $this->_mockBackendModSess, - 'translator' => $this->_mockTranslateModel, - 'request' => $this->_mockRequest, - 'response' => $this->_mockResponse, - 'title' => $title - ); - - $this->_mockBackendCntCtxt = $this->_objectManagerHelper - ->getObject('Magento\Backend\App\Action\Context', $contextParameters); - - $subControllerParams = array( - 'context' => $this->_mockBackendCntCtxt, - 'subscriptionService' => $this->_mockSubscriptionSvc, - 'registry' => $this->_mockRegistry, - ); - - /** Create SubscriptionController to test */ - $subscriptionContr = $this->_objectManagerHelper - ->getObject('Magento\Webhook\Controller\Adminhtml\Webhook\Subscription', - $subControllerParams); - return $subscriptionContr; - } - - /** - * Common mock 'expect' pattern. - * Calls that need to be mocked out when - * \Magento\Backend\Controller\AbstractAction loadLayout() and renderLayout() are called. - */ - protected function _verifyLoadAndRenderLayout() - { - $map = array( - array('Magento\Core\Model\Config', $this->_mockConfig), - array('Magento\Core\Model\Layout\Filter\Acl', $this->_mockLayoutFilter), - array('Magento\Backend\Model\Session', $this->_mockBackendModSess), - array('Magento\Core\Model\Translate', $this->_mockTranslateModel), - array('Magento\Config\ScopeInterface', $this->_mockConfigScope), - ); - $this->_mockObjectManager->expects($this->any()) - ->method('get') - ->will($this->returnValueMap($map)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php deleted file mode 100644 index c2aa0c9a9cf5423962b628806b2a3f363e9cb92a..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/EndpointTest.php +++ /dev/null @@ -1,214 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Endpoint - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class EndpointTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockObjectManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockUserFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockContext; - - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Webhook\Model\Endpoint */ - protected $_endpoint; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockResourceEndpnt; - - protected function setUp() - { - $this->_mockResourceEndpnt = $this->getMockBuilder('Magento\Webhook\Model\Resource\Endpoint') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockUserFactory = $this->getMockBuilder('Magento\Webhook\Model\User\Factory') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockContext = $this->getMockBuilder('Magento\Core\Model\Context') - ->disableOriginalConstructor() - ->getMock(); - } - - public function testGetters() - { - $endpointUrl = 'https://endpoint_url'; - $timeoutInSeconds = '357'; - $format = 'presumambly_json'; - $authenticationType = 'hmac'; - $apiUsedId = '747'; - - $mockWebhookUser = $this->getMockBuilder('Magento\Webhook\Model\User') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockUserFactory->expects($this->once()) - ->method('create') - ->with($this->equalTo($apiUsedId)) - ->will($this->returnValue($mockWebhookUser)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - // we have to use a mock because ancestor code utilizes deprecated static methods - $this->_endpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockUserFactory, - $dateTime - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->_endpoint->setEndpointUrl($endpointUrl) - ->setTimeoutInSecs($timeoutInSeconds) - ->setFormat($format) - ->setAuthenticationType($authenticationType) - ->setApiUserId($apiUsedId); - - $this->assertSame($endpointUrl, $this->_endpoint->getEndpointUrl()); - $this->assertSame($timeoutInSeconds, $this->_endpoint->getTimeoutInSecs()); - $this->assertSame($format, $this->_endpoint->getFormat()); - $this->assertSame($authenticationType, $this->_endpoint->getAuthenticationType()); - $this->assertSame($mockWebhookUser, $this->_endpoint->getUser()); - } - - /** - * Generates all possible combinations of two boolean values - * - * @return array of arrays of booleans - */ - public function testBeforeSaveDataProvider() - { - return array( - array(false, false), - array(false, true), - array(true, false), - array(true, true) - ); - } - - /** - * @dataProvider testBeforeSaveDataProvider - * - * @param $hasAuthType - * @param $hasDataChanges - */ - public function testBeforeSave($hasAuthType, $hasDataChanges) - { - $mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockContext->expects($this->once()) - ->method('getEventDispatcher') - ->will($this->returnValue($mockEventManager)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = $this->getMock('Magento\Stdlib\DateTime', array('formatDate'), array(), '', true); - - // we have to use a mock because ancestor code utilizes deprecated static methods - $this->_endpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockUserFactory, - $dateTime - )) - ->setMethods( - array('_init', '_getResource', 'hasAuthenticationType', 'setAuthenticationType', 'setUpdatedAt', - 'isDeleted', '_hasModelChanged') - ) - ->getMock(); - - $this->_mockMethodsForSaveCall(); - - $this->_endpoint->expects($this->once()) - ->method('hasAuthenticationType') - ->will($this->returnValue($hasAuthType)); - - if (!$hasAuthType) { - $this->_endpoint->expects($this->once()) - ->method('setAuthenticationType') - ->with($this->equalTo(\Magento\Outbound\EndpointInterface::AUTH_TYPE_NONE)); - } else { - $this->_endpoint->expects($this->never()) - ->method('setAuthenticationType'); - } - - $this->_endpoint->setDataChanges($hasDataChanges); - - if ($hasDataChanges) { - $someFormattedTime = '2013-07-10 12:35:28'; - $dateTime->expects($this->once()) - ->method('formatDate') - ->withAnyParameters() // impossible to predict what time() will be - ->will($this->returnValue($someFormattedTime)); - $this->_endpoint->expects($this->once()) - ->method('setUpdatedAt') - ->with($this->equalTo($someFormattedTime)); - } else { - $this->_endpoint->expects($this->never()) - ->method('setUpdatedAt'); - } - - $this->assertSame($this->_endpoint, $this->_endpoint->save()); - } - - /** - * This mocks the methods called in the save() method such that beforeSave() - * will be called and no errors will be produced during the save() call - * See \Magento\Core\Model\AbstractModel::save() for details - */ - private function _mockMethodsForSaveCall() - { - $this->_endpoint->expects($this->any()) - ->method('isDeleted') - ->will($this->returnValue(false)); - - $this->_endpoint->expects($this->any()) - ->method('_hasModelChanged') - ->will($this->returnValue(true)); - - $this->_endpoint->expects($this->any()) - ->method('_getResource') - ->will($this->returnValue($this->_mockResourceEndpnt)); - - $abstractMockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Endpoint') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockResourceEndpnt->expects($this->any()) - ->method('addCommitCallback') - ->withAnyParameters() - ->will($this->returnValue($abstractMockResource)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/FactoryTest.php deleted file mode 100644 index be6042ec3798a079eef4b45b0486f5cd7bc63008..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/FactoryTest.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Event\Factory */ - protected $_factory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_objectManager; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_arrayConverter; - - protected function setUp() - { - $this->_objectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - $this->_arrayConverter = $this->getMockBuilder('Magento\Convert\Object') - ->disableOriginalConstructor() - ->getMock(); - $this->_factory = new \Magento\Webhook\Model\Event\Factory($this->_objectManager, $this->_arrayConverter); - } - - public function testCreate() - { - $webhookEvent = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - $topic = 'TEST_TOPIC'; - $data = 'TEST_DATA'; - $array = 'TEST_ARRAY'; - $this->_arrayConverter->expects($this->once()) - ->method('convertDataToArray') - ->with($this->equalTo($data)) - ->will($this->returnValue($array)); - $this->_objectManager->expects($this->once()) - ->method('create') - ->with( - $this->equalTo('Magento\Webhook\Model\Event'), - $this->equalTo( - array( - 'data' => array( - 'topic' => $topic, - 'body_data' => serialize($array) - ) - ) - ) - ) - ->will($this->returnValue($webhookEvent)); - $webhookEvent->expects($this->once()) - ->method('setDataChanges') - ->with($this->equalTo(true)) - ->will($this->returnSelf()); - $this->assertSame($webhookEvent, $this->_factory->create($topic, $data)); - } - - public function testCreateEmpty() - { - $testValue = "test value"; - $this->_objectManager->expects($this->once()) - ->method('create') - ->with($this->equalTo('Magento\Webhook\Model\Event')) - ->will($this->returnValue($testValue)); - $this->assertSame($testValue, $this->_factory->createEmpty()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php deleted file mode 100644 index 254ae89777504e6f38a5a1db1b741ab7693955c6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueReaderTest.php +++ /dev/null @@ -1,89 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Event\QueueReader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class QueueReaderTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Event\QueueReader */ - protected $_eventQueue; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockCollection; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockIterator; - - protected function setUp() - { - $this->_mockCollection = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event\Collection') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockIterator = $this->getMockBuilder('Iterator') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockCollection->expects($this->once()) - ->method('getIterator') - ->will($this->returnValue($this->_mockIterator)); - $this->_eventQueue = new \Magento\Webhook\Model\Event\QueueReader($this->_mockCollection); - } - - public function testPollEvent() - { - $this->_mockIterator->expects($this->once()) - ->method('valid') - ->will($this->returnValue(true)); - - $event = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockIterator->expects($this->once()) - ->method('current') - ->will($this->returnValue($event)); - - $this->_mockIterator->expects($this->once()) - ->method('next'); - - $this->assertSame($event, $this->_eventQueue->poll()); - } - - public function testPollNothing() - { - $this->_mockIterator->expects($this->once()) - ->method('valid') - ->will($this->returnValue(false)); - - $this->_mockIterator->expects($this->never()) - ->method('current'); - - $this->_mockIterator->expects($this->never()) - ->method('next'); - - $this->assertNull($this->_eventQueue->poll()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php deleted file mode 100644 index 4b0ff44b549fa5cffce7afeec94bb026bc58bb5f..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Event/QueueWriterTest.php +++ /dev/null @@ -1,76 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Event; - -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Event\QueueWriter */ - protected $_eventQueue; - - /** @var \Magento\Webhook\Model\Event\Factory */ - protected $_eventFactory; - - protected function setUp() - { - $this->_eventFactory = $this->_mockCollection = $this->getMockBuilder('Magento\Webhook\Model\Event\Factory') - ->disableOriginalConstructor() - ->getMock(); - $this->_eventQueue = new \Magento\Webhook\Model\Event\QueueWriter($this->_eventFactory); - } - - public function testOfferMagentoEvent() - { - $magentoEvent = $this->_mockCollection = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - $magentoEvent->expects($this->once()) - ->method('save'); - $result = $this->_eventQueue->offer($magentoEvent); - $this->assertEquals(null, $result); - } - - public function testOfferNonMagentoEvent() - { - $magentoEvent = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - $magentoEvent->expects($this->once()) - ->method('save'); - - $this->_eventFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($magentoEvent)); - - - $event = $this->getMockBuilder('Magento\PubSub\EventInterface') - ->disableOriginalConstructor() - ->getMock(); - $result = $this->_eventQueue->offer($event); - $this->assertEquals(null, $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php deleted file mode 100644 index cf17c8df5967a00e6e3f6486c25b37ad5d9b03ee..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/EventTest.php +++ /dev/null @@ -1,193 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - /** - * A string used for testing time formats. Any string will do but it should look something like this. - */ - const SOME_FORMATTED_TIME = '2013-07-10 12:35:28'; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $_mockContext; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Webhook\Model\Event - */ - protected $_event; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Stdlib\DateTime - */ - protected $_dateTime; - - protected function setUp() - { - $this->_mockContext = $this->getMockBuilder('Magento\Core\Model\Context') - ->disableOriginalConstructor() - ->getMock(); - - $mockEventManager = $this->getMockBuilder('Magento\Event\ManagerInterface') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockContext->expects($this->once()) - ->method('getEventDispatcher') - ->will($this->returnValue($mockEventManager)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $this->_dateTime = $this->getMock('Magento\Stdlib\DateTime', array('formatDate'), array(), '', true); - - $this->_event = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_dateTime)) - ->setMethods( - array('_init', 'isDeleted', 'isObjectNew', 'getId', '_hasModelChanged', '_getResource') - ) - ->getMock(); - } - - public function testBeforeSaveNewObject() - { - $this->_mockMethodsForSave(); - - $this->_event->expects($this->any()) - ->method('isObjectNew') - ->withAnyParameters() - ->will($this->returnValue(true)); - - $this->_dateTime->expects($this->atLeastOnce()) - ->method('formatDate') - ->with($this->equalTo(true)) - ->will($this->returnValue(self::SOME_FORMATTED_TIME)); - - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') - ->disableOriginalConstructor() - ->getMock(); - - // needed for 'save' method - $mockResource->expects($this->once()) - ->method('addCommitCallback') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_event->expects($this->any()) - ->method('_getResource') - ->withAnyParameters() - ->will($this->returnValue($mockResource)); - - $this->assertSame($this->_event, $this->_event->save()); - - $this->assertSame(self::SOME_FORMATTED_TIME, $this->_event->getCreatedAt()); - $this->assertNull($this->_event->getUpdatedAt()); - $this->assertSame(\Magento\PubSub\EventInterface::STATUS_READY_TO_SEND, $this->_event->getStatus()); - } - - /** - * This method mocks all the calls required in the "save" method, such that 'beforeSave' will be called - */ - protected function _mockMethodsForSave() - { - $this->_event->expects($this->once()) - ->method('isDeleted') - ->withAnyParameters() - ->will($this->returnValue(false)); - - $this->_event->expects($this->once()) - ->method('_hasModelChanged') - ->withAnyParameters() - ->will($this->returnValue(true)); - } - - public function testBeforeSaveOldObject() - { - $this->_mockMethodsForSave(); - - $this->_event->expects($this->any()) - ->method('isObjectNew') - ->withAnyParameters() - ->will($this->returnValue(false)); - - $this->_event->expects($this->any()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue(true)); - - $this->_dateTime->expects($this->atLeastOnce()) - ->method('formatDate') - ->with($this->equalTo(true)) - ->will($this->returnValue(self::SOME_FORMATTED_TIME)); - - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') - ->disableOriginalConstructor() - ->getMock(); - - // needed for 'save' method - $mockResource->expects($this->once()) - ->method('addCommitCallback') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_event->expects($this->any()) - ->method('_getResource') - ->withAnyParameters() - ->will($this->returnValue($mockResource)); - - $this->assertSame($this->_event, $this->_event->save()); - - $this->assertSame(self::SOME_FORMATTED_TIME, $this->_event->getUpdatedAt()); - $this->assertNull($this->_event->getCreatedAt()); - $this->assertSame(\Magento\PubSub\EventInterface::STATUS_READY_TO_SEND, $this->_event->getStatus()); - } - - public function testGettersAndSetters() - { - $this->assertEquals(array(), $this->_event->getBodyData()); - $data = array('some', 'random', 'data'); - $this->_event->setBodyData($data); - $this->assertTrue($this->_event->hasDataChanges()); - $this->assertEquals($data, $this->_event->getBodyData()); - - $this->assertEquals(array(), $this->_event->getHeaders()); - $this->_event->setHeaders($data); - $this->assertTrue($this->_event->hasDataChanges()); - $this->assertEquals($data, $this->_event->getHeaders()); - - $this->assertSame(\Magento\PubSub\EventInterface::STATUS_READY_TO_SEND, $this->_event->getStatus()); - $this->_event->setStatus($data); - $this->assertTrue($this->_event->hasDataChanges()); - $this->assertEquals($data, $this->_event->getStatus()); - - $this->assertNull($this->_event->getTopic()); - $this->_event->setTopic($data); - $this->assertTrue($this->_event->hasDataChanges()); - $this->assertEquals($data, $this->_event->getTopic()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/FactoryTest.php deleted file mode 100644 index 9608c4d83c7e85828e66f1638e3eae3eea85efe7..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/FactoryTest.php +++ /dev/null @@ -1,71 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Job\Factory */ - private $_jobFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockObjectManager; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - $this->_jobFactory = new \Magento\Webhook\Model\Job\Factory($this->_mockObjectManager); - } - - public function testCreate() - { - $subscription = $this->getMockBuilder('Magento\PubSub\SubscriptionInterface') - ->disableOriginalConstructor() - ->getMock(); - $event = $this->getMockBuilder('Magento\PubSub\EventInterface') - ->disableOriginalConstructor() - ->getMock(); - $job = 'JOB'; - $this->_mockObjectManager->expects($this->once()) - ->method('create') - ->with( - $this->equalTo('Magento\Webhook\Model\Job'), - $this->equalTo( - array( - 'data' => array( - 'event' => $event, - 'subscription' => $subscription - ) - ) - ) - ) - ->will($this->returnValue($job)); - $this->assertSame($job, $this->_jobFactory->create($subscription, $event)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php deleted file mode 100644 index 5767e6d532235949d6b4f64b1f45a8e95bb4cfbc..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueReaderTest.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\QueueReader - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class QueueReaderTest extends \PHPUnit_Framework_TestCase -{ - - /** @var \Magento\Webhook\Model\Job\QueueReader */ - private $_jobQueue; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockCollection; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockIterator; - - protected function setUp() - { - $this->_mockCollection = $this->getMockBuilder('Magento\Webhook\Model\Resource\Job\Collection') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockIterator = $this->getMockBuilder('ArrayIterator') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockCollection->expects($this->any()) - ->method('getIterator') - ->will($this->returnValue($this->_mockIterator)); - $this->_jobQueue = new \Magento\Webhook\Model\Job\QueueReader($this->_mockCollection); - } - - public function testPollNothing() - { - $this->_mockIterator->expects($this->once()) - ->method('valid') - ->will($this->returnValue(false)); - $this->assertNull($this->_jobQueue->poll()); - } - - public function testPollIteratorJob() - { - $this->_mockIterator->expects($this->once()) - ->method('valid') - ->will($this->returnValue(true)); - - $job = 'TEST_JOB'; - $this->_mockIterator->expects($this->once()) - ->method('current') - ->will($this->returnValue($job)); - - $this->_mockIterator->expects($this->once()) - ->method('next'); - - $this->assertSame($job, $this->_jobQueue->poll()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php deleted file mode 100644 index 67341ea2013ca50bd29d877a4cf13ae5e3c61bc1..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Job/QueueWriterTest.php +++ /dev/null @@ -1,90 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Job; - -class QueueWriterTest extends \PHPUnit_Framework_TestCase -{ - - /** @var \Magento\Webhook\Model\Job\QueueWriter */ - private $_jobQueue; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_jobFactory; - - protected function setUp() - { - $this->_jobFactory = $this->getMockBuilder('Magento\Webhook\Model\Job\Factory') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMock(); - $this->_jobQueue = new \Magento\Webhook\Model\Job\QueueWriter($this->_jobFactory); - } - - public function testOfferMagentoJob() - { - $magentoJob = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->disableOriginalConstructor() - ->getMock(); - $magentoJob->expects($this->once()) - ->method('save'); - $result = $this->_jobQueue->offer($magentoJob); - $this->assertEquals(null, $result); - } - - public function testOfferNonMagentoJob() - { - $magentoJob = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - $magentoJob->expects($this->once()) - ->method('save'); - - $this->_jobFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($magentoJob)); - - - $job = $this->getMockBuilder('Magento\PubSub\JobInterface') - ->disableOriginalConstructor() - ->getMock(); - $subscription = $this->getMockBuilder('Magento\PubSub\SubscriptionInterface') - ->disableOriginalConstructor() - ->getMock(); - $event = $this->getMockBuilder('Magento\PubSub\EventInterface') - ->disableOriginalConstructor() - ->getMock(); - $job->expects($this->once()) - ->method('getSubscription') - ->will($this->returnValue($subscription)); - $job->expects($this->once()) - ->method('getEvent') - ->will($this->returnValue($event)); - $result = $this->_jobQueue->offer($job); - $this->assertEquals(null, $result); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php deleted file mode 100644 index 931e8d0af6342d677fd852edaf8502ed53bc107b..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/JobTest.php +++ /dev/null @@ -1,388 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Job - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class JobTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Webhook\Model\Job */ - protected $_job; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEventFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockSubscrFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockContext; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEvent; - - protected function setUp() - { - $this->_mockEventFactory = $this->getMockBuilder('Magento\Webhook\Model\Event\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockSubscrFactory = $this->getMockBuilder('Magento\Webhook\Model\Subscription\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockContext = $this->getMockBuilder('Magento\Core\Model\Context') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockEvent = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime - )) - ->setMethods(array('_init', 'save')) - ->getMock(); - } - - public function testConstructorWithData() - { - $eventId = 'some event test id'; - $subscriptionId = 'some subscription test id'; - - $mockEvent = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - $mockEvent->expects($this->once()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue($eventId)); - - $mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $mockSubscription->expects($this->once()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue($subscriptionId)); - - $data = array('event' => $mockEvent, - 'subscription' => $mockSubscription); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - null, - null, - $data - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->assertSame($eventId, $this->_job->getEventId()); - $this->assertSame($subscriptionId, $this->_job->getSubscriptionId()); - } - - public function testGetEventWithEventIdInData() - { - $eventId = 'some event id'; - $event = 'some event'; - $data = array('event_id' => $eventId); - - $this->_mockEventFactory->expects($this->once()) - ->method('createEmpty') - ->withAnyParameters() - ->will($this->returnValue($this->_mockEvent)); - - $this->_mockEvent->expects($this->once()) - ->method('load') - ->with($this->equalTo($eventId)) - ->will($this->returnValue($event)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - null, - null, - $data - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->assertSame($event, $this->_job->getEvent()); - } - - public function testGetEventWithEventInData() - { - $mockEvent = $this->getMockBuilder('Magento\Webhook\Model\Event') - ->disableOriginalConstructor() - ->getMock(); - - $mockEvent->expects($this->once()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue('some event id')); - - $data = array('event' => $mockEvent); - - $this->_mockEventFactory->expects($this->never()) - ->method('createEmpty'); - - $this->_mockEvent->expects($this->never()) - ->method('load'); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - null, - null, - $data - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->assertSame($mockEvent, $this->_job->getEvent()); - } - - public function testGetSubscWithSubscrIdInData() - { - $subscrId = 'some subscription id'; - $subscr = 'some subscription'; - $data = array('subscription_id' => $subscrId); - - $mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $mockSubscription->expects($this->once()) - ->method('load') - ->with($subscrId) - ->will($this->returnValue($subscr)); - - $this->_mockSubscrFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($mockSubscription)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - null, - null, - $data - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->assertSame($subscr, $this->_job->getSubscription()); - } - - public function testGetSubscWithSubscrInData() - { - $subscriptionId = 'some subscription id'; - $mockSubscription = $this->getMockBuilder('Magento\PubSub\Subscription') - ->disableOriginalConstructor() - ->setMethods( - array('getId') - ) - ->getMock(); - $mockSubscription->expects($this->once()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue($subscriptionId)); - $data = array('subscription' => $mockSubscription); - - $this->_mockSubscrFactory->expects($this->never()) - ->method('create'); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - null, - null, - $data - )) - ->setMethods(array('_init')) - ->getMock(); - - $this->assertSame($mockSubscription, $this->_job->getSubscription()); - } - - public function testHandleResponseSuccess() - { - $this->_job->expects($this->once()) - ->method('save') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_job->complete(); - - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_SUCCEEDED, $this->_job->getStatus()); - } - - public function testHandleResponseFailure() - { - $this->_job->expects($this->any()) - ->method('save') - ->withAnyParameters() - ->will($this->returnSelf()); - - $count = 0; - while ($count < 8) { - $this->_job->handleFailure(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_RETRY, $this->_job->getStatus()); - $count++; - } - $this->_job->handleFailure(); - $this->assertEquals(\Magento\PubSub\JobInterface::STATUS_FAILED, $this->_job->getStatus()); - } - - public function testGetNoEvent() - { - $this->assertNull($this->_job->getEvent()); - } - - public function testGetNoSubscription() - { - $this->assertNull($this->_job->getSubscription()); - } - - /** - * Tests that a job which has failed for the first 8 times is given another - * chance. - */ - public function testJobGiven8Retries() - { - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime - )) - ->setMethods(array('_init', 'save', 'getRetryCount', 'setUpdatedAt', 'setStatus')) - ->getMock(); - - $retryCount = 8; - $this->_job->expects($this->exactly($retryCount)) - ->method('getRetryCount') - ->will($this->onConsecutiveCalls(0, 1, 2, 3, 4, 5, 6, 7)); - - $this->_job->expects($this->exactly($retryCount)) - ->method('setUpdatedAt') - ->with($this->anything()); - $this->_job->expects($this->exactly($retryCount)) - ->method('setStatus') - ->with(\Magento\PubSub\JobInterface::STATUS_RETRY); - - for ($count = 0; $count < $retryCount; $count++) { - $this->_job->handleFailure(); - } - } - - /** - * Tests that a job which has failed over 8 times is marked as failed. - */ - public function testJobFailAfter8Retries() - { - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $this->_job = $this->getMockBuilder('Magento\Webhook\Model\Job') - ->setConstructorArgs(array( - $this->_mockContext, - $coreRegistry, - $this->_mockEventFactory, - $this->_mockSubscrFactory, - $dateTime, - )) - ->setMethods(array('_init', 'save', 'getRetryCount', 'setStatus')) - ->getMock(); - - $this->_job->expects($this->exactly(1)) - ->method('getRetryCount') - ->will($this->returnValue(8)); - - $this->_job->expects($this->exactly(1)) - ->method('setStatus') - ->with(\Magento\PubSub\JobInterface::STATUS_FAILED); - - $this->_job->handleFailure(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php deleted file mode 100644 index 4c80860d1fea6be449e570db6b05c7f5a3e68d84..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/ObserverTest.php +++ /dev/null @@ -1,230 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Observer - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class ObserverTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Webhook\Model\Observer */ - protected $_observer; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_webapiEventHandler; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionSet; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_logger; - - protected function setUp() - { - $this->_webapiEventHandler = $this->_getBasicMock('Magento\Webhook\Model\Webapi\EventHandler'); - $this->_subscriptionSet = $this->_getBasicMock('Magento\Webhook\Model\Resource\Subscription\Collection'); - $this->_logger = $this->_getBasicMock('Magento\Logger'); - - $this->_observer = new \Magento\Webhook\Model\Observer( - $this->_webapiEventHandler, - $this->_subscriptionSet, - $this->_logger - ); - } - - /** - * @param string $className - * - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _getBasicMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } - - public function testAfterWebapiUserDeleteSuccess() - { - - $mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->setMethods(array('setStatus', 'save', '__wakeup')) - ->getMock(); - - $this->_subscriptionSet->expects($this->once()) - ->method('getActivatedSubscriptionsWithoutApiUser') - ->withAnyParameters() - ->will($this->returnValue(array($mockSubscription))); - - $mockSubscription->expects($this->once()) - ->method('setStatus') - ->with($this->equalTo(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE)) - ->will($this->returnSelf()); - - $mockSubscription->expects($this->once()) - ->method('save'); - - $this->_logger->expects($this->never()) - ->method('logException'); - - $this->_observer->afterWebapiUserDelete(); - } - - public function testAfterWebapiUserDeleteWithException() - { - - $mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->setMethods(array('setStatus', 'save', '__wakeup')) - ->getMock(); - - $this->_subscriptionSet->expects($this->once()) - ->method('getActivatedSubscriptionsWithoutApiUser') - ->withAnyParameters() - ->will($this->returnValue(array($mockSubscription))); - - $mockSubscription->expects($this->once()) - ->method('setStatus') - ->with($this->equalTo(\Magento\Webhook\Model\Subscription::STATUS_INACTIVE)) - ->will($this->returnSelf()); - - $exception = new \Exception('exception'); - $mockSubscription->expects($this->once()) - ->method('save') - ->withAnyParameters() - ->will($this->throwException($exception)); - - $this->_logger->expects($this->once()) - ->method('logException') - ->with($this->equalTo($exception)); - - $this->_observer->afterWebapiUserDelete(); - } - - public function testAfterWebapiUserChange() - { - $mockObserver = $this->_getBasicMock('Magento\Event\Observer'); - $mockVarienEvent = $this->getMockBuilder('Magento\Event') - ->setMethods(array('getObject')) - ->disableOriginalConstructor() - ->getMock(); - - $mockObserver->expects($this->once()) - ->method('getEvent') - ->withAnyParameters() - ->will($this->returnValue($mockVarienEvent)); - - $model = 'model'; - $mockVarienEvent->expects($this->once()) - ->method('getObject') - ->withAnyParameters() - ->will($this->returnValue($model)); - - $this->_webapiEventHandler->expects($this->once()) - ->method('userChanged') - ->with($this->equalTo($model)); - - $this->_observer->afterWebapiUserChange($mockObserver); - } - - public function testAfterWebapiUserChangeWithException() - { - $mockObserver = $this->_getBasicMock('Magento\Event\Observer'); - $mockVarienEvent = $this->getMockBuilder('Magento\Event') - ->setMethods(array('getObject')) - ->disableOriginalConstructor() - ->getMock(); - - $mockObserver->expects($this->once()) - ->method('getEvent') - ->withAnyParameters() - ->will($this->returnValue($mockVarienEvent)); - - $exception = new \Exception('exception'); - $this->_logger->expects($this->once()) - ->method('logException') - ->with($this->equalTo($exception)); - - $mockVarienEvent->expects($this->once()) - ->method('getObject') - ->withAnyParameters() - ->will($this->throwException($exception)); - - $this->_observer->afterWebapiUserChange($mockObserver); - } - - public function testAfterWebapiRoleChange() - { - $mockObserver = $this->_getBasicMock('Magento\Event\Observer'); - $mockVarienEvent = $this->getMockBuilder('Magento\Event') - ->setMethods(array('getObject')) - ->disableOriginalConstructor() - ->getMock(); - - $mockObserver->expects($this->once()) - ->method('getEvent') - ->withAnyParameters() - ->will($this->returnValue($mockVarienEvent)); - - $model = 'model'; - $mockVarienEvent->expects($this->once()) - ->method('getObject') - ->withAnyParameters() - ->will($this->returnValue($model)); - - $this->_webapiEventHandler->expects($this->once()) - ->method('roleChanged') - ->with($this->equalTo($model)); - - $this->_observer->afterWebapiRoleChange($mockObserver); - } - - public function testAfterWebapiRoleChangeWithException() - { - $mockObserver = $this->_getBasicMock('Magento\Event\Observer'); - $mockVarienEvent = $this->getMockBuilder('Magento\Event') - ->setMethods(array('getObject')) - ->disableOriginalConstructor() - ->getMock(); - - $mockObserver->expects($this->once()) - ->method('getEvent') - ->withAnyParameters() - ->will($this->returnValue($mockVarienEvent)); - - $exception = new \Exception('exception'); - $this->_logger->expects($this->once()) - ->method('logException') - ->with($this->equalTo($exception)); - - $mockVarienEvent->expects($this->once()) - ->method('getObject') - ->withAnyParameters() - ->will($this->throwException($exception)); - - $this->_observer->afterWebapiRoleChange($mockObserver); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php deleted file mode 100644 index c28c2c2d3a2847d2519e9de0a137551bad9a658e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EndpointTest.php +++ /dev/null @@ -1,136 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Endpoint - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class EndpointTest extends \PHPUnit_Framework_TestCase -{ - const TABLE_NAME = 'outbound_endpoint_table'; - - /** @var \Magento\Webhook\Model\Resource\Endpoint */ - private $_endpoint; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_adapterMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_selectMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_resourceMock; - - /** @var string[] */ - private $_apiUserIds = array('api_user_id1', 'api_user_id2', 'api_user_id3'); - - protected function setUp() - { - // Select mock - $this->_selectMock = $this->_makeMock('Magento\DB\Select'); - // Select stubs - $this->_selectMock->expects($this->once()) - ->method('from') - ->with(self::TABLE_NAME, array('endpoint_id')) - ->will($this->returnSelf()); - - // Adapter mock - $this->_adapterMock = $this->_makeMock('Magento\DB\Adapter\Pdo\Mysql'); - // Adapter stubs - $this->_adapterMock->expects($this->once()) - ->method('select') - ->with() - ->will($this->returnValue($this->_selectMock)); - $this->_adapterMock->expects($this->once()) - ->method('getTransactionLevel') - ->with() - ->will($this->returnValue(1)); - - // Resources mock - $this->_resourceMock = $this->_makeMock('Magento\App\Resource'); - // Resources stubs - $stubReturnMap = array( - array('core_read', $this->_adapterMock), - array('core_write', $this->_adapterMock), - ); - $this->_resourceMock->expects($this->once()) - ->method('getConnection') - ->will($this->returnValueMap($stubReturnMap)); - $this->_resourceMock->expects($this->once()) - ->method('getTableName') - ->with('outbound_endpoint') - ->will($this->returnValue(self::TABLE_NAME)); - - $this->_endpoint = new \Magento\Webhook\Model\Resource\Endpoint($this->_resourceMock); - } - - public function testGetApiUserEndpoints() - { - $endpoints = array('endpoint1', 'endpoint2', 'endpoint3'); - - $this->_selectMock->expects($this->once()) - ->method('where') - ->with('api_user_id IN (?)', $this->_apiUserIds) - ->will($this->returnSelf()); - - $this->_adapterMock->expects($this->once()) - ->method('fetchCol') - ->with($this->_selectMock) - ->will($this->returnValue($endpoints)); - - $this->assertEquals($endpoints, $this->_endpoint->getApiUserEndpoints($this->_apiUserIds)); - } - - public function testGetEndpointsWithoutApiUser() - { - $endpoints = array('endpoint1', 'endpoint2', 'endpoint3'); - - $this->_selectMock->expects($this->once()) - ->method('where') - ->with('api_user_id IS NULL') - ->will($this->returnSelf()); - - $this->_adapterMock->expects($this->once()) - ->method('fetchCol') - ->with($this->_selectMock) - ->will($this->returnValue($endpoints)); - - $this->assertEquals($endpoints, $this->_endpoint->getEndpointsWithoutApiUser()); - } - - /** - * Generates a mock object of the given class - * - * @param string $className - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } - -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php deleted file mode 100644 index 0a90fae8b1ba46f918d10c99fd8d8aa2d5748b02..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Event/CollectionTest.php +++ /dev/null @@ -1,63 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Event\Collection - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Event; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - /** @var \Magento\Event\ManagerInterface $eventManager */ - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - /** @var \Magento\Data\Collection\Db\FetchStrategyInterface $mockFetchStrategy */ - $mockFetchStrategy = $this->getMockBuilder('Magento\Data\Collection\Db\FetchStrategyInterface') - ->disableOriginalConstructor() - ->getMock(); - /** @var \Magento\Core\Model\EntityFactory $entityFactory */ - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $dateTime = $this->getMock('Magento\Stdlib\DateTime', null, array(), '', true); - - $mockDBAdapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') - ->disableOriginalConstructor() - ->setMethods(array('_connect', '_quote')) - ->getMockForAbstractClass(); - $mockResourceEvent = $this->getMockBuilder('Magento\Webhook\Model\Resource\Event') - ->disableOriginalConstructor() - ->getMock(); - $mockResourceEvent->expects($this->any()) - ->method('getReadConnection') - ->will($this->returnValue($mockDBAdapter)); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - - $collection = new \Magento\Webhook\Model\Resource\Event\Collection( - $entityFactory, $logger, $mockFetchStrategy, $eventManager, $dateTime, null, $mockResourceEvent - ); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Event\Collection', $collection); - $this->assertEquals('Magento\Webhook\Model\Resource\Event', $collection->getResourceModelName()); - $this->assertEquals('Magento\Webhook\Model\Event', $collection->getModelName()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php deleted file mode 100644 index 25eb322042b92edbcfaf8384f9e27599cbd6fa29..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/EventTest.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\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. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class EventTest extends \PHPUnit_Framework_TestCase -{ - public function testConstruct() - { - $tableName = 'webhook_event_table'; - $idFieldName = 'event_id'; - - $resourceMock = $this->getMockBuilder('Magento\App\Resource') - ->disableOriginalConstructor() - ->getMock(); - $resourceMock->expects($this->once()) - ->method('getTableName') - ->with('webhook_event') - ->will($this->returnValue($tableName)); - - $event = new \Magento\Webhook\Model\Resource\Event ($resourceMock); - $this->assertEquals($tableName, $event->getMainTable() ); - $this->assertEquals($idFieldName, $event->getIdFieldName()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php deleted file mode 100644 index dda694597feb721f14642ebf51ec6a6e0643b963..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Job/CollectionTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Job\Collection - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Job; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - /** @var \Magento\Event\ManagerInterface $eventManager */ - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - /** @var \Magento\Data\Collection\Db\FetchStrategyInterface $mockFetchStrategy */ - $mockFetchStrategy = $this->getMockBuilder('Magento\Data\Collection\Db\FetchStrategyInterface') - ->disableOriginalConstructor() - ->getMock(); - /** @var \Magento\Core\Model\EntityFactory $entityFactory */ - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $dateTime = new \Magento\Stdlib\DateTime; - $mockDBAdapter = $this->getMockBuilder('Magento\DB\Adapter\Pdo\Mysql') - ->disableOriginalConstructor() - ->setMethods(array('_connect', '_quote', 'formatDate')) - ->getMockForAbstractClass(); - $mockResourceEvent = $this->getMockBuilder('Magento\Webhook\Model\Resource\Job') - ->disableOriginalConstructor() - ->getMock(); - $mockResourceEvent->expects($this->once()) - ->method('getReadConnection') - ->will($this->returnValue($mockDBAdapter)); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - - $collection = new \Magento\Webhook\Model\Resource\Job\Collection( - $entityFactory, $logger, $mockFetchStrategy, $eventManager, $dateTime, null, $mockResourceEvent - ); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Job\Collection', $collection); - $this->assertEquals('Magento\Webhook\Model\Resource\Job', $collection->getResourceModelName()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php deleted file mode 100644 index 532478df6418a3e055a8b948c2fb8b6fb642e2e7..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/JobTest.php +++ /dev/null @@ -1,48 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Job - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class JobTest extends \PHPUnit_Framework_TestCase -{ - public function testConstruct() - { - $tableName = 'webhook_dispatch_job_table'; - $idFieldName = 'dispatch_job_id'; - $resourceMock = $this->getMockBuilder('Magento\App\Resource') - ->disableOriginalConstructor() - ->getMock(); - $resourceMock->expects($this->once()) - ->method('getTableName') - ->with('webhook_dispatch_job') - ->will($this->returnValue($tableName)); - - $job = new \Magento\Webhook\Model\Resource\Job ($resourceMock); - $this->assertEquals($tableName, $job->getMainTable() ); - $this->assertEquals($idFieldName, $job->getIdFieldName()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php deleted file mode 100644 index 0e68de55f89a03b83118dcf489f23dd5762d4f81..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/CollectionTest.php +++ /dev/null @@ -1,285 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Subscription\Collection - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - /** - * Arguments passed to methods under testing - */ - const TOPIC = 'customer/topic'; - const ALIAS = 'some_alias'; - const API_USER_ID = 'api_user id'; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_connectionMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_selectMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_endpointResMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_fetchStrategyMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_resourceMock; - - /** @var \Magento\Core\Model\EntityFactory */ - private $_entityFactory; - - /** - * @var \Magento\Event\ManagerInterface - */ - private $_eventManager; - - /** - * @var \Magento\Logger - */ - private $_loggerMock; - - protected function setUp() - { - $this->_loggerMock = $this->getMock('Magento\Logger', array(), array(), '', false); - $this->_selectMock = $this->_makeMock('Zend_Db_Select'); - $this->_selectMock->expects($this->any()) - ->method('from') - ->with(array('main_table' => null)); - $this->_connectionMock = $this->_makeMock('Magento\DB\Adapter\Pdo\Mysql'); - - $this->_connectionMock->expects($this->any()) - ->method('select') - ->will($this->returnValue($this->_selectMock)); - - // Arguments to collection constructor - $this->_eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - $this->_fetchStrategyMock = $this->_makeMock('Magento\Data\Collection\Db\FetchStrategyInterface'); - $this->_endpointResMock = $this->_makeMock('Magento\Webhook\Model\Resource\Endpoint'); - $this->_resourceMock = $this-> _makeMock('Magento\Webhook\Model\Resource\Subscription'); - $this->_resourceMock->expects($this->any()) - ->method('getReadConnection') - ->will($this->returnValue($this->_connectionMock)); - $this->_entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - } - - public function testInitialization() - { - $collection = $this->_makeCollectionMock(array('load')); // At least one method has to be specified - $this->assertEquals('Magento\Webhook\Model\Subscription', $collection->getModelName()); - $this->assertEquals('Magento\Webhook\Model\Resource\Subscription', $collection->getResourceModelName()); - } - - public function testGetSubscriptionsByTopic() - { - $subscriptions = array('subscription1', 'subscription2', 'subscription3'); - $methods = array('getItems', 'addTopicFilter'); - $collection = $this->_makeCollectionMock($methods); - - $collection->expects($this->once()) - ->method('getItems') - ->with() - ->will($this->returnValue($subscriptions)); - $collection->expects($this->once()) - ->method('addTopicFilter') - ->with(self::TOPIC) - ->will($this->returnSelf()); - - $this->assertEquals($subscriptions, $collection->getSubscriptionsByTopic(self::TOPIC)); - } - - public function testGetSubscriptionsByAlias() - { - $subscriptions = array('subscription1', 'subscription2', 'subscription3'); - $methods = array('getItems', 'addAliasFilter'); - $collection = $this->_makeCollectionMock($methods); - - $collection->expects($this->once()) - ->method('getItems') - ->with() - ->will($this->returnValue($subscriptions)); - $collection->expects($this->once()) - ->method('addAliasFilter') - ->with(self::ALIAS) - ->will($this->returnSelf()); - - $this->assertEquals($subscriptions, $collection->getSubscriptionsByAlias(self::ALIAS)); - } - - public function testGetActivatedSubscriptionsWithoutApiUser() - { - $methods = array('addEndpointIdsFilter', 'getItems'); - $subscriptions = array('subscription1', 'subscription2', 'subscription3'); - $endpointIds = array('endpoint_id_1','endpoint_id_2','endpoint_id_3'); - - $this->_endpointResMock->expects($this->once()) - ->method('getEndpointsWithoutApiUser') - ->will($this->returnValue($endpointIds)); - - $collection = $this->_makeCollectionMock($methods); - $collection->expects($this->once()) - ->method('addEndpointIdsFilter') - ->with($endpointIds) - ->will($this->returnSelf()); - $collection->expects($this->once()) - ->method('getItems') - ->will($this->returnValue($subscriptions)); - - $this->assertEquals($subscriptions, $collection->getActivatedSubscriptionsWithoutApiUser()); - } - - public function testGetApiUserSubscriptions() - { - $methods = array('addEndpointIdsFilter', 'getItems'); - $subscriptions = array('subscription1', 'subscription2', 'subscription3'); - $endpointIds = array('endpoint_id_1','endpoint_id_2','endpoint_id_3'); - - $this->_endpointResMock->expects($this->once()) - ->method('getApiUserEndpoints') - ->with(self::API_USER_ID) - ->will($this->returnValue($endpointIds)); - - $collection = $this->_makeCollectionMock($methods); - $collection->expects($this->once()) - ->method('addEndpointIdsFilter') - ->with($endpointIds) - ->will($this->returnSelf()); - $collection->expects($this->once()) - ->method('getItems') - ->will($this->returnValue($subscriptions)); - - $this->assertEquals($subscriptions, $collection->getApiUserSubscriptions(self::API_USER_ID)); - } - - public function testClearFilters() - { - $collection = $this->_makeCollectionMock(array('load')); - // Cannot test number of calls because other tests use this member - $this->_selectMock->expects($this->any()) - ->method('from') - ->with(array('main_table' => null)); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', $collection->clearFilters()); - } - - public function testAddEndpointIdsFilter() - { - $collection = $this->_makeCollectionMock(array('load')); - $endpointIds = array('endpoint_id_1','endpoint_id_2','endpoint_id_3'); - $this->_selectMock->expects($this->once()) - ->method('where') - ->with('endpoint_id IN (?)', $endpointIds); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addEndpointIdsFilter($endpointIds)); - } - - public function testAddTopicFilter() - { - $this->_connectionMock->expects($this->once()) - ->method('quoteInto') - ->with('hooks.subscription_id=main_table.subscription_id AND hooks.topic=?', self::TOPIC); - $collection = $this->_makeCollectionMock(array('load')); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addTopicFilter(self::TOPIC)); - } - - public function testAddAliasFilter() - { - $collection = $this->_makeCollectionMock(array('addFieldToFilter')); - $collection->expects($this->once()) - ->method('addFieldToFilter') - ->with('alias', self::ALIAS); - - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addAliasFilter(self::ALIAS)); - } - - public function testAddIsActiveFilter() - { - $collection = $this->_makeCollectionMock(array('addFieldToFilter')); - $collection->expects($this->once()) - ->method('addFieldToFilter') - ->with('status', \Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addIsActiveFilter(true)); - } - - public function testAddIsActiveFilterNotActive() - { - $collection = $this->_makeCollectionMock(array('addFieldToFilter')); - $collection->expects($this->once()) - ->method('addFieldToFilter') - ->with('status', \Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addIsActiveFilter(false)); - } - - public function testAddNotInactiveFilter() - { - $collection = $this->_makeCollectionMock(array('load')); - $this->_selectMock->expects($this->any()) - ->method('where') - ->with('status IN (?)', array( - \Magento\Webhook\Model\Subscription::STATUS_ACTIVE, - \Magento\Webhook\Model\Subscription::STATUS_REVOKED)); - $this->assertInstanceOf('Magento\Webhook\Model\Resource\Subscription\Collection', - $collection->addNotInactiveFilter()); - } - - /** - * Generations a collection mock, with the given methods stubbed - * - * @param array $methods - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeCollectionMock(array $methods) - { - return $this->getMock('Magento\Webhook\Model\Resource\Subscription\Collection', $methods, - array( - $this->_entityFactory, - $this->_loggerMock, - $this->_fetchStrategyMock, - $this->_eventManager, - $this->_endpointResMock, - null, - $this->_resourceMock - ), '', true); - } - - /** - * Generates a mock object of the given class - * - * @param string $className - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php deleted file mode 100644 index 9b83ebb593d0e299f4ca20abda8b985c4cf6a844..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/Subscription/Grid/CollectionTest.php +++ /dev/null @@ -1,77 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Subscription\Grid\Collection - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource\Subscription\Grid; - -class CollectionTest extends \PHPUnit_Framework_TestCase -{ - public function testConstructor() - { - $eventManager = $this->getMock('Magento\Event\ManagerInterface', array(), array(), '', false); - - $fetchStrategyMock = $this->_makeMock('Magento\Data\Collection\Db\FetchStrategyInterface'); - $endpointResMock = $this->_makeMock('Magento\Webhook\Model\Resource\Endpoint'); - - $configMock = $this->_makeMock('Magento\Webhook\Model\Subscription\Config'); - $configMock->expects($this->once()) - ->method('updateSubscriptionCollection'); - - $selectMock = $this->_makeMock('Zend_Db_Select'); - $selectMock->expects($this->any()) - ->method('from') - ->with(array('main_table' => null)); - $connectionMock = $this->_makeMock('Magento\DB\Adapter\Pdo\Mysql'); - $connectionMock->expects($this->any()) - ->method('select') - ->will($this->returnValue($selectMock)); - $resourceMock = $this-> _makeMock('Magento\Webhook\Model\Resource\Subscription'); - $resourceMock->expects($this->any()) - ->method('getReadConnection') - ->will($this->returnValue($connectionMock)); - /** @var \Magento\Core\Model\EntityFactory $entityFactory */ - $entityFactory = $this->getMock('Magento\Core\Model\EntityFactory', array(), array(), '', false); - $logger = $this->getMock('Magento\Logger', array(), array(), '', false); - new \Magento\Webhook\Model\Resource\Subscription\Grid\Collection( - $entityFactory, $logger, $fetchStrategyMock, - $eventManager, $endpointResMock, $configMock, null, $resourceMock - ); - } - - /** - * Generates a mock object of the given class - * - * @param string $className - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } - -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php deleted file mode 100644 index 664791975a70b8f10c53207eeb7404f5a1948361..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Resource/SubscriptionTest.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Resource\Subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Resource; - -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - const MAIN_TABLE_NAME = 'webhook_subscription_table'; - const HOOK_TABLE_NAME = 'webhook_subscription_hook_table'; - const SUBSCRIPTION_ID = '1'; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_selectMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_adapterMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_resourceMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_configMock; - - /** - * Unit under testing. - * - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $_subxResourceMock; - - protected function setUp() - { - $this->_selectMock = $this->_makeMock('Magento\DB\Select'); - $this->_resourceMock = $this->_makeMock('Magento\App\Resource'); - $this->_adapterMock = $this->_makeMock('Magento\DB\Adapter\Pdo\Mysql'); - $this->_adapterMock->expects($this->any()) - ->method('select') - ->with() - ->will($this->returnValue($this->_selectMock)); - - // Config mock - $this->_configMock = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false); - $configArray = array( - 'a' => array( - 'label' => 'label' - ), - 'c' => array( - 'label' => 'label' - ) - ); - $this->_configMock->expects($this->once()) - ->method('getWebhooks') - ->will($this->returnValue($configArray)); - } - - /** - * Tests methods which can only be executed by calling the parent's save method. - * - * Includes _afterSave, _updateTopics, _getSupportedTopics, and _performTopicUpdates - */ - public function testMethodsUnderSave() - { - $data = array('subscription_id' => null); - - // Subscription resource - $methods = array('_getWriteAdapter', '_getReadAdapter', '_prepareDataForSave', 'getMainTable', 'getTable'); - - $this->_subxResourceMock = $this->_makeSubscriptionResourceMock($methods); - $this->_subxResourceMock->expects($this->any()) - ->method('_prepareDataForSave') - ->will($this->returnValue($data)); - $this->_subxResourceMock->expects($this->any()) - ->method('getMainTable') - ->will($this->returnValue('webhook_subscription_table')); - $this->_subxResourceMock->expects($this->any()) - ->method('getTable') - ->will($this->returnValue(self::HOOK_TABLE_NAME)); - $this->_subxResourceMock->expects($this->any()) - ->method('_getWriteAdapter') - ->will($this->returnValue($this->_adapterMock)); - $this->_subxResourceMock->expects($this->any()) - ->method('_getReadAdapter') - ->will($this->returnValue($this->_adapterMock)); - - // Select stubs - $this->_selectMock->expects($this->once()) - ->method('from') - ->with(self::HOOK_TABLE_NAME, 'topic') - ->will($this->returnSelf()); - $this->_selectMock->expects($this->once()) - ->method('where') - ->with('subscription_id = ?', self::SUBSCRIPTION_ID) - ->will($this->returnSelf()); - - // Subscription model mock - $subscriptionMock = $this->_makeMock('Magento\Webhook\Model\Subscription'); - $subscriptionMock->expects($this->any()) - ->method('getId') - ->with() - ->will($this->returnValue(self::SUBSCRIPTION_ID)); - - // Tests logic to update and save topics - $newTopics = array('a'=>'a', 'b'=>'b'); - $oldTopics = array('c'=>'c'); - - $this->_adapterMock->expects($this->once()) - ->method('fetchCol') - ->with($this->_selectMock) - ->will($this->returnValue( $oldTopics )); - $subscriptionMock->expects($this->once()) - ->method('getData') - ->with('topics') - ->will($this->returnValue($newTopics)); - // Adapter stubs - $this->_adapterMock->expects($this->once()) - ->method('delete') - ->with(self::HOOK_TABLE_NAME, array( - 'subscription_id = ?' => self::SUBSCRIPTION_ID, - 'topic in (?)' => array('c' => 'c') - )); - $this->_adapterMock->expects($this->once()) - ->method('insertMultiple') - ->with(self::HOOK_TABLE_NAME, array( - array('subscription_id' => self::SUBSCRIPTION_ID, 'topic' => 'a') - )); - - $this->_subxResourceMock->save($subscriptionMock); - } - - /** - * Tests _afterLoad and loadTopics - */ - public function testMethodsUnderLoad() - { - // Subscription resource mock - $methods = array('_getWriteAdapter', '_getReadAdapter', '_prepareDataForSave', 'getMainTable', 'getTable'); - - $this->_subxResourceMock = $this->_makeSubscriptionResourceMock($methods); - $this->_subxResourceMock->expects($this->any()) - ->method('getMainTable') - ->will($this->returnValue(self::MAIN_TABLE_NAME)); - $this->_subxResourceMock->expects($this->any()) - ->method('getTable') - ->will($this->returnValue(self::HOOK_TABLE_NAME)); - $this->_subxResourceMock->expects($this->any()) - ->method('_getReadAdapter') - ->will($this->returnValue($this->_adapterMock)); - - // Select stubs - $this->_selectMock->expects($this->exactly(2)) - ->method('from') - ->will($this->returnSelf()); - $this->_selectMock->expects($this->exactly(2)) - ->method('where') - ->will($this->returnSelf()); - - // Subscription model mock - $subscriptionMock = $this->_makeMock('Magento\Webhook\Model\Subscription'); - $subscriptionMock->expects($this->any()) - ->method('getId') - ->with() - ->will($this->returnValue(self::SUBSCRIPTION_ID)); - - $this->_subxResourceMock->load($subscriptionMock, self::SUBSCRIPTION_ID); - } - - /** - * Generates a mock object of the given class - * - * @param string $className - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeMock($className) - { - return $this->getMockBuilder($className) - ->disableOriginalConstructor() - ->getMock(); - } - - /** - * Generates a mock subscription resource with the given methods stubbed - * - * @param $methods - * @return \PHPUnit_Framework_MockObject_MockObject - */ - private function _makeSubscriptionResourceMock($methods) - { - return $this->getMock( - 'Magento\Webhook\Model\Resource\Subscription', - $methods, - array($this->_resourceMock, $this->_configMock), - '', - true - ); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/AuthenticationTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/AuthenticationTest.php deleted file mode 100644 index 2b400958fd606f51368851912e8c6392eeaa3fe0..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/AuthenticationTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Source\Authentication - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class AuthenticationTest extends \Magento\Webhook\Model\Source\Pkg -{ - public function testGetAuthenticationsForForm() - { - $unitUnderTest = new \Magento\Webhook\Model\Source\Authentication(array('type' => 'blah')); - $elements = $unitUnderTest->getAuthenticationsForForm(); - $this->_assertElements($elements); - - // Verify that we return cached results - $secondResult = $unitUnderTest->getAuthenticationsForForm(); - $this->assertEquals($elements, $secondResult); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/FormatTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/FormatTest.php deleted file mode 100644 index 96b324e4c01ad676f93ba002d257380245be22c2..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/FormatTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Source\Format - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class FormatTest extends \Magento\Webhook\Model\Source\Pkg -{ - public function testGetFormatsForForm() - { - $unitUnderTest = new \Magento\Webhook\Model\Source\Format(array('type' => 'blah')); - $elements = $unitUnderTest->getFormatsForForm(); - $this->_assertElements($elements); - - // Verify that we return cached results - $secondResult = $unitUnderTest->getFormatsForForm(); - $this->assertEquals($elements, $secondResult); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/HookTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/HookTest.php deleted file mode 100644 index fde78c734b2bad28dc6b257a9f316a187620e49b..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/HookTest.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Source\Hook - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class HookTest extends \Magento\Webhook\Model\Source\Pkg -{ - public function testGetTopicsForForm() - { - $unitUnderTest = new \Magento\Webhook\Model\Source\Hook($this->_mockConfig); - $elements = $unitUnderTest->getTopicsForForm(); - $this->_assertElements($elements); - - // Verify that we return cached results - $secondResult = $unitUnderTest->getTopicsForForm(); - $this->assertEquals($elements, $secondResult); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php deleted file mode 100644 index 382bf2d79f210c4bb9e76b8b9636c7b4ba908d69..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Source/Pkg.php +++ /dev/null @@ -1,69 +0,0 @@ -<?php -/** - * Parent class for Source tests that provides common functionality. - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @subpackage unit_tests - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Source; - -class Pkg extends \PHPUnit_Framework_TestCase -{ - /** Config values */ - const CONFIG_LABEL = 'blah'; - const CONFIG_STATUS = 'enabled'; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockConfig; - - /** @var array() */ - protected $_modelConfigElement; - - protected function setUp() - { - $label = self::CONFIG_LABEL; - $status = self::CONFIG_STATUS; - $this->_modelConfigElement = array( - 'type' => array( - 'status' => $status, - 'label' => $label - ) - ); - $this->_mockConfig = $this->getMock('Magento\Webhook\Model\Config', array(), array(), '', false); - $this->_mockConfig->expects($this->any()) - ->method('getWebhooks') - ->will($this->returnValue($this->_modelConfigElement)); - } - - /** - * Asserts that the elements array contains the expected label and value. - * - * @param $elements - */ - protected function _assertElements($elements) - { - $this->assertSame(self::CONFIG_LABEL, $elements[0]['label']); - $this->assertSame('type', $elements[0]['value']); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php deleted file mode 100644 index d9a98418850ba5b8af32cbd6fb5c40a521e604c6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/ConfigTest.php +++ /dev/null @@ -1,263 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Subscription\Config - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription; - -class ConfigTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Subscription\Config that is also our unit under test */ - protected $_config; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockMageConfig; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockSubscribFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockCollection; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockLogger; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockSubscription; - - protected function setUp() - { - $this->_mockSubscription = $this->_createMockSubscription(); - } - - public function testSettingNameNewSubscription() - { - - // Set expectations - $this->_mockSubscription->expects($this->atLeastOnce()) - ->method('save'); - $this->_mockSubscription->expects($this->atLeastOnce()) - ->method('setName') - ->with($this->equalTo('Extension Name')); - - $settingNameXml = - array( - 'setting_name' => - array('name' => 'Extension Name') - ); - $this->_stubMock($settingNameXml); - - // Run test - $this->_config->updateSubscriptionCollection(); - } - - public function testNameMissing() - { - // Set expectations - $this->_mockSubscription->expects($this->never()) - ->method('save'); - $this->_mockSubscription->expects($this->never()) - ->method('setName'); - - $expectedErrors = array( - __("Invalid config data for subscription '%1'.", 'name_missing'), - ); - - $nameMissingXml = array('name_missing' => array()); - $this->_stubMock($nameMissingXml, null, $expectedErrors); - - // Run test - $this->_config->updateSubscriptionCollection(); - } - - public function testSettingNameExistingSubscription() - { - // Make sure we never call save or setName on the existing subscription - $existingSubscription = $this->_createMockSubscription(); - $existingSubscription->expects($this->once()) - ->method('save'); - $existingSubscription->expects($this->once()) - ->method('setName'); - - - // Set expectations - $this->_mockSubscription->expects($this->never()) - ->method('save'); - $this->_mockSubscription->expects($this->never()) - ->method('setName'); - - $subxCollection = $this->_createMockSubscriptionCollection( - array( - 'setting_name_on_existing_subscription' => array(&$existingSubscription) - ) - ); - - $existingArray = array( - 'setting_name_on_existing_subscription' => - array( - 'name' => 'Extension Name', - 'topics' => array( - 'topic_one' => array('subcall') - ) - ) - ); - $this->_stubMock($existingArray, $subxCollection); - - // Run test - $this->_config->updateSubscriptionCollection(); - } - - public function testSettingAuthenticationType() - { - - // Set expectations - $this->_mockSubscription->expects($this->atLeastOnce()) - ->method('save'); - $this->_mockSubscription->expects($this->atLeastOnce()) - ->method('setName') - ->with($this->equalTo('Extension Name')); - $this->_mockSubscription->expects($this->atLeastOnce()) - ->method('setAuthenticationType') - ->with($this->equalTo('HMAC')); - - $authentificationType = array( - 'setting_authentication_type' => - array('name' => 'Extension Name', - 'authentication_type' => 'HMAC') - ); - $this->_stubMock($authentificationType); - - // Run test - $this->_config->updateSubscriptionCollection(); - } - - /** - * Internal factory for mock subscription, stubs necessary magic methods - * - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _createMockSubscription() - { - // We need to define all magic methods. Once we define any method, we need to define all methods - // If we don't define any methods, then we can only stub out concrete methods, but not any - // of the magic methods, since they weren't explicitly defined. - $methods = array('setData', 'getData', 'unsetData', 'save', 'setName', 'setTopics', 'setFormat', - 'setEndpointUrl', 'getAuthenticationOptions', 'unsetAuthenticationOption', - 'setAuthenticationType', '__wakeup'); - $mock = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->setMethods($methods) - ->getMock(); - foreach ($methods as $method) { - $mock->expects($this->any()) - ->method($method) - ->will($this->returnSelf()); - } - return $mock; - } - - /** - * Initializes a set of mocks and stubs - * - * @param \Magento\Core\Model\Config\Element $configNode - * @param \PHPUnit_Framework_MockObject_MockObject $subxCollection - * Mocks \Magento\Webhook\Model\Resource\Subscription\Collection - * @param string[] $expectedErrors - */ - protected function _stubMock($configNode, $subxCollection = null, $expectedErrors = null) - { - // Mock objects - $this->_mockCollection = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription\Collection') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockMageConfig = $this->getMockBuilder('\Magento\Webhook\Model\Config') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockSubscribFactory = $this->getMockBuilder('Magento\Webhook\Model\Subscription\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockLogger = $this->getMockBuilder('Magento\Logger') - ->disableOriginalConstructor() - ->getMock(); - - // Stub create - $this->_mockSubscribFactory->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_mockSubscription)); - - // Stub logException - if ($expectedErrors !== null) { - $this->_mockLogger->expects($this->once()) - ->method('logException') - ->with($this->equalTo(new \Magento\Webhook\Exception(implode("\n", $expectedErrors)))); - } - - $this->_mockMageConfig->expects($this->any()) - ->method('getSubscriptions') - ->will($this->returnValue($configNode)); - - // Get or set subscription collection mock - if ($subxCollection !== null) { - $this->_mockCollection = $subxCollection; - } else { - $this->_mockCollection = $this->_createMockSubscriptionCollection(); - } - - // Create config object - $this->_config = new \Magento\Webhook\Model\Subscription\Config( - $this->_mockCollection, - $this->_mockMageConfig, - $this->_mockSubscribFactory, - $this->_mockLogger); - } - - /** - * Pseudo-factory method for mock subscription collection - * - * @param array $idToSubscriptionsMap - * @return \PHPUnit_Framework_MockObject_MockObject - */ - protected function _createMockSubscriptionCollection($idToSubscriptionsMap = array()) - { - $mock = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription\Collection') - ->disableOriginalConstructor() - ->getMock(); - // Order matters when mocking out methods. We need the more restrictive one first. - foreach ($idToSubscriptionsMap as $id => $subscriptions) { - $mock->expects($this->any()) - ->method('getSubscriptionsByAlias') - ->with($this->equalTo($id)) - ->will($this->returnValue($subscriptions)); - } - // Put the less restrictive stub at the end - $mock->expects($this->any()) - ->method('getSubscriptionsByAlias') - ->will($this->returnValue(array())); - return $mock; - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/FactoryTest.php deleted file mode 100644 index e1537e9d897ec5b1abbf17fa5dfe8cfcd9360154..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/FactoryTest.php +++ /dev/null @@ -1,67 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Subscription\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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockObjectManager; - - /** @var \Magento\Webhook\Model\Subscription\Factory */ - private $_factory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockSubscription; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $this->_factory = new \Magento\Webhook\Model\Subscription\Factory($this->_mockObjectManager); - } - - public function testCreate() - { - $mockSubscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $dataArray = array('test' => 'data'); - $mockSubscription->expects($this->once()) - ->method('setData') - ->with($dataArray); - $this->_mockObjectManager->expects($this->once()) - ->method('create') - ->with($this->equalTo('Magento\Webhook\Model\Subscription'), $this->equalTo(array())) - ->will($this->returnValue($mockSubscription)); - $this->assertSame($mockSubscription, $this->_factory->create($dataArray)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php deleted file mode 100644 index 0c61036ca4dac35d3674038ffcb6887f9158a68e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Subscription/Options/StatusTest.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Subscription\Options\Status - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Subscription\Options; - -class StatusTest extends \PHPUnit_Framework_TestCase -{ - public function testToOptionArray() - { - $translatorMock = $this->getMockBuilder('Magento\Core\Model\Translate') - ->disableOriginalConstructor() - ->getMock(); - $translatorMock->expects($this->any()) - ->method('translate') - ->will($this->returnCallback(array($this, 'translateCallback'))); - $object = new \Magento\Webhook\Model\Subscription\Options\Status($translatorMock); - $expectedArray = array( - \Magento\Webhook\Model\Subscription::STATUS_ACTIVE => 'Active', - \Magento\Webhook\Model\Subscription::STATUS_REVOKED => 'Revoked', - \Magento\Webhook\Model\Subscription::STATUS_INACTIVE => 'Inactive', - ); - $this->assertEquals($expectedArray, $object->toOptionArray()); - } - - /** - * Translates array of inputs into string - * - * @param array $inputs - * @return string - */ - public static function translateCallback(array $inputs) - { - return implode("\n", $inputs); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php deleted file mode 100644 index bcf4362f09d8f1f99584af0680bc81a21514b2b0..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/SubscriptionTest.php +++ /dev/null @@ -1,529 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Subscription - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class SubscriptionTest extends \PHPUnit_Framework_TestCase -{ - /** - * Unit under test - * - * @var \Magento\Webhook\Model\Subscription|PHPUnit_Framework_MockObject_MockObject - */ - protected $_subscription; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockEndpoint; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockContext; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockUser; - - protected function setUp() - { - $this->_mockEndpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') - ->setMethods(array('_init', 'save', 'setEndpointId', 'getId', 'getUser', '_getResource', 'delete', - 'load', 'hasDataChanges', '__wakeup')) - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockUser = $this->getMockBuilder('Magento\Webhook\Model\User') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockEndpoint->expects($this->any()) - ->method('getUser') - ->will($this->returnValue($this->_mockUser)); - - $mockEventDispatcher = $this->getMockBuilder('Magento\Event\ManagerInterface') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockContext = $this->getMockBuilder('Magento\Core\Model\Context') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockContext->expects($this->any()) - ->method('getEventDispatcher') - ->withAnyParameters() - ->will($this->returnValue($mockEventDispatcher)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = new \Magento\Stdlib\DateTime; - - $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->setMethods(array('_init', '_hasModelChanged', '_getResource')) - ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_mockEndpoint, $dateTime)) - ->getMock(); - - $subscriptionResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $this->_subscription->expects($this->any()) - ->method('_getResource') - ->will($this->returnValue($subscriptionResource)); - } - - public function testFindRestrictedTopics() - { - $this->_mockUser->expects($this->atLeastOnce()) - ->method('hasPermission') - ->will( - $this->returnValueMap( - array( - array('restricted', false), - array('allowed', true), - ) - ) - ); - - $this->_subscription->setTopics(array('restricted', 'allowed')); - - $restrictedTopics = $this->_subscription->findRestrictedTopics(); - - $this->assertEquals(array('restricted'), $restrictedTopics); - } - - public function testFindRestrictedTopicsWithNoUser() - { - $dateTime = new \Magento\Stdlib\DateTime; - // The only way to override a pre-existing implementation is to create a new object - $this->_mockEndpoint = $this->getMockBuilder('Magento\Webhook\Model\Endpoint') - ->setMethods(array( - '__wakeup', '_init', 'save', 'setEndpointId', 'getId', 'getUser', '_getResource', 'delete' - )) - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockEndpoint->expects($this->once()) - ->method('getUser') - ->will($this->returnValue(null)); - - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - - $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->setMethods(array('_init', '_hasModelChanged', '_getResource')) - ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_mockEndpoint, $dateTime)) - ->getMock(); - - $this->_subscription->setTopics(array('restricted', 'allowed')); - - $restrictedTopics = $this->_subscription->findRestrictedTopics(); - - $this->assertEmpty($restrictedTopics); - } - - public function testAfterDelete() - { - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = new \Magento\Stdlib\DateTime; - - // it's useful to mock out more methods for the purposes of testing this one method - $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->setMethods( - array('hasStatus', 'setStatus', 'hasRegistrationMechanism', - 'setRegistrationMechanism', 'getEndpointId', 'setEndpointId', 'setUpdatedAt', - 'hasDataChanges', '_init', '_hasModelChanged', '_getResource') - ) - ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_mockEndpoint, $dateTime)) - ->getMock(); - - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') - ->disableOriginalConstructor() - ->getMock(); - - $this->_subscription->expects($this->any()) - ->method('_getResource') - ->withAnyParameters() - ->will($this->returnValue($mockResource)); - - $this->_mockEndpoint->expects($this->once()) - ->method('delete'); - - $this->_subscription->setEndpointUrl('http://localhost'); - $this->_subscription->delete(); - } - - /** - * @dataProvider beforeSaveDataProvider - * - * @param $hasRegiMechanism - * @param $hasDataChanges - * @param $hasEndpointChanges - * @param $hasEndpointId - */ - public function testBeforeSave($hasRegiMechanism, $hasEndpointChanges, $hasEndpointId, $hasDataChanges) - { - $coreRegistry = $this->getMock('Magento\Core\Model\Registry', array(), array(), '', false); - $dateTime = $this->getMock('\Magento\Stdlib\DateTime', array('formatDate')); - - // it's useful to mock out more methods for the purposes of testing this one method - $this->_subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->setMethods( - array('hasStatus', 'setStatus', 'hasRegistrationMechanism', 'setRegistrationMechanism', 'getEndpointId', - 'setEndpointId', 'setUpdatedAt', 'hasDataChanges', '_init', '_hasModelChanged', '_getResource') - ) - ->setConstructorArgs(array($this->_mockContext, $coreRegistry, $this->_mockEndpoint, $dateTime)) - ->getMock(); - - $mockResource = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription') - ->disableOriginalConstructor() - ->getMock(); - - $mockResource->expects($this->once()) - ->method('addCommitCallback') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_subscription->expects($this->any()) - ->method('_getResource') - ->withAnyParameters() - ->will($this->returnValue($mockResource)); - - $this->_subscription->expects($this->once()) - ->method('_hasModelChanged') - ->withAnyParameters() - ->will($this->returnValue(true)); - - $this->_expectHasRegistrationMechanism($hasRegiMechanism); - - $this->_expectEndpointOrId($hasEndpointChanges, $hasEndpointId); - - $this->_expectSubscriptionHasDataChanges($hasDataChanges, $dateTime); - - $this->assertEquals($this->_subscription, $this->_subscription->save()); - } - - /** - * Mock out the subscription depending on whether or not it will have a registration mechanism - * - * @param $hasRegiMechanism - */ - protected function _expectHasRegistrationMechanism($hasRegiMechanism) - { - $this->_subscription->expects($this->once()) - ->method('hasRegistrationMechanism') - ->will($this->returnValue($hasRegiMechanism)); - if (!$hasRegiMechanism) { - $this->_subscription->expects($this->once()) - ->method('setRegistrationMechanism') - ->with($this->equalTo(\Magento\Webhook\Model\Subscription::REGISTRATION_MECHANISM_MANUAL)); - } else { - $this->_subscription->expects($this->never()) - ->method('setRegistrationMechanism'); - } - } - - /** - * Mock out the subscription depending on whether or not it will have an endpoint and/or an endpoint id - * - * @param $hasEndpointChanges - * @param $hasEndpointId - */ - protected function _expectEndpointOrId($hasEndpointChanges, $hasEndpointId) - { - $this->_mockEndpoint->expects($this->any()) - ->method('hasDataChanges') - ->will($this->returnValue($hasEndpointChanges)); - - if ($hasEndpointChanges) { - $this->_subscription->expects($this->any()) - ->method('getEndpointId') - ->will($this->returnValue($hasEndpointId ? 'id' : null)); - - if ($hasEndpointId) { - $this->_mockEndpoint->expects($this->atLeastOnce()) - ->method('load') - ->with($this->equalTo('id')) - ->will($this->returnValue($this->_mockEndpoint)); - $this->_mockEndpoint->expects($this->never()) - ->method('getId'); - $this->_subscription->expects($this->never()) - ->method('setEndpointId'); - } else { - $this->_mockEndpoint->expects($this->never()) - ->method('load'); - $this->_mockEndpoint->expects($this->once()) - ->method('getId') - ->will($this->returnValue('id')); - $this->_subscription->expects($this->once()) - ->method('setEndpointId') - ->with($this->equalTo('id')); - } - - $this->_mockEndpoint->expects($this->once()) - ->method('save'); - - // we need to make a call that will set the endpoint - // this should end up calling the factory to create an endpoint - $this->_subscription->getEndpointUrl(); - } else { - $this->_mockEndpoint->expects($this->never()) - ->method('save'); - $this->_subscription->expects($this->never()) - ->method('getEndpointId'); - $this->_mockEndpoint->expects($this->never()) - ->method('getId'); - $this->_subscription->expects($this->never()) - ->method('setEndpointId'); - } - } - - /** - * Mock out the subscription depending on whether or not it will have data changes - * - * @param $hasDataChanges - * @param $dateTime - */ - protected function _expectSubscriptionHasDataChanges($hasDataChanges, $dateTime) - { - $this->_subscription->expects($this->once()) - ->method('hasDataChanges') - ->will($this->returnValue($hasDataChanges)); - if ($hasDataChanges) { - $someFormattedTime = '2013-07-10 12:35:28'; - $dateTime->expects($this->once()) - ->method('formatDate') - ->withAnyParameters() - ->will($this->returnValue($someFormattedTime)); - $this->_subscription->expects($this->once()) - ->method('setUpdatedAt') - ->with($this->equalTo($someFormattedTime)); - } else { - $dateTime->expects($this->never()) - ->method('formatDate'); - $this->_subscription->expects($this->never()) - ->method('setUpdatedAt'); - } - } - - /** - * Returns all possible arrays with 5 boolean values. - * e.g. (true, false, true, false, true) etc. - * - * @return array of all possible combinations of 5 boolean values - */ - public function beforeSaveDataProvider() - { - return $this->_allNBitCombinations(4); - } - - /** - * Generates all $arrayLength bit combinations in the format of arrays containing true/false values - * - * @param $arrayLength int non-negative value - * - * @return array all combinations of arrays with $arrayLength true/false values - */ - protected function _allNBitCombinations($arrayLength) - { - $returnValue = array(); - if (0 == $arrayLength) { - $returnValue[] = array(); - } elseif (0 < $arrayLength) { - foreach (array(true, false) as $suffix) { - foreach ($this->_allNBitCombinations($arrayLength - 1) as $subset) { - $subset[] = $suffix; - $returnValue[] = $subset; - } - } - } - return $returnValue; - } - - public function testGetSetData() - { - $keys = array('endpoint_url', 'format', 'authentication_type', 'api_user_id', 'timeout_in_secs'); - // test individual set/get - foreach ($keys as $key) { - $value = 'some value'; - $this->assertNull($this->_subscription->getData($key)); - $this->assertSame($this->_subscription, $this->_subscription->setData($key, $value)); - $this->assertSame($value, $this->_subscription->getData($key)); - } - - // test setting all data - $data = array( - 'endpoint_url' => 'some endpoint url', - 'format' => 'some format', - 'authentication_type' => 'some authentication type', - 'api_user_id' => 'some api user id', - 'timeout_in_secs' => 'some timeout in secs', - ); - $this->assertSame($this->_subscription, $this->_subscription->setData($data)); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame($data, $this->_subscription->getData()); - } - - public function testName() - { - $this->assertNull($this->_subscription->getName()); - $this->assertSame($this->_subscription, $this->_subscription->setName('some name')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some name', $this->_subscription->getName()); - } - - public function testEndpointId() - { - $this->assertNull($this->_subscription->getEndpointId()); - $this->assertSame($this->_subscription, $this->_subscription->setEndpointId('some endpoint id')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some endpoint id', $this->_subscription->getEndpointId()); - } - - public function testUpdatedAt() - { - $this->assertNull($this->_subscription->getUpdatedAt()); - $this->assertSame($this->_subscription, $this->_subscription->setUpdatedAt('some time')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some time', $this->_subscription->getUpdatedAt()); - } - - public function testStatus() - { - $this->assertTrue($this->_subscription->hasStatus()); - $this->assertEquals(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE, $this->_subscription->getStatus()); - $this->assertSame( - $this->_subscription, $this->_subscription->setStatus(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE) - ); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertTrue($this->_subscription->hasStatus()); - $this->assertSame(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $this->_subscription->getStatus()); - } - - public function testDeactivate() - { - $this->_subscription->deactivate(); - $this->assertFalse($this->_subscription->hasDataChanges()); - $this->assertSame(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE, $this->_subscription->getStatus()); - } - - public function testActivateDeactivate() - { - $this->_subscription->activate(); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame(\Magento\PubSub\SubscriptionInterface::STATUS_ACTIVE, $this->_subscription->getStatus()); - - $this->_subscription->setDataChanges(false); - $this->_subscription->deactivate(); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame(\Magento\PubSub\SubscriptionInterface::STATUS_INACTIVE, $this->_subscription->getStatus()); - } - - public function testRevoke() - { - $this->_subscription->revoke(); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame(\Magento\PubSub\SubscriptionInterface::STATUS_REVOKED, $this->_subscription->getStatus()); - } - - public function testAlias() - { - $this->assertNull($this->_subscription->getAlias()); - $this->assertSame($this->_subscription, $this->_subscription->setAlias('some alias')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some alias', $this->_subscription->getAlias()); - } - - public function testTopics() - { - $this->assertNull($this->_subscription->getTopics()); - $this->assertSame($this->_subscription, $this->_subscription->setTopics(array('topic_one', 'topic_two'))); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertTrue($this->_subscription->hasTopic('topic_one')); - $this->assertTrue($this->_subscription->hasTopic('topic_two')); - $this->assertFalse($this->_subscription->hasTopic('topic_three')); - $this->assertSame(array('topic_one', 'topic_two'), $this->_subscription->getTopics()); - } - - public function testRegistrationMechanism() - { - $this->assertFalse($this->_subscription->hasRegistrationMechanism()); - $this->assertNull($this->_subscription->getRegistrationMechanism()); - $this->assertSame( - $this->_subscription, - $this->_subscription->setRegistrationMechanism( - \Magento\Webhook\Model\Subscription::REGISTRATION_MECHANISM_MANUAL - ) - ); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertTrue($this->_subscription->hasRegistrationMechanism()); - $this->assertSame( - \Magento\Webhook\Model\Subscription::REGISTRATION_MECHANISM_MANUAL, - $this->_subscription->getRegistrationMechanism() - ); - } - - public function testEndpointUrl() - { - $this->assertNull($this->_subscription->getEndpointUrl()); - $this->assertSame($this->_subscription, $this->_subscription->setEndpointUrl('some endpoint url')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some endpoint url', $this->_subscription->getEndpointUrl()); - } - - public function testTimeOutInSeconds() - { - $this->assertNull($this->_subscription->getTimeoutInSecs()); - $this->assertSame($this->_subscription, $this->_subscription->setTimeoutInSecs('some timeout in secs')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some timeout in secs', $this->_subscription->getTimeoutInSecs()); - } - - public function testFormat() - { - $this->assertNull($this->_subscription->getFormat()); - $this->assertSame($this->_subscription, $this->_subscription->setFormat('some format')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some format', $this->_subscription->getFormat()); - } - - public function testApiUserId() - { - $this->assertNull($this->_subscription->getApiUserId()); - $this->assertSame($this->_subscription, $this->_subscription->setApiUserId('some api user id')); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some api user id', $this->_subscription->getApiUserId()); - } - - public function testUser() - { - $this->assertSame($this->_mockUser, $this->_subscription->getUser()); - } - - public function testAuthenticationType() - { - $this->assertNull($this->_subscription->getAuthenticationType()); - $this->assertSame( - $this->_subscription, $this->_subscription->setAuthenticationType('some authentication type') - ); - $this->assertTrue($this->_subscription->hasDataChanges()); - $this->assertSame('some authentication type', $this->_subscription->getAuthenticationType()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/User/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/User/FactoryTest.php deleted file mode 100644 index 389706172707aa089afefe2446dd893bb29c4e27..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/User/FactoryTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\User\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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\User; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - public function test() - { - $mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - - $factory = new \Magento\Webhook\Model\User\Factory($mockObjectManager); - - $mockUser = $this->getMockBuilder('Magento\Webhook\Model\User') - ->disableOriginalConstructor() - ->getMock(); - - $webapiUserId = 'userId'; - - $mockObjectManager->expects($this->once()) - ->method('create') - ->with('Magento\Webhook\Model\User', array('webapiUserId' => $webapiUserId)) - ->will($this->returnValue($mockUser)); - - $this->assertSame($mockUser, $factory->create($webapiUserId)); - } - -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/UserTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/UserTest.php deleted file mode 100644 index 565acebba8d6ba1ed13a03c99e0ecabbe902eb04..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/UserTest.php +++ /dev/null @@ -1,132 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\User - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model; - -class UserTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\User */ - protected $_user; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockAclUser; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockAuthorization; - - protected function setUp() - { - $webApiId = 'web api id'; - - $this->_mockAclUser = $this->getMockBuilder('Magento\Webapi\Model\Acl\User\Factory') - ->setMethods(array('load', 'getRoleId', 'getSecret')) - ->disableOriginalConstructor() - ->getMock(); - - $mockUserFactory = $this->getMockBuilder('Magento\Webapi\Model\Acl\User\Factory') - ->setMethods(array('create')) - ->disableOriginalConstructor() - ->getMock(); - - $mockUserFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($this->_mockAclUser)); - - $this->_mockAclUser->expects($this->once()) - ->method('load') - ->with($this->equalTo($webApiId)); - - $mockRLocatorFactory = $this->getMockBuilder('Magento\Webapi\Model\Authorization\Role\Locator\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $this->_mockAclUser->expects($this->once()) - ->method('getRoleId') - ->will($this->returnValue('role_id')); - - $mockRLocatorFactory->expects($this->once()) - ->method('create') - ->with(array('data' => array('roleId' => 'role_id'))) - ->will($this->returnValue('role_locator')); - - $this->_mockAuthorization = $this->getMockBuilder('Magento\Authorization') - ->setMethods(array('isAllowed')) - ->disableOriginalConstructor() - ->getMock(); - - $mockAclPolicy = $this->getMockBuilder('Magento\Webapi\Model\Authorization\Policy\Acl') - ->disableOriginalConstructor() - ->getMock(); - - $mockAuthFactory = $this->getMockBuilder('Magento\Authorization\Factory') - ->disableOriginalConstructor() - ->getMock(); - - $mockAuthFactory->expects($this->once()) - ->method('create') - ->will($this->returnValue($this->_mockAuthorization)); - - $this->_user = new \Magento\Webhook\Model\User( - $mockUserFactory, - $mockRLocatorFactory, - $mockAclPolicy, - $mockAuthFactory, - $webApiId - ); - } - - public function testGetSharedSecret() - { - $sharedSecret = 'some random shared secret'; - - $this->_mockAclUser->expects($this->once()) - ->method('getSecret') - ->will($this->returnValue($sharedSecret)); - - $this->assertSame($sharedSecret, $this->_user->getSharedSecret()); - } - - public function testHasPermission() - { - $allowedTopic = 'allowed topic'; - $notAllowedTopic = 'not allowed topic'; - - $this->_mockAuthorization->expects($this->any()) - ->method('isAllowed') - ->will( - $this->returnValueMap( - array( - array($allowedTopic, null, true), - array($notAllowedTopic, null, false) - ) - ) - ); - - $this->assertTrue($this->_user->hasPermission($allowedTopic)); - $this->assertFalse($this->_user->hasPermission($notAllowedTopic)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php deleted file mode 100644 index 86ea6f8e7bef45c9448f3ac1eb94e3194feb011e..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandler/FactoryTest.php +++ /dev/null @@ -1,57 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Webapi\EventHandler\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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\EventHandler; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_mockObjectManager; - - /** @var \Magento\Webhook\Model\Webapi\EventHandler\Factory */ - private $_factory; - - protected function setUp() - { - $this->_mockObjectManager = $this->getMockBuilder('Magento\ObjectManager') - ->disableOriginalConstructor() - ->getMock(); - $this->_factory = new \Magento\Webhook\Model\Webapi\EventHandler\Factory($this->_mockObjectManager); - } - - public function testCreate() - { - $mockEntity = $this->getMockBuilder('Magento\Webhook\Model\Webapi\EventHandler') - ->disableOriginalConstructor() - ->getMock(); - $this->_mockObjectManager->expects($this->once()) - ->method('create') - ->with($this->equalTo('Magento\Webhook\Model\Webapi\EventHandler'), $this->equalTo(array())) - ->will($this->returnValue($mockEntity)); - $this->assertSame($mockEntity, $this->_factory->create()); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandlerTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandlerTest.php deleted file mode 100644 index 536634d143698d8769f704383ff75cf4558cffa6..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/EventHandlerTest.php +++ /dev/null @@ -1,179 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Webapi\EventHandler - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi; - -class EventHandlerTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Webapi\EventHandler */ - protected $_eventHandler; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_collection; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_resourceAclUser; - - protected function setUp() - { - $this->_collection = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription\Collection') - ->disableOriginalConstructor() - ->getMock(); - $this->_resourceAclUser = $this->getMockBuilder('Magento\Webapi\Model\Resource\Acl\User') - ->disableOriginalConstructor() - ->getMock(); - - $this->_eventHandler = new \Magento\Webhook\Model\Webapi\EventHandler( - $this->_collection, - $this->_resourceAclUser - ); - } - - public function testUserChanged() - { - $subscription = $this->_createMockSubscription(); - $this->_setMockSubscriptions($subscription); - $user = $this->_createMockUser(1); - - $this->_eventHandler->userChanged($user); - } - - public function testUserChangedNoSubscription() - { - $this->_setMockSubscriptions(array()); - $user = $this->_createMockUser(1); - - $this->_eventHandler->userChanged($user); - } - - public function testRoleChanged() - { - $subscription = $this->_createMockSubscription(); - $this->_setMockSubscriptions($subscription); - $roleId = 42; - $role = $this->_createMockRole($roleId); - $users = array($this->_createMockUser(2)); - $this->_setRoleUsersExpectation($users, $roleId); - - $this->_eventHandler->roleChanged($role); - } - - public function testRoleChangedTwoUsers() - { - $subscription = $this->_createMockSubscription(); - $this->_setMockSubscriptions($subscription); - $roleId = 42; - $role = $this->_createMockRole($roleId); - $users = array($this->_createMockUser(1), $this->_createMockUser(2)); - $this->_setRoleUsersExpectation($users, $roleId); - - $this->_eventHandler->roleChanged($role); - } - - public function testRoleChangedTwoSubscriptions() - { - $subscriptions = array($this->_createMockSubscription(), $this->_createMockSubscription()); - $this->_setMockSubscriptions($subscriptions); - $roleId = 42; - $role = $this->_createMockRole($roleId); - $users = array($this->_createMockUser(1)); - $this->_setRoleUsersExpectation($users, $roleId); - - $this->_eventHandler->roleChanged($role); - } - - - public function testTopicsNoLongerValid() - { - $subscription = $this->_createMockSubscription(); - $subscription->expects($this->once()) - ->method('findRestrictedTopics') - ->will($this->returnValue(array('invalid/topic'))); - $subscription->expects($this->once()) - ->method('deactivate'); - $this->_setMockSubscriptions($subscription); - $roleId = 1; - $role = $this->_createMockRole($roleId); - $users = array($this->_createMockUser(2)); - $this->_setRoleUsersExpectation($users, $roleId); - - $this->_eventHandler->roleChanged($role); - } - - protected function _setRoleUsersExpectation($users, $roleId) - { - $this->_resourceAclUser->expects($this->atLeastOnce()) - ->method('getRoleUsers') - ->with($roleId) - ->will($this->returnValue($users)); - } - - protected function _createMockRole($roleId) - { - $role = $this->getMockBuilder('Magento\Webapi\Model\Acl\Role') - ->disableOriginalConstructor() - ->getMock(); - $role->expects($this->any()) - ->method('getId') - ->will($this->returnValue($roleId)); - return $role; - } - - protected function _createMockUser($userId) - { - $user = $this->getMockBuilder('Magento\Webapi\Model\Acl\User') - ->disableOriginalConstructor() - ->getMock(); - $user->expects($this->any()) - ->method('getId') - ->will($this->returnValue($userId)); - return $user; - } - - protected function _createMockSubscription() - { - $subscription = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - - $subscription->expects($this->any()) - ->method('load') - ->will($this->returnSelf()); - return $subscription; - } - - protected function _setMockSubscriptions($subscriptions) - { - if (!is_array($subscriptions)) { - $subscriptions = array($subscriptions); - } - - $this->_collection->expects($this->once()) - ->method('getApiUserSubscriptions') - ->will($this->returnValue($subscriptions)); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php b/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php deleted file mode 100644 index 22c4579a6c9e2dd40739854d261d1220eb7b7813..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/Webapi/User/FactoryTest.php +++ /dev/null @@ -1,257 +0,0 @@ -<?php -/** - * \Magento\Webhook\Model\Webapi\User\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_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Model\Webapi\User; - -class FactoryTest extends \PHPUnit_Framework_TestCase -{ - /** @var \Magento\Webhook\Model\Webapi\User\Factory */ - protected $_userFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRule; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockUser; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockRole; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockCoreHelper; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - protected $_mockAuthConfig; - - /** @var array */ - protected $_userContext; - - public function testCreateUser() - { - $this->_initializeRoleRuleUser(); - $this->_mockAuthConfig->expects($this->any()) - ->method('getAclVirtualResources') - ->will($this->returnValue(array())); - $this->_setupUserService(); - - $userId = 'some random user id'; - $this->_mockUser->expects($this->once()) - ->method('getId') - ->withAnyParameters() - ->will($this->returnValue($userId)); - - $this->assertSame($userId, $this->_userFactory->createUser($this->_userContext, array())); - - } - - /** - * @expectedException \Exception - * @expectedExceptionMessage some random exception - */ - public function testCreateUserAndRoleException() - { - $this->_initializeRoleRuleUser(); - $this->_mockAuthConfig->expects($this->any()) - ->method('getAclVirtualResources') - ->will($this->returnValue(array())); - $this->_setupUserService(); - - $exception = new \Exception('some random exception'); - $this->_mockUser->expects($this->once()) - ->method('save') - ->withAnyParameters() - ->will($this->throwException($exception)); - $this->_mockRole->expects($this->once()) - ->method('delete'); - - $this->_userFactory->createUser($this->_userContext, array()); - } - - public function testInitVirtualResourceMapping() - { - $expectedResources = array( - 'resource', - 'webhook/create', - 'webhook/get', - 'webhook/update', - 'webhook/delete', - ); - $this->_initializeRoleRuleUser(); - - $this->_mockAuthConfig->expects($this->once()) - ->method('getAclVirtualResources') - ->will($this->returnValue(array(array('id' => 'topic', 'parent' => 'resource')))); - - $this->_mockRule->expects($this->once()) - ->method('setResources') - ->with($this->equalTo($expectedResources)) - ->will($this->returnSelf()); - $this->_setupUserService(); - - $this->_userFactory->createUser($this->_userContext, array('topic')); - } - - protected function _setupUserService() - { - - $mockRuleFactory = $this->getMockBuilder('Magento\Webapi\Model\Acl\Rule\Factory') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMock(); - $mockRuleFactory->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_mockRule)); - - - $mockUserFactory = $this->getMockBuilder('Magento\Webapi\Model\Acl\User\Factory') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMock(); - $mockUserFactory->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_mockUser)); - - - $mockRoleFactory = $this->getMockBuilder('Magento\Webapi\Model\Acl\Role\Factory') - ->disableOriginalConstructor() - ->setMethods(array('create')) - ->getMock(); - $mockRoleFactory->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_mockRole)); - - $mockAclCache = $this->getMockBuilder('Magento\Webapi\Model\Acl\Cache') - ->disableOriginalConstructor() - ->getMock(); - - $mockMathRandom = $this->getMockBuilder('Magento\Math\Random') - ->disableOriginalConstructor() - ->getMock(); - - $this->_userFactory = new \Magento\Webhook\Model\Webapi\User\Factory( - $mockRuleFactory, - $mockUserFactory, - - $mockRoleFactory, - $this->_mockAuthConfig, - $mockAclCache, - $mockMathRandom - ); - } - - /** - * Mock Role, Rule, and User for methods that test createUserAndRole - */ - private function _initializeRoleRuleUser() - { - $email = 'test@email.com'; - $key = 'some random key'; - $secret = 'sshhh, don`t tell'; - $company = 'some random company'; - $this->_userContext = array( - 'email' => $email, - 'key' => $key, - 'secret' => $secret, - 'company' => $company, - ); - - // Mock Role - $this->_mockRole = $this->getMockBuilder('Magento\Webapi\Model\Acl\Role') - ->setMethods(array('load', 'save', 'getId', 'setRoleName', 'delete', '__wakeup')) - ->disableOriginalConstructor() - ->getMock(); - $this->_mockRole->expects($this->once()) - ->method('load') - ->with($this->equalTo($company . ' - ' . $email), $this->equalTo('role_name')) - ->will($this->returnSelf()); - $this->_mockRole->expects($this->any()) - ->method('getId') - ->will($this->returnValue(true)); - $this->_mockRole->expects($this->once()) - ->method('setRoleName') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockRole->expects($this->once()) - ->method('save') - ->will($this->returnSelf()); - - // Mock Rule - $this->_mockRule = $this->getMockBuilder('Magento\Webapi\Model\Acl\Rule') - ->disableOriginalConstructor() - ->setMethods(array('setRoleId', 'setResources', 'saveResources', '__wakeup')) - ->getMock(); - $this->_mockRule->expects($this->once()) - ->method('setRoleId') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockRule->expects($this->once()) - ->method('setResources') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockRule->expects($this->once()) - ->method('saveResources') - ->withAnyParameters() - ->will($this->returnSelf()); - - // Mock User - $this->_mockUser = $this->getMockBuilder('Magento\Webapi\Model\Acl\User') - ->disableOriginalConstructor() - ->setMethods(array( - 'setRoleId', 'setApiKey', 'setSecret', 'setCompanyName', 'setContactEmail', 'save', 'getId', - '__wakeup' - )) - ->getMock(); - $this->_mockUser->expects($this->once()) - ->method('setRoleId') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockUser->expects($this->once()) - ->method('setApiKey') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockUser->expects($this->once()) - ->method('setSecret') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockUser->expects($this->once()) - ->method('setCompanyName') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockUser->expects($this->once()) - ->method('setContactEmail') - ->withAnyParameters() - ->will($this->returnSelf()); - $this->_mockUser->expects($this->once()) - ->method('save') - ->withAnyParameters() - ->will($this->returnSelf()); - - $this->_mockAuthConfig = $this->getMockBuilder('Magento\Webapi\Model\Acl\Resource\Provider') - ->disableOriginalConstructor() - ->getMock(); - } -} diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xml b/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xml deleted file mode 100644 index e608e804984a920758f71a7e98b4f0cf5a3135bf..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xml +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Mage - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <mapping to="Magento_Webapi"> - <parent id="customer/get"> - <topic id="customer/updated"/> - <topic id="customer/created"/> - <topic id="customer/deleted"/> - </parent> - </mapping> -</config> diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xsd b/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xsd deleted file mode 100644 index 47132cb3bfae3c3ad3f385cc41777a4bbce4e9b0..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl.xsd +++ /dev/null @@ -1,154 +0,0 @@ -<?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. - * - * @category Mage - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<!-- -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> -<xs:element name="config"> - <xs:complexType> - <xs:sequence> - <xs:element name="mapping"> - <xs:complexType> - <xs:sequence> - <xs:element name="parent"> - <xs:complexType> - <xs:sequence> - <xs:element name="topic" maxOccurs="unbounded" minOccurs="0"> - <xs:complexType> - <xs:simpleContent> - <xs:extension base="xs:string"> - <xs:attribute type="xs:string" name="id" use="optional"/> - </xs:extension> - </xs:simpleContent> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute type="xs:string" name="id"/> - </xs:complexType> - </xs:element> - </xs:sequence> - <xs:attribute type="xs:string" name="to"/> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> -</xs:element> - </xs:schema> - ---> - - -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> - <xs:element name="config"> - <xs:complexType> - <xs:sequence> - <xs:element name="mapping"> - <xs:complexType> - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="resource" type="aclMapping"> - <xs:unique name="uniqueMappedResourceId"> - <xs:annotation> - <xs:documentation> - Attribute id is unique under all mapped ACL resources - </xs:documentation> - </xs:annotation> - <xs:selector xpath=".//*"/> - <xs:field xpath="@id"/> - </xs:unique> - </xs:element> - </xs:sequence> - <xs:attribute type="xs:string" name="to"/> - </xs:complexType> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - - <xs:complexType name="aclResource"> - <xs:annotation> - <xs:documentation> - ACL Resource. Recursive complex type - </xs:documentation> - </xs:annotation> - - <xs:sequence> - <xs:element minOccurs="0" maxOccurs="unbounded" name="resource" type="aclResource" /> - </xs:sequence> - - <xs:attribute name="id" type="typeId" use="required" /> - <xs:attribute name="module" type="typeModule" use="optional" /> - <xs:attribute name="title" type="typeTitle" use="optional" /> - <xs:attribute name="sortOrder" type="xs:int" use="optional" /> - </xs:complexType> - - <xs:complexType name="aclMapping"> - <xs:annotation> - <xs:documentation> - ACL Resource mapping. - </xs:documentation> - </xs:annotation> - - <xs:attribute name="id" type="typeId" use="required" /> - <xs:attribute name="parent" type="typeId" use="required" /> - </xs:complexType> - - <xs:simpleType name="typeId"> - <xs:annotation> - <xs:documentation> - Item id attribute can has only [A-Za-z0-9_]/[A-Za-z0-9_]. Minimal length 3 symbol. Case insensitive. - </xs:documentation> - </xs:annotation> - - <xs:restriction base="xs:string"> - <xs:pattern value="[A-Za-z_0-9]+/?[A-Za-z_0-9]+" /> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="typeTitle"> - <xs:annotation> - <xs:documentation> - Item title attribute minimal length 3 symbol - </xs:documentation> - </xs:annotation> - - <xs:restriction base="xs:string"> - <xs:minLength value="3" /> - <xs:maxLength value="50" /> - </xs:restriction> - </xs:simpleType> - - <xs:simpleType name="typeModule"> - <xs:annotation> - <xs:documentation> - Item module attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive. - </xs:documentation> - </xs:annotation> - <xs:restriction base="xs:string"> - <xs:pattern value="[A-Z]+[a-z0-9]{1,}_[A-Z]+[A-Z0-9a-z]{1,}" /> - </xs:restriction> - </xs:simpleType> -</xs:schema> diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl2.xml b/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl2.xml deleted file mode 100644 index 2e0c16aacb04042e8d4440dc0fd4d3917894bb58..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Model/_files/acl2.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0"?> -<!-- -/** - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Academic Free License (AFL 3.0) - * that is bundled with this package in the file LICENSE_AFL.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/afl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Mage - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) - */ ---> -<config> - <mapping to="Magento_Webapi"> - <parent id="customer/get"> - <topic id="customer/updated"/> - <topic id="customer/created"/> - <topic id="customer/deleted"/> - </parent> - <parent id="catalog/get"> - <topic id="catalog/updated"/> - <topic id="catalog/created"/> - <topic id="catalog/deleted"/> - </parent> - </mapping> -</config> diff --git a/dev/tests/unit/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php b/dev/tests/unit/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php deleted file mode 100644 index 3cdc2cd59fca4359776959b694514b52dcbed7cb..0000000000000000000000000000000000000000 --- a/dev/tests/unit/testsuite/Magento/Webhook/Service/SubscriptionV1Test.php +++ /dev/null @@ -1,486 +0,0 @@ -<?php -/** - * \Magento\Webhook\Service\SubscriptionV1 - * - * Magento - * - * NOTICE OF LICENSE - * - * This source file is subject to the Open Software License (OSL 3.0) - * that is bundled with this package in the file LICENSE.txt. - * It is also available through the world-wide-web at this URL: - * http://opensource.org/licenses/osl-3.0.php - * If you did not receive a copy of the license and are unable to - * obtain it through the world-wide-web, please send an email - * to license@magentocommerce.com so we can send you a copy immediately. - * - * DISCLAIMER - * - * Do not edit or add to this file if you wish to upgrade Magento to newer - * versions in the future. If you wish to customize Magento for your - * needs please refer to http://www.magentocommerce.com for more information. - * - * @category Magento - * @package Magento_Webhook - * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) - * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) - */ -namespace Magento\Webhook\Service; - -class SubscriptionV1Test extends \PHPUnit_Framework_TestCase -{ - const VALUE_SUBSCRIPTION_ID = 2; - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionFactory; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionMock; - - /** @var \PHPUnit_Framework_MockObject_MockObject */ - private $_subscriptionSet; - - /** @var \Magento\Webhook\Service\SubscriptionV1 */ - private $_service; - - /** @var array */ - private $_subscriptionData; - - protected function setUp() - { - $this->_subscriptionFactory = $this->getMockBuilder('Magento\Webhook\Model\Subscription\Factory') - ->disableOriginalConstructor() - ->getMock(); - $this->_subscriptionMock = $this->getMockBuilder('Magento\Webhook\Model\Subscription') - ->disableOriginalConstructor() - ->getMock(); - $this->_subscriptionMock->expects($this->any()) - ->method('getId') - ->will($this->returnValue(self::VALUE_SUBSCRIPTION_ID)); - - $this->_subscriptionData = array( - 'name' => 'Subscription Name', - 'alias' => 'sub_alias', - 'topics' => array('some/topic'), - 'subscription_id' => self::VALUE_SUBSCRIPTION_ID, - ); - $this->_subscriptionMock->expects($this->any()) - ->method('getData') - ->will($this->returnValue($this->_subscriptionData)); - - $this->_subscriptionFactory->expects($this->any()) - ->method('create') - ->will($this->returnValue($this->_subscriptionMock)); - $this->_subscriptionFactory->expects($this->any()) - ->method('load') - ->will($this->returnValue($this->_subscriptionMock)); - - $this->_subscriptionSet = $this->getMockBuilder('Magento\Webhook\Model\Resource\Subscription\Collection') - ->disableOriginalConstructor() - ->getMock(); - - $this->_service = new \Magento\Webhook\Service\SubscriptionV1( - $this->_subscriptionFactory, - $this->_subscriptionSet - ); - } - - public function testCreate() - { - $this->_mockAllowedTopics(); - - $this->_subscriptionMock->expects($this->once()) - ->method('save') - ->will($this->returnSelf()); - - $resultData = $this->_service->create($this->_subscriptionData); - - $this->assertSame($this->_subscriptionData, $resultData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage topics - */ - public function testCreateInvalidTopics() - { - $this->_mockRestrictedTopics(); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $this->_service->create($this->_subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testCreateException() - { - $this->_mockAllowedTopics(); - - $this->_subscriptionMock->expects($this->once()) - ->method('save') - ->will($this->throwException(new \Exception())); - - $this->_service->create($this->_subscriptionData); - } - - public function testGetAll() - { - $apiUserId = 42; - $this->_subscriptionSet->expects($this->once()) - ->method('getApiUserSubscriptions') - ->with($apiUserId) - ->will($this->returnValue(array($this->_subscriptionMock))); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $subscriptions = $this->_service->getAll($apiUserId); - - $this->assertEquals($this->_subscriptionData, $subscriptions[0]); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testGetAllInvalidUser() - { - $apiUserId = 42; - $this->_subscriptionSet->expects($this->once()) - ->method('getApiUserSubscriptions') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $this->_service->getAll($apiUserId); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testGetAllException() - { - $apiUserId = 42; - $this->_subscriptionSet->expects($this->once()) - ->method('getApiUserSubscriptions') - ->will($this->throwException(new \Exception())); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $this->_service->getAll($apiUserId); - } - - public function testUpdate() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('save') - ->will($this->returnSelf()); - - $subscriptionData = $this->_service->update($this->_subscriptionData); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testUpdateFailed() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('save') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - - $this->_service->update($this->_subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testUpdateException() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('save') - ->will($this->throwException(new \Exception())); - - $this->_service->update($this->_subscriptionData); - } - - public function testGet() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $subscriptionData = $this->_service->get(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testGetFailed() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $subscriptionData = $this->_service->get(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testGetException() - { - $this->_subscriptionFactory->expects($this->any()) - ->method('create') - ->will($this->throwException(new \Exception())); - $this->_subscriptionMock->expects($this->never()) - ->method('save'); - - $subscriptionData = $this->_service->get(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - public function testDelete() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('delete') - ->will($this->returnSelf()); - - $subscriptionData = $this->_service->delete(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testDeleteFailed() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('delete') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - - $this->_service->delete(self::VALUE_SUBSCRIPTION_ID); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testDeleteException() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - $this->_subscriptionMock->expects($this->once()) - ->method('delete') - ->will($this->throwException(new \Exception())); - - $this->_service->delete(self::VALUE_SUBSCRIPTION_ID); - } - - public function testActivate() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('activate'); - - $this->_subscriptionMock->expects($this->once()) - ->method('save'); - - $subscriptionData = $this->_service->activate(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testActivateFailure() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('activate') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - - $this->_service->activate(self::VALUE_SUBSCRIPTION_ID); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testActivateException() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('activate') - ->will($this->throwException(new \Exception())); - - $this->_service->activate(self::VALUE_SUBSCRIPTION_ID); - } - - public function testDeactivate() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('deactivate'); - - $this->_subscriptionMock->expects($this->once()) - ->method('save'); - - $subscriptionData = $this->_service->deactivate(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testDeactivateFailure() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('deactivate') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - - $this->_service->deactivate(self::VALUE_SUBSCRIPTION_ID); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testDeactivateException() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('deactivate') - ->will($this->throwException(new \Exception())); - - $this->_service->deactivate(self::VALUE_SUBSCRIPTION_ID); - } - - public function testRevoke() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('revoke'); - - $this->_subscriptionMock->expects($this->once()) - ->method('save'); - - $subscriptionData = $this->_service->revoke(self::VALUE_SUBSCRIPTION_ID); - - $this->assertEquals($this->_subscriptionData, $subscriptionData); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage verifiable_message - */ - public function testRevokeFailure() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('revoke') - ->will($this->throwException(new \Magento\Core\Exception('verifiable_message'))); - - $this->_service->revoke(self::VALUE_SUBSCRIPTION_ID); - } - - /** - * @expectedException \Magento\Core\Exception - * @expectedExceptionMessage Unexpected - */ - public function testRevokeException() - { - $this->_subscriptionMock->expects($this->once()) - ->method('load') - ->will($this->returnSelf()); - - $this->_subscriptionMock->expects($this->once()) - ->method('revoke') - ->will($this->throwException(new \Exception())); - - $this->_service->revoke(self::VALUE_SUBSCRIPTION_ID); - } - - /** - * Mocks subscription not finding any restricted topics - */ - private function _mockAllowedTopics() - { - $this->_subscriptionMock->expects($this->any()) - ->method('findRestrictedTopics') - ->will($this->returnValue(array())); - } - - /** - * Mocks subscription finding restricted topics - */ - private function _mockRestrictedTopics() - { - $this->_subscriptionMock->expects($this->once()) - ->method('findRestrictedTopics') - ->will($this->returnValue(array('something/invalid'))); - } -} diff --git a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php index c099ba7484a2b37af3443970cd471a398c9da28d..9d97943f113c4c2df4879fb2a108dbd3a1d6e984 100644 --- a/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php +++ b/dev/tools/Magento/Tools/Di/Code/Scanner/XmlScanner.php @@ -79,7 +79,7 @@ class XmlScanner implements ScannerInterface foreach ($output as $className) { $entityName = substr($className, -6) === '\Proxy' ? substr($className, 0, -6) : $className; if (false === class_exists($className)) { - if (class_exists($entityName)) { + if (class_exists($entityName) || interface_exists($entityName)) { array_push($filteredEntities, $className); } else { $this->_log->add( diff --git a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php index 97db6e7df3849d051fdc6b08d9e2c71bb0025094..23c14ced5a7da8b2030515e43f32e53f546ee56a 100644 --- a/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php +++ b/dev/tools/Magento/Tools/Migration/factory_table_names/replace_ce.php @@ -37,10 +37,6 @@ return array( 'admin/user' => 'admin_user', 'adminnotification/inbox' => 'adminnotification_inbox', 'amazonpayments/api_debug' => 'amazonpayments_api_debug', - 'webapi/acl_attribute' => 'webapi_acl_attribute', - 'webapi/acl_role' => 'webapi_acl_role', - 'webapi/acl_rule' => 'webapi_acl_rule', - 'webapi/acl_user' => 'webapi_acl_user', 'array(\'catalog/category\', \'datetime\')' => 'catalog_category_entity_datetime', 'array(\'catalog/category\', \'decimal\')' => 'catalog_category_entity_decimal', 'array(\'catalog/category\', \'int\')' => 'catalog_category_entity_int', diff --git a/lib/Magento/Acl/Resource/Config/Reader/Filesystem.php b/lib/Magento/Acl/Resource/Config/Reader/Filesystem.php index 13bcb9854732602ff8b48521640ca28dd96b22fb..c577103b0346d50c222284ce410913cdff3e1c6d 100644 --- a/lib/Magento/Acl/Resource/Config/Reader/Filesystem.php +++ b/lib/Magento/Acl/Resource/Config/Reader/Filesystem.php @@ -33,6 +33,7 @@ class Filesystem extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -41,10 +42,18 @@ class Filesystem extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'acl.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Acl\Resource\Config\Dom' + $domDocumentClass = 'Magento\Acl\Resource\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/lib/Magento/App/Resource/Config/Reader.php b/lib/Magento/App/Resource/Config/Reader.php index 04386d522b0ae4f98daa06254ca73bb9dee335ef..6b6e0bb56083d02d5519ea79c80b91b31e944ae4 100644 --- a/lib/Magento/App/Resource/Config/Reader.php +++ b/lib/Magento/App/Resource/Config/Reader.php @@ -42,15 +42,30 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param \Magento\App\Resource\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName + * @param array $idAttributes + * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\App\Resource\Config\Converter $converter, \Magento\App\Resource\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, - $fileName = 'resources.xml' + $fileName = 'resources.xml', + $idAttributes = array(), + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { - parent::__construct($fileResolver, $converter, $schemaLocator, $validationState, $fileName); + parent::__construct( + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope + ); } /** diff --git a/lib/Magento/Cache/Config/Reader.php b/lib/Magento/Cache/Config/Reader.php index 3689256ef0edf40b88f63e507b0aeace36d7d50b..9accefb49449c5868aff4af5fa4202f225882c4d 100644 --- a/lib/Magento/Cache/Config/Reader.php +++ b/lib/Magento/Cache/Config/Reader.php @@ -36,24 +36,33 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param \Magento\Cache\Config\Converter $converter - * @param \Magento\Cache\Config\SchemaLocator $schemeLocator + * @param Converter $converter + * @param SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\Cache\Config\Converter $converter, - \Magento\Cache\Config\SchemaLocator $schemeLocator, + \Magento\Cache\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, $fileName = 'cache.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemeLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/lib/Magento/Code/Reader/ArgumentsReader.php b/lib/Magento/Code/Reader/ArgumentsReader.php index 144c4c4f14d1bff38b8d1f54e05a347d39b5024f..de00bcab0e9b417aa1ec9829fc12ab268a8f95a6 100644 --- a/lib/Magento/Code/Reader/ArgumentsReader.php +++ b/lib/Magento/Code/Reader/ArgumentsReader.php @@ -186,4 +186,25 @@ class ArgumentsReader return var_export($var, true); } } + + /** + * Get constructor annotations + * + * @param \ReflectionClass $class + * @return array + */ + public function getAnnotations(\ReflectionClass $class) + { + $regexp = '(@([a-z_][a-z0-9_]+)\(([^\)]+)\))i'; + $docBlock = $class->getConstructor()->getDocComment(); + $annotations = array(); + preg_match_all($regexp, $docBlock, $matches); + foreach (array_keys($matches[0]) as $index) { + $name = $matches[1][$index]; + $value = trim($matches[2][$index], '" '); + $annotations[$name] = $value; + } + + return $annotations; + } } \ No newline at end of file diff --git a/lib/Magento/Code/Validator/ArgumentSequence.php b/lib/Magento/Code/Validator/ArgumentSequence.php index 347979964f7854c01670e6979b17ffc797fd8204..37f5fe2636d8217eab20e0e4bece54207f285126 100644 --- a/lib/Magento/Code/Validator/ArgumentSequence.php +++ b/lib/Magento/Code/Validator/ArgumentSequence.php @@ -38,20 +38,6 @@ class ArgumentSequence implements ValidatorInterface */ protected $_argumentsReader; - /** - * List of allowed type to validate - * @var array - */ - protected $_allowedTypes = array( - '\Magento\App\Action\Action', - '\Magento\View\Element\BlockInterface', - '\Magento\App\Helper\AbstractHelper', - '\Magento\Module\Updater\SetupInterface', - '\Magento\Core\Model\Resource\AbstractResource', - '\Magento\Core\Model\AbstractModel', - '\Magento\Data\Collection', - ); - /** * @var array */ @@ -74,11 +60,6 @@ class ArgumentSequence implements ValidatorInterface */ public function validate($className) { - /** Temporary solution. Need to be removed since all AC of MAGETWO-14343 will be covered */ - if (!$this->_isAllowedType($className)) { - return true; - } - $class = new \ReflectionClass($className); $classArguments = $this->_argumentsReader->getConstructorArguments($class); @@ -94,12 +75,11 @@ class ArgumentSequence implements ValidatorInterface $parentClass = '\\' . $parentClass; } - $parentCall = $this->_argumentsReader->getParentCall($class, array()); - - if ($parentCall) { - $parentArguments = isset($this->_cache[$parentClass]) - ? $this->_cache[$parentClass] - : $this->_argumentsReader->getConstructorArguments($parent, false, true); + if (isset($this->_cache[$parentClass])) { + $parentCall = $this->_argumentsReader->getParentCall($class, array()); + if ($parentCall) { + $parentArguments = $this->_cache[$parentClass]; + } } } @@ -119,23 +99,6 @@ class ArgumentSequence implements ValidatorInterface return true; } - /** - * Check whether type can be validated - * - * @param string $className - * @return bool - */ - protected function _isAllowedType($className) - { - foreach ($this->_allowedTypes as $type) { - if (is_subclass_of($className, $type)) { - return true; - } - } - - return false; - } - /** * Check argument sequence * diff --git a/lib/Magento/Code/Validator/TypeDuplication.php b/lib/Magento/Code/Validator/TypeDuplication.php new file mode 100644 index 0000000000000000000000000000000000000000..c91af83cbaefafabd71316855c1050a1b12edb1f --- /dev/null +++ b/lib/Magento/Code/Validator/TypeDuplication.php @@ -0,0 +1,125 @@ +<?php +/** + * Class constructor validator. Validates argument types duplication + * + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Open Software License (OSL 3.0) + * that is bundled with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/osl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ + +namespace Magento\Code\Validator; +use Magento\Code\ValidatorInterface; +use Magento\Code\ValidationException; + +class TypeDuplication implements ValidatorInterface +{ + /** + * Name of the suppress warnings annotation. + */ + const SUPPRESS_ANNOTATION = 'SuppressWarnings'; + const TYPE_DUPLICATIONS = 'Magento.TypeDuplication'; + + /** + * @var \Magento\Code\Reader\ArgumentsReader + */ + protected $_argumentsReader; + + /** + * @param \Magento\Code\Reader\ArgumentsReader $argumentsReader + */ + public function __construct(\Magento\Code\Reader\ArgumentsReader $argumentsReader = null) + { + $this->_argumentsReader = $argumentsReader ?: new \Magento\Code\Reader\ArgumentsReader(); + } + + /** + * Validate class + * + * @param string $className + * @return bool + * @throws ValidationException + */ + public function validate($className) + { + $class = new \ReflectionClass($className); + $classArguments = $this->_argumentsReader->getConstructorArguments($class, true); + + $arguments = $this->_getObjectArguments($classArguments); + + $typeList = array(); + $errors = array(); + foreach ($arguments as $argument) { + $name = $argument['name']; + $type = $argument['type']; + if (in_array($type, $typeList)) { + $errors[] = 'Multiple type injection [' . $type . ']'; + } elseif (isset($typeList[$name])) { + $errors[] = 'Variable name duplication. [$' . $name . ']'; + } + $typeList[$name] = $type; + } + + if (!empty($errors)) { + if (false == $this->_ignoreWarning($class)) { + throw new ValidationException('Argument type duplication in class ' . $class->getName() + . ' in ' . $class->getFileName() . PHP_EOL . implode(PHP_EOL, $errors) + ); + } + } + return true; + + } + /** + * Get arguments with object types + * + * @param array $arguments + * @return array + */ + protected function _getObjectArguments(array $arguments) + { + $output = array(); + foreach ($arguments as $argument) { + $type = $argument['type']; + if (!$type || $type == 'array') { + continue; + } + $reflection = new \ReflectionClass($type); + if (false == $reflection->isInterface()) { + $output[] = $argument; + } + } + return $output; + } + + /** + * Check whether warning must be skipped + * + * @param \ReflectionClass $class + * @return bool + */ + protected function _ignoreWarning(\ReflectionClass $class) + { + $annotations = $this->_argumentsReader->getAnnotations($class); + if (isset($annotations[self::SUPPRESS_ANNOTATION])) { + return $annotations[self::SUPPRESS_ANNOTATION] == self::TYPE_DUPLICATIONS; + } + return false; + } +} diff --git a/lib/Magento/DB/Tree/Node.php b/lib/Magento/DB/Tree/Node.php index 260a2f38d28ac830640886955f4dbc32d1d3c25e..903e3b3b01ddec36bcb298bff5dd2ad5e8df94e4 100644 --- a/lib/Magento/DB/Tree/Node.php +++ b/lib/Magento/DB/Tree/Node.php @@ -44,7 +44,7 @@ class Node { public $numChild = 0; - function __construct($nodeData = array(), $keys) { + function __construct($nodeData, $keys) { if (empty($nodeData)) { throw new \Magento\DB\Tree\Node\NodeException('Empty array of node information'); } diff --git a/lib/Magento/Data/Form.php b/lib/Magento/Data/Form.php index 6e4ed4c86f47b4ad2d758be5685fe60d1e623c01..44291444a5e3fdf6564fec719e89839bf2969107 100644 --- a/lib/Magento/Data/Form.php +++ b/lib/Magento/Data/Form.php @@ -55,15 +55,15 @@ class Form extends \Magento\Data\Form\AbstractForm * @param Form\Element\Factory $factoryElement * @param Form\Element\CollectionFactory $factoryCollection * @param Form\FormKey $formKey - * @param array $attributes + * @param array $data */ public function __construct( \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, \Magento\Data\Form\FormKey $formKey, - $attributes = array() + $data = array() ) { - parent::__construct($factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $data); $this->_allElements = $this->_factoryCollection->create(array('container' => $this)); $this->formKey = $formKey; } diff --git a/lib/Magento/Data/Form/AbstractForm.php b/lib/Magento/Data/Form/AbstractForm.php index 1410c04eb4d22ddfabbcf605b81d60b24fa9fcd6..4fffd2d333154c063d624de2e5689a39ecc50843 100644 --- a/lib/Magento/Data/Form/AbstractForm.php +++ b/lib/Magento/Data/Form/AbstractForm.php @@ -63,16 +63,16 @@ class AbstractForm extends \Magento\Object /** * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param array $data */ public function __construct( \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + $data = array() ) { $this->_factoryElement = $factoryElement; $this->_factoryCollection = $factoryCollection; - parent::__construct($attributes); + parent::__construct($data); $this->_construct(); } @@ -167,7 +167,7 @@ class AbstractForm extends \Magento\Object if (isset($this->_types[$type])) { $type = $this->_types[$type]; } - $element = $this->_factoryElement->create($type, array('attributes' => $config)); + $element = $this->_factoryElement->create($type, array('data' => $config)); $element->setId($elementId); $this->addElement($element, $after); return $element; @@ -196,7 +196,7 @@ class AbstractForm extends \Magento\Object */ public function addFieldset($elementId, $config, $after = false, $isAdvanced = false) { - $element = $this->_factoryElement->create('fieldset', array('attributes' => $config)); + $element = $this->_factoryElement->create('fieldset', array('data' => $config)); $element->setId($elementId); $element->setAdvanced($isAdvanced); $this->addElement($element, $after); @@ -212,7 +212,7 @@ class AbstractForm extends \Magento\Object */ public function addColumn($elementId, $config) { - $element = $this->_factoryElement->create('column', array('attributes' => $config)); + $element = $this->_factoryElement->create('column', array('data' => $config)); $element->setForm($this) ->setId($elementId); $this->addElement($element); diff --git a/lib/Magento/Data/Form/Element/AbstractElement.php b/lib/Magento/Data/Form/Element/AbstractElement.php index ca7a3954648bbc1b56a74063a887364ad5c1ca8b..550dfc94847118b45a6eb94b9f29be82fb3f6fcd 100644 --- a/lib/Magento/Data/Form/Element/AbstractElement.php +++ b/lib/Magento/Data/Form/Element/AbstractElement.php @@ -56,19 +56,19 @@ abstract class AbstractElement extends \Magento\Data\Form\AbstractForm protected $_escaper; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { $this->_escaper = $escaper; - parent::__construct($factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $data); $this->_renderer = \Magento\Data\Form::getElementRenderer(); } diff --git a/lib/Magento/Data/Form/Element/Button.php b/lib/Magento/Data/Form/Element/Button.php index 9d897738e993186618925a2c6e79259dc2ea493f..36b9aab8f334295ef8f648972c3ebd8d906fd9cb 100644 --- a/lib/Magento/Data/Form/Element/Button.php +++ b/lib/Magento/Data/Form/Element/Button.php @@ -43,18 +43,18 @@ class Button extends \Magento\Data\Form\Element\AbstractElement protected $_htmlAttributes = array('data-mage-init'); /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('button'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Checkbox.php b/lib/Magento/Data/Form/Element/Checkbox.php index 7baccef9fe25955d9efec061cc9c92b946ef324b..f681beb2fc89b48d662f9a0ef95f302e0c5fa671 100644 --- a/lib/Magento/Data/Form/Element/Checkbox.php +++ b/lib/Magento/Data/Form/Element/Checkbox.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Checkbox extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('checkbox'); $this->setExtType('checkbox'); } diff --git a/lib/Magento/Data/Form/Element/Checkboxes.php b/lib/Magento/Data/Form/Element/Checkboxes.php index 40db99312418ee57fa48af2229538458ba695cc7..45600b91b20662511dd8380d534e2ecbb6a259b6 100644 --- a/lib/Magento/Data/Form/Element/Checkboxes.php +++ b/lib/Magento/Data/Form/Element/Checkboxes.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Checkboxes extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('checkbox'); $this->setExtType('checkboxes'); } diff --git a/lib/Magento/Data/Form/Element/Column.php b/lib/Magento/Data/Form/Element/Column.php index c15cb351448b3b743b370f8a73663d4087a17001..04786eb5a2fa3cb1c9b7b74e5fabfddea162cefd 100644 --- a/lib/Magento/Data/Form/Element/Column.php +++ b/lib/Magento/Data/Form/Element/Column.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Column extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('column'); } } diff --git a/lib/Magento/Data/Form/Element/Date.php b/lib/Magento/Data/Form/Element/Date.php index 39a634b2f63fb3bf804012267210e31578682309..d5d79633aeaa3bc510edf29c5c0803ee92187a73 100644 --- a/lib/Magento/Data/Form/Element/Date.php +++ b/lib/Magento/Data/Form/Element/Date.php @@ -41,22 +41,22 @@ class Date extends \Magento\Data\Form\Element\AbstractElement protected $_value; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('text'); $this->setExtType('textfield'); - if (isset($attributes['value'])) { - $this->setValue($attributes['value']); + if (isset($data['value'])) { + $this->setValue($data['value']); } } diff --git a/lib/Magento/Data/Form/Element/Editor.php b/lib/Magento/Data/Form/Element/Editor.php index 18cd3e0340847169217e8b38fda7aae2d4f27986..b5956d975bbb8ee8fcdca1e679652c20c3e8aff8 100644 --- a/lib/Magento/Data/Form/Element/Editor.php +++ b/lib/Magento/Data/Form/Element/Editor.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Editor extends \Magento\Data\Form\Element\Textarea { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); if($this->isEnabled()) { $this->setType('wysiwyg'); diff --git a/lib/Magento/Data/Form/Element/Fieldset.php b/lib/Magento/Data/Form/Element/Fieldset.php index ef8716e16eb76d10b852b6a048f942e7005227fe..b4a18d10367053ebf9a601ccef3424c85a1228a2 100644 --- a/lib/Magento/Data/Form/Element/Fieldset.php +++ b/lib/Magento/Data/Form/Element/Fieldset.php @@ -36,22 +36,22 @@ namespace Magento\Data\Form\Element; class Fieldset extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->_renderer = \Magento\Data\Form::getFieldsetRenderer(); $this->setType('fieldset'); - if (isset($attributes['advancedSection'])) { - $this->setAdvancedLabel($attributes['advancedSection']); + if (isset($data['advancedSection'])) { + $this->setAdvancedLabel($data['advancedSection']); } } diff --git a/lib/Magento/Data/Form/Element/File.php b/lib/Magento/Data/Form/Element/File.php index 1df53fc0c0a458b94d5074eb4158c614f5b3aaab..c5343278c7630f3efc067bfe2564805b3f592496 100644 --- a/lib/Magento/Data/Form/Element/File.php +++ b/lib/Magento/Data/Form/Element/File.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class File extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('file'); $this->setExtType('file'); } diff --git a/lib/Magento/Data/Form/Element/Gallery.php b/lib/Magento/Data/Form/Element/Gallery.php index f1b1195ff584b6e5ec85959650e43992270b798e..96f77f82effbc9e76af7d8becf1facb40c2dbac0 100644 --- a/lib/Magento/Data/Form/Element/Gallery.php +++ b/lib/Magento/Data/Form/Element/Gallery.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Gallery extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('file'); } diff --git a/lib/Magento/Data/Form/Element/Hidden.php b/lib/Magento/Data/Form/Element/Hidden.php index 038b6b940c7a2a62f8caf3b9bbc3497994a73de7..11c3a840d8d4c5c17d9b8e8f01dbb54de282bc88 100644 --- a/lib/Magento/Data/Form/Element/Hidden.php +++ b/lib/Magento/Data/Form/Element/Hidden.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Hidden extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('hidden'); $this->setExtType('hiddenfield'); } diff --git a/lib/Magento/Data/Form/Element/Image.php b/lib/Magento/Data/Form/Element/Image.php index 15b99a7c1b49362e5012cd0521a7063b0f9fe9b9..bdca709fe1b397b4884b1e94196800507bb77cb7 100644 --- a/lib/Magento/Data/Form/Element/Image.php +++ b/lib/Magento/Data/Form/Element/Image.php @@ -40,21 +40,21 @@ class Image extends \Magento\Data\Form\Element\AbstractElement */ protected $_urlBuilder; /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection + * @param \Magento\Escaper $escaper * @param \Magento\UrlInterface $urlBuilder - * @param array $attributes + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, + \Magento\Escaper $escaper, \Magento\UrlInterface $urlBuilder, - $attributes = array() + $data = array() ) { $this->_urlBuilder = $urlBuilder; - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('file'); } diff --git a/lib/Magento/Data/Form/Element/Imagefile.php b/lib/Magento/Data/Form/Element/Imagefile.php index 9515bc923086ab926bff8fe92c9824b4fbe4c411..b20cd46e6820311a9800d42cf520da5caaef766c 100644 --- a/lib/Magento/Data/Form/Element/Imagefile.php +++ b/lib/Magento/Data/Form/Element/Imagefile.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Imagefile extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('file'); $this->setExtType('imagefile'); $this->setAutosubmit(false); diff --git a/lib/Magento/Data/Form/Element/Label.php b/lib/Magento/Data/Form/Element/Label.php index 20b54b6d63b7208890f26d2364248ca7c61402cf..1beac0d55a8da7dfcc4cf32956ce182395a1306b 100644 --- a/lib/Magento/Data/Form/Element/Label.php +++ b/lib/Magento/Data/Form/Element/Label.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Label extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('label'); } diff --git a/lib/Magento/Data/Form/Element/Link.php b/lib/Magento/Data/Form/Element/Link.php index 86c6d16883b502b02bd3bf97b8a9f6e0a65d672a..f9a1559f3ea6ff08bc71792940d0efcf1ef1e79e 100644 --- a/lib/Magento/Data/Form/Element/Link.php +++ b/lib/Magento/Data/Form/Element/Link.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Link extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('link'); } diff --git a/lib/Magento/Data/Form/Element/Multiline.php b/lib/Magento/Data/Form/Element/Multiline.php index ec9da9dd58df70719a198497080bee0dbda7c3c6..6c9ffa19654bbe085e6d06afde25dcd9eb67d7fc 100644 --- a/lib/Magento/Data/Form/Element/Multiline.php +++ b/lib/Magento/Data/Form/Element/Multiline.php @@ -34,18 +34,18 @@ namespace Magento\Data\Form\Element; class Multiline extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('text'); $this->setLineCount(2); } diff --git a/lib/Magento/Data/Form/Element/Multiselect.php b/lib/Magento/Data/Form/Element/Multiselect.php index 7b7ee7904acb41414d1501309d4f40c0ac588096..2970953d904b02e851146ab3ec2f660ec518673e 100644 --- a/lib/Magento/Data/Form/Element/Multiselect.php +++ b/lib/Magento/Data/Form/Element/Multiselect.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Multiselect extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('select'); $this->setExtType('multiple'); $this->setSize(10); diff --git a/lib/Magento/Data/Form/Element/Note.php b/lib/Magento/Data/Form/Element/Note.php index 9aacb94eb3f895c001f5454256e9ecbd39557f81..e7509e50ef743feab666ad1c755e47d3d7581df7 100644 --- a/lib/Magento/Data/Form/Element/Note.php +++ b/lib/Magento/Data/Form/Element/Note.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Note extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('note'); } diff --git a/lib/Magento/Data/Form/Element/Password.php b/lib/Magento/Data/Form/Element/Password.php index a12fd0b1cf8bed98e45ae39ce4490a073248c33f..1357c728b33800669e71a2e8b558205c9ece3174 100644 --- a/lib/Magento/Data/Form/Element/Password.php +++ b/lib/Magento/Data/Form/Element/Password.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Password extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('password'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Radio.php b/lib/Magento/Data/Form/Element/Radio.php index 9a5a2c86aa4bff5af0efd3059c0e7a64f2dddb72..474df80e5d6f7f6048caf7a7c0ca70d3180b88e8 100644 --- a/lib/Magento/Data/Form/Element/Radio.php +++ b/lib/Magento/Data/Form/Element/Radio.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Radio extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('radio'); $this->setExtType('radio'); } diff --git a/lib/Magento/Data/Form/Element/Radios.php b/lib/Magento/Data/Form/Element/Radios.php index 95d3e0a5a27890a0a4696619ec1fa616fa883f59..b44dfc694305d4e49c7f42be822db2dde65c8e71 100644 --- a/lib/Magento/Data/Form/Element/Radios.php +++ b/lib/Magento/Data/Form/Element/Radios.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Radios extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('radios'); } diff --git a/lib/Magento/Data/Form/Element/Reset.php b/lib/Magento/Data/Form/Element/Reset.php index 7eeada145eaa96955b02844f8642407476d69b3e..77126c6cad09edee24a9ffbeb1afdaafa0aa0bb3 100644 --- a/lib/Magento/Data/Form/Element/Reset.php +++ b/lib/Magento/Data/Form/Element/Reset.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Reset extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('text'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Select.php b/lib/Magento/Data/Form/Element/Select.php index 1e40cb45248ec12f7630b0854bccf65ca2594d05..b87c0444219a3668d36712bd93ede43756d1e4b6 100644 --- a/lib/Magento/Data/Form/Element/Select.php +++ b/lib/Magento/Data/Form/Element/Select.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Select extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('select'); $this->setExtType('combobox'); $this->_prepareOptions(); diff --git a/lib/Magento/Data/Form/Element/Submit.php b/lib/Magento/Data/Form/Element/Submit.php index ca1ccec4418993c2908554ec86b543c6aa7ee530..b240f8be9ab2b8b7d1e01e2b17294e0593364fff 100644 --- a/lib/Magento/Data/Form/Element/Submit.php +++ b/lib/Magento/Data/Form/Element/Submit.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Submit extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setExtType('submit'); $this->setType('submit'); } diff --git a/lib/Magento/Data/Form/Element/Text.php b/lib/Magento/Data/Form/Element/Text.php index d80d7568e92843201451278b1fe15ea335e01a08..0164aebbcaeea117109eee2a0ca3bb576ff7e5a4 100644 --- a/lib/Magento/Data/Form/Element/Text.php +++ b/lib/Magento/Data/Form/Element/Text.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Text extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('text'); $this->setExtType('textfield'); } diff --git a/lib/Magento/Data/Form/Element/Textarea.php b/lib/Magento/Data/Form/Element/Textarea.php index 4720b01f7c41ee46579d978966cc144a7dd5ed96..faee973cc7c59cbb9562b9e3bc7c47a4eebade3f 100644 --- a/lib/Magento/Data/Form/Element/Textarea.php +++ b/lib/Magento/Data/Form/Element/Textarea.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Textarea extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('textarea'); $this->setExtType('textarea'); $this->setRows(2); diff --git a/lib/Magento/Data/Form/Element/Time.php b/lib/Magento/Data/Form/Element/Time.php index 77e3fdfc8e2bc9d7cc76c2178a99d7a516d603e6..5cdf835cd12aea7f36e5a5db147471698f7c1083 100644 --- a/lib/Magento/Data/Form/Element/Time.php +++ b/lib/Magento/Data/Form/Element/Time.php @@ -36,18 +36,18 @@ namespace Magento\Data\Form\Element; class Time extends \Magento\Data\Form\Element\AbstractElement { /** - * @param \Magento\Escaper $escaper * @param \Magento\Data\Form\Element\Factory $factoryElement * @param \Magento\Data\Form\Element\CollectionFactory $factoryCollection - * @param array $attributes + * @param \Magento\Escaper $escaper + * @param array $data */ public function __construct( - \Magento\Escaper $escaper, \Magento\Data\Form\Element\Factory $factoryElement, \Magento\Data\Form\Element\CollectionFactory $factoryCollection, - $attributes = array() + \Magento\Escaper $escaper, + $data = array() ) { - parent::__construct($escaper, $factoryElement, $factoryCollection, $attributes); + parent::__construct($factoryElement, $factoryCollection, $escaper, $data); $this->setType('time'); } diff --git a/lib/Magento/Data/Form/ElementFactory.php b/lib/Magento/Data/Form/ElementFactory.php index b3d89529a9855db56bfe90c13ed62d7d44c632bf..85ec82b052e64a663f374d73b06fe9408c5d00ae 100644 --- a/lib/Magento/Data/Form/ElementFactory.php +++ b/lib/Magento/Data/Form/ElementFactory.php @@ -49,6 +49,6 @@ class ElementFactory */ public function create($elementClass, array $data = array()) { - return $this->_objectManager->create($elementClass, array('attributes' => $data)); + return $this->_objectManager->create($elementClass, array('data' => $data)); } } diff --git a/lib/Magento/Data/Tree.php b/lib/Magento/Data/Tree.php index 3f85e456bc3fc44257abf8e6b7f077ac95bf572d..ce3533d640b17c0a7cb1485f1aeccf450249e3b0 100644 --- a/lib/Magento/Data/Tree.php +++ b/lib/Magento/Data/Tree.php @@ -89,7 +89,7 @@ class Tree * @param \Magento\Data\Tree\Node $prevNode * @return \Magento\Data\Tree\Node */ - public function appendChild($data=array(), $parentNode, $prevNode=null) + public function appendChild($data, $parentNode, $prevNode=null) { if (is_array($data)) { $node = $this->addNode( diff --git a/lib/Magento/Data/Tree/Db.php b/lib/Magento/Data/Tree/Db.php index 4a0046541cd5ea39cb5b4492b1a57b7d2298ffe0..b4eb5fe06ec9571652be17a1578d00cc187286c8 100644 --- a/lib/Magento/Data/Tree/Db.php +++ b/lib/Magento/Data/Tree/Db.php @@ -176,7 +176,7 @@ class Db extends \Magento\Data\Tree return $node; } - public function appendChild($data=array(), $parentNode, $prevNode=null) + public function appendChild($data, $parentNode, $prevNode=null) { $orderSelect = $this->_conn->select(); $orderSelect->from($this->_table, new \Zend_Db_Expr('MAX('.$this->_conn->quoteIdentifier($this->_orderField).')')) diff --git a/lib/Magento/Event/Config/Reader.php b/lib/Magento/Event/Config/Reader.php index 681ec65a3b3d97b51043c9d468a5a8127b0e7790..7ffbeb8ed2959ed99e8b2ff64dc06e38788a2694 100644 --- a/lib/Magento/Event/Config/Reader.php +++ b/lib/Magento/Event/Config/Reader.php @@ -39,24 +39,33 @@ class Reader extends \Magento\Config\Reader\Filesystem /** * @param \Magento\Config\FileResolverInterface $fileResolver - * @param Converter $converter - * @param SchemaLocator $schemaLocator + * @param \Magento\Event\Config\Converter $converter + * @param \Magento\Event\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, - Converter $converter, - SchemaLocator $schemaLocator, + \Magento\Event\Config\Converter $converter, + \Magento\Event\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, $fileName = 'events.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } diff --git a/lib/Magento/Interception/PluginList/PluginList.php b/lib/Magento/Interception/PluginList/PluginList.php index 245d15062b4acd5eae81df5b7ad8944d00031510..d410f611f8696debb1f2e024d7ed593b661876dd 100644 --- a/lib/Magento/Interception/PluginList/PluginList.php +++ b/lib/Magento/Interception/PluginList/PluginList.php @@ -74,8 +74,8 @@ class PluginList * @param \Magento\ObjectManager\Config $omConfig * @param \Magento\Interception\Definition $definitions * @param array $scopePriorityScheme - * @param \Magento\ObjectManager\Definition\Compiled $classDefinitions * @param string $cacheId + * @param \Magento\ObjectManager\Definition\Compiled $classDefinitions */ public function __construct( \Magento\Config\ReaderInterface $reader, @@ -85,8 +85,8 @@ class PluginList \Magento\ObjectManager\Config $omConfig, \Magento\Interception\Definition $definitions, array $scopePriorityScheme, - \Magento\ObjectManager\Definition\Compiled $classDefinitions = null, - $cacheId = 'plugins' + $cacheId = 'plugins', + \Magento\ObjectManager\Definition\Compiled $classDefinitions = null ) { parent::__construct($reader, $configScope, $cache, $cacheId); $this->_omConfig = $omConfig; diff --git a/lib/Magento/Module/Declaration/Reader/Filesystem.php b/lib/Magento/Module/Declaration/Reader/Filesystem.php index 2de54646d2cb3c10e344dcb258ff2e0df996b4bd..7259ee7e630a6880fba738cb3a6c471b8ebb453c 100644 --- a/lib/Magento/Module/Declaration/Reader/Filesystem.php +++ b/lib/Magento/Module/Declaration/Reader/Filesystem.php @@ -52,6 +52,7 @@ class Filesystem extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope * @param array $allowedModules */ public function __construct( @@ -62,10 +63,18 @@ class Filesystem extends \Magento\Config\Reader\Filesystem $fileName = 'module.xml', $idAttributes = array(), $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global', array $allowedModules = array() ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $fileName, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); $this->_allowedModules = $allowedModules; } diff --git a/lib/Magento/Oauth/Oauth.php b/lib/Magento/Oauth/Oauth.php index 59633b2b5c56fb9a1e2837a1b493edbe0552f628..7a0fae7cef4ff926d611162beb657f932942252b 100644 --- a/lib/Magento/Oauth/Oauth.php +++ b/lib/Magento/Oauth/Oauth.php @@ -143,7 +143,7 @@ class Oauth implements OauthInterface $tokenSecret ); - return true; + return $consumer->getId(); } /** diff --git a/lib/Magento/Oauth/OauthInterface.php b/lib/Magento/Oauth/OauthInterface.php index e03806eef2b297bae05c7b4191fe6d21ea751db5..8960df7df3a7ee231f2ed4be5ae2a63e8750bb6d 100644 --- a/lib/Magento/Oauth/OauthInterface.php +++ b/lib/Magento/Oauth/OauthInterface.php @@ -138,7 +138,7 @@ interface OauthInterface * </pre> * @param string $requestUrl - The request Url. * @param string $httpMethod - (default: 'POST') - * @return bool - True if the access token request is valid. + * @return int Consumer ID. * @throws \Magento\Oauth\Exception - Validation errors. */ public function validateAccessTokenRequest($params, $requestUrl, $httpMethod = 'POST'); @@ -147,7 +147,7 @@ interface OauthInterface * Validate an access token string. * * @param string $accessToken - The access token. - * @return bool - True if the access token is valid. + * @return int - Consumer ID if the access token is valid. * @throws \Magento\Oauth\Exception - Validation errors. */ public function validateAccessToken($accessToken); diff --git a/lib/Magento/Oauth/TokenProviderInterface.php b/lib/Magento/Oauth/TokenProviderInterface.php index e7639832682ddde75e9c0b989508fab5ba50518a..e4a1326106df1808d5754243d69ec2b672adf8a9 100644 --- a/lib/Magento/Oauth/TokenProviderInterface.php +++ b/lib/Magento/Oauth/TokenProviderInterface.php @@ -99,7 +99,7 @@ interface TokenProviderInterface * Validate an access token string. * * @param string - The 'oauth_token' access token string. - * @return bool - True if the access token is valid. + * @return int - Consumer ID if the access token is valid. * @throws \Magento\Oauth\Exception - Validation errors. */ public function validateAccessToken($accessToken); diff --git a/lib/Magento/Object/Copy/Config/Reader.php b/lib/Magento/Object/Copy/Config/Reader.php index 9b8f1c3ba0baf1378f25bdff933668e5ba9aca0d..f64fd41604fe7cb1d2264e41a32527caae7efcda 100644 --- a/lib/Magento/Object/Copy/Config/Reader.php +++ b/lib/Magento/Object/Copy/Config/Reader.php @@ -47,6 +47,7 @@ class Reader extends \Magento\Config\Reader\Filesystem * @param string $fileName * @param array $idAttributes * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, @@ -55,7 +56,8 @@ class Reader extends \Magento\Config\Reader\Filesystem \Magento\Config\ValidationStateInterface $validationState, $fileName = 'fieldset.xml', $idAttributes = array(), - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( $fileResolver, @@ -64,7 +66,8 @@ class Reader extends \Magento\Config\Reader\Filesystem $validationState, $fileName, $idAttributes, - $domDocumentClass + $domDocumentClass, + $defaultScope ); } } diff --git a/lib/Magento/ObjectManager/Config/Reader/Dom.php b/lib/Magento/ObjectManager/Config/Reader/Dom.php index c12b0e5a06e8ed768c7ad9cbb0a6a6e67f504b77..1b5c89ad9b290719b041be6a83a54ccbf86566ef 100644 --- a/lib/Magento/ObjectManager/Config/Reader/Dom.php +++ b/lib/Magento/ObjectManager/Config/Reader/Dom.php @@ -47,21 +47,30 @@ class Dom extends \Magento\Config\Reader\Filesystem * @param \Magento\ObjectManager\Config\Mapper\Dom $converter * @param \Magento\ObjectManager\Config\SchemaLocator $schemaLocator * @param \Magento\Config\ValidationStateInterface $validationState + * @param string $fileName * @param array $idAttributes - * @param string $filename * @param string $domDocumentClass + * @param string $defaultScope */ public function __construct( \Magento\Config\FileResolverInterface $fileResolver, \Magento\ObjectManager\Config\Mapper\Dom $converter, \Magento\ObjectManager\Config\SchemaLocator $schemaLocator, \Magento\Config\ValidationStateInterface $validationState, + $fileName = 'di.xml', $idAttributes = array(), - $filename = 'di.xml', - $domDocumentClass = 'Magento\Config\Dom' + $domDocumentClass = 'Magento\Config\Dom', + $defaultScope = 'global' ) { parent::__construct( - $fileResolver, $converter, $schemaLocator, $validationState, $filename, $idAttributes, $domDocumentClass + $fileResolver, + $converter, + $schemaLocator, + $validationState, + $fileName, + $idAttributes, + $domDocumentClass, + $defaultScope ); } } diff --git a/lib/Magento/Outbound/Authentication/Factory.php b/lib/Magento/Outbound/Authentication/Factory.php index d26e3628013759c429d41827326d5302a58f771e..a5948946eb0d6784e302e3600cd9d639b06e9d80 100644 --- a/lib/Magento/Outbound/Authentication/Factory.php +++ b/lib/Magento/Outbound/Authentication/Factory.php @@ -20,8 +20,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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * diff --git a/lib/Magento/View/Asset/MinifyService.php b/lib/Magento/View/Asset/MinifyService.php index 7f55750bec35fe5fa12f6acb1aaa8766294478dc..f932571ec587dcc234e53d80cd00eb67faaa1b53 100644 --- a/lib/Magento/View/Asset/MinifyService.php +++ b/lib/Magento/View/Asset/MinifyService.php @@ -29,13 +29,6 @@ namespace Magento\View\Asset; */ class MinifyService { - /**#@+ - * XPaths to minification configuration - */ - const XML_PATH_MINIFICATION_ENABLED = 'dev/%s/minify_files'; - const XML_PATH_MINIFICATION_ADAPTER = 'dev/%s/minify_adapter'; - /**#@-*/ - /** * @var ConfigInterface */ diff --git a/app/code/Magento/Core/Model/Theme/Label.php b/lib/Magento/View/Design/Theme/Label.php similarity index 66% rename from app/code/Magento/Core/Model/Theme/Label.php rename to lib/Magento/View/Design/Theme/Label.php index 9d775b898afb0ed520c57a1825fc9d68f69f399f..a6b239ad85e4154a7169452dda7ad305a52bd528 100644 --- a/app/code/Magento/Core/Model/Theme/Label.php +++ b/lib/Magento/View/Design/Theme/Label.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,7 +25,7 @@ /** * Theme_Label class used for system configuration */ -namespace Magento\Core\Model\Theme; +namespace Magento\View\Design\Theme; class Label { @@ -39,16 +37,11 @@ class Label protected $_labelsCollection; /** - * @var \Magento\Core\Model\Resource\Theme\CollectionFactory + * @param \Magento\View\Design\Theme\Label\ListInterface $labelList */ - protected $_collectionFactory; - - /** - * @param \Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory - */ - public function __construct(\Magento\Core\Model\Resource\Theme\CollectionFactory $collectionFactory) + public function __construct(\Magento\View\Design\Theme\Label\ListInterface $labelList) { - $this->_collectionFactory = $collectionFactory; + $this->_labelsCollection = $labelList; } /** @@ -59,13 +52,7 @@ class Label */ public function getLabelsCollection($label = false) { - if (!$this->_labelsCollection) { - $themeCollection = $this->_collectionFactory->create(); - $themeCollection->setOrder('theme_title', \Magento\Data\Collection::SORT_ORDER_ASC); - $themeCollection->filterVisibleThemes()->addAreaFilter(\Magento\Core\Model\App\Area::AREA_FRONTEND); - $this->_labelsCollection = $themeCollection->toOptionArray(); - } - $options = $this->_labelsCollection; + $options = $this->_labelsCollection->getLabels(); if ($label) { array_unshift($options, array('value' => '', 'label' => $label)); } diff --git a/app/code/Magento/Webhook/Exception.php b/lib/Magento/View/Design/Theme/Label/ListInterface.php similarity index 81% rename from app/code/Magento/Webhook/Exception.php rename to lib/Magento/View/Design/Theme/Label/ListInterface.php index e588d34448baa288dd2687e4aedebdba35cf8bd6..477ad59061f42a1d37d93b2b3a51b11379a49749 100644 --- a/app/code/Magento/Webhook/Exception.php +++ b/lib/Magento/View/Design/Theme/Label/ListInterface.php @@ -18,14 +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_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Webhook; -class Exception extends \Magento\Core\Exception -{ +namespace Magento\View\Design\Theme\Label; +/** + * Label list interface + */ +interface ListInterface +{ + /** + * Return labels collection array + * + * @return array + */ + public function getLabels(); } diff --git a/app/code/Magento/Webhook/Model/Subscription/Factory.php b/lib/Magento/View/Design/Theme/LabelFactory.php similarity index 60% rename from app/code/Magento/Webhook/Model/Subscription/Factory.php rename to lib/Magento/View/Design/Theme/LabelFactory.php index 148806d215bda9dd208ed0bea8ae52490aa16ad3..a9772e01ec5d0c5b7444b5fcbbd96789e2894c89 100644 --- a/app/code/Magento/Webhook/Model/Subscription/Factory.php +++ b/lib/Magento/View/Design/Theme/LabelFactory.php @@ -1,7 +1,5 @@ <?php /** - * Factory for \Magento\Webhook\Model\Subscription - * * Magento * * NOTICE OF LICENSE @@ -20,39 +18,53 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Webhook * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Webhook\Model\Subscription; -class Factory +/** + * Factory class for \Magento\View\Design\Theme\Label + */ +namespace Magento\View\Design\Theme; + +class LabelFactory { /** + * Object Manager instance + * * @var \Magento\ObjectManager */ - protected $_objectManager; + protected $_objectManager = null; /** + * Instance name to create + * + * @var string + */ + protected $_instanceName = null; + + /** + * Factory constructor + * * @param \Magento\ObjectManager $objectManager + * @param string $instanceName */ - public function __construct(\Magento\ObjectManager $objectManager) - { + public function __construct( + \Magento\ObjectManager $objectManager, + $instanceName = 'Magento\View\Design\Theme\Label' + ) { $this->_objectManager = $objectManager; + $this->_instanceName = $instanceName; } /** - * Create a new instance of \Magento\Webhook\Model\Subscription + * Create class instance with specified parameters * - * @param array $data Data for our subscription - * @return \Magento\Webhook\Model\Subscription + * @param array $data + * @return \Magento\View\Design\Theme\Label */ public function create(array $data = array()) { - $subscription = $this->_objectManager->create('Magento\Webhook\Model\Subscription', array()); - // Don't set data in the constructor as it bypasses our special case logic in setData function. - $subscription->setData($data); - return $subscription; + return $this->_objectManager->create($this->_instanceName, $data); } } diff --git a/app/code/Magento/Webapi/Model/Authorization/Role.php b/lib/Magento/View/Design/Theme/ListInterface.php similarity index 76% rename from app/code/Magento/Webapi/Model/Authorization/Role.php rename to lib/Magento/View/Design/Theme/ListInterface.php index aa75f5ad1285154b354b161c5eed6750ce23b066..418d95773356dcf62cde4f4b6062d6b43744c7ad 100644 --- a/app/code/Magento/Webapi/Model/Authorization/Role.php +++ b/lib/Magento/View/Design/Theme/ListInterface.php @@ -1,7 +1,5 @@ <?php /** - * API ACL Role - * * Magento * * NOTICE OF LICENSE @@ -23,9 +21,19 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Webapi\Model\Authorization; -class Role extends \Zend_Acl_Role -{ +namespace Magento\View\Design\Theme; +/** + * Theme list interface + */ +interface ListInterface +{ + /** + * Get theme by area and theme_path + * + * @param string $fullPath + * @return \Magento\View\Design\ThemeInterface + */ + public function getThemeByFullPath($fullPath); } diff --git a/lib/Magento/View/DesignInterface.php b/lib/Magento/View/DesignInterface.php index c717fd6326ccdd6a902989a34bdf376e1fae7198..146fd18d9c8b59575562fca7a8d9b7af417e9a03 100644 --- a/lib/Magento/View/DesignInterface.php +++ b/lib/Magento/View/DesignInterface.php @@ -34,6 +34,11 @@ interface DesignInterface */ const DEFAULT_AREA = 'frontend'; + /** + * Common node path to theme design configuration + */ + const XML_PATH_THEME_ID = 'design/theme/theme_id'; + /** * Set package area * diff --git a/app/code/Magento/Core/Model/DesignLoader.php b/lib/Magento/View/DesignLoader.php similarity index 98% rename from app/code/Magento/Core/Model/DesignLoader.php rename to lib/Magento/View/DesignLoader.php index 544feee4e8a7292d6fbea281e915625fec069098..a28c82d7310c0da2af4b045cf00269ce34a2f425 100644 --- a/app/code/Magento/Core/Model/DesignLoader.php +++ b/lib/Magento/View/DesignLoader.php @@ -22,7 +22,7 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model; +namespace Magento\View; class DesignLoader { @@ -66,4 +66,4 @@ class DesignLoader $area->load(\Magento\Core\Model\App\Area::PART_TRANSLATE); $area->detectDesign($this->_request); } -} \ No newline at end of file +} diff --git a/lib/Magento/View/Element/Html/Link/Current.php b/lib/Magento/View/Element/Html/Link/Current.php index 7b7f3ae12cdaf88daebcb2084dbb2343be52d5c0..51407d08483c4fef29025a12981e7c8af256e054 100644 --- a/lib/Magento/View/Element/Html/Link/Current.php +++ b/lib/Magento/View/Element/Html/Link/Current.php @@ -110,12 +110,18 @@ class Current extends \Magento\View\Element\Template return parent::_toHtml(); } + $highlight = ''; + + if ($this->getIsHighlighted()) { + $highlight = ' current'; + } + if ($this->isCurrent()) { $html = '<li class="nav item current">'; $html .= '<strong>' . $this->escapeHtml(__($this->getLabel())) . '</strong>'; $html .= '</li>'; } else { - $html = '<li class="nav item"><a href="'. $this->escapeHtml($this->getHref()) . '"'; + $html = '<li class="nav item' . $highlight . '"><a href="'. $this->escapeHtml($this->getHref()) . '"'; $html .= ($this->getTitle()?' title="' . $this->escapeHtml(__($this->getTitle())) . '"':''); $html .= '>' . $this->escapeHtml(__($this->getLabel())) . '</a></li>'; } diff --git a/lib/Magento/View/Element/Template/Context.php b/lib/Magento/View/Element/Template/Context.php index 53e3fcde69abb0936cf5eff5c6cb5c49c10880b3..67948ce26e148e273b567f66b15f0a4ab942db72 100644 --- a/lib/Magento/View/Element/Template/Context.php +++ b/lib/Magento/View/Element/Template/Context.php @@ -74,19 +74,19 @@ class Context extends \Magento\View\Element\Context * @param \Magento\View\Url $viewUrl * @param \Magento\View\ConfigInterface $viewConfig * @param \Magento\App\Cache\StateInterface $cacheState - * @param \Magento\App\Dir $dirs * @param \Magento\Logger $logger - * @param \Magento\Filesystem $filesystem - * @param \Magento\View\FileSystem $viewFileSystem - * @param \Magento\View\TemplateEnginePool $enginePool * @param \Magento\Core\Model\App $app - * @param \Magento\App\State $appState * @param \Magento\Escaper $escaper * @param \Magento\Filter\FilterManager $filterManager * @param \Magento\Core\Model\LocaleInterface $locale + * @param \Magento\App\Dir $dirs + * @param \Magento\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) */ public function __construct( @@ -105,16 +105,16 @@ class Context extends \Magento\View\Element\Context \Magento\View\Url $viewUrl, \Magento\View\ConfigInterface $viewConfig, \Magento\App\Cache\StateInterface $cacheState, - \Magento\App\Dir $dirs, \Magento\Logger $logger, - \Magento\Filesystem $filesystem, - \Magento\View\FileSystem $viewFileSystem, - \Magento\View\TemplateEnginePool $enginePool, \Magento\Core\Model\App $app, - \Magento\App\State $appState, \Magento\Escaper $escaper, \Magento\Filter\FilterManager $filterManager, \Magento\Core\Model\LocaleInterface $locale, + \Magento\App\Dir $dirs, + \Magento\Filesystem $filesystem, + \Magento\View\FileSystem $viewFileSystem, + \Magento\View\TemplateEnginePool $enginePool, + \Magento\App\State $appState, \Magento\Core\Model\StoreManagerInterface $storeManager, array $data = array() ) { diff --git a/app/code/Magento/Core/Model/Layout/Argument/HandlerFactory.php b/lib/Magento/View/Layout/Argument/HandlerFactory.php similarity index 58% rename from app/code/Magento/Core/Model/Layout/Argument/HandlerFactory.php rename to lib/Magento/View/Layout/Argument/HandlerFactory.php index 48aee61ddb18d9472d4554580566020a59b5b7a8..8aed5ef1d76c86a1384ab124fb4ea5f437245ff8 100644 --- a/app/code/Magento/Core/Model/Layout/Argument/HandlerFactory.php +++ b/lib/Magento/View/Layout/Argument/HandlerFactory.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,37 +25,17 @@ /** * Layout config processor * - * @category Magento - * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\Layout\Argument; +namespace Magento\View\Layout\Argument; class HandlerFactory { - const LAYOUT_ARGUMENT_TYPE_OBJECT = 'object'; - const LAYOUT_ARGUMENT_TYPE_OPTIONS = 'options'; - const LAYOUT_ARGUMENT_TYPE_URL = 'url'; - const LAYOUT_ARGUMENT_TYPE_ARRAY = 'array'; - const LAYOUT_ARGUMENT_TYPE_BOOLEAN = 'boolean'; - const LAYOUT_ARGUMENT_TYPE_HELPER = 'helper'; - const LAYOUT_ARGUMENT_TYPE_NUMBER = 'number'; - const LAYOUT_ARGUMENT_TYPE_STRING = 'string'; - /** * Array of argument handler factories * @var array */ - protected $_handlerFactories = array( - self::LAYOUT_ARGUMENT_TYPE_OBJECT => 'Magento\Core\Model\Layout\Argument\Handler\Object', - self::LAYOUT_ARGUMENT_TYPE_OPTIONS => 'Magento\Core\Model\Layout\Argument\Handler\Options', - self::LAYOUT_ARGUMENT_TYPE_URL => 'Magento\Core\Model\Layout\Argument\Handler\Url', - self::LAYOUT_ARGUMENT_TYPE_ARRAY => 'Magento\Core\Model\Layout\Argument\Handler\ArrayHandler', - self::LAYOUT_ARGUMENT_TYPE_BOOLEAN => 'Magento\Core\Model\Layout\Argument\Handler\Boolean', - self::LAYOUT_ARGUMENT_TYPE_HELPER => 'Magento\Core\Model\Layout\Argument\Handler\Helper', - self::LAYOUT_ARGUMENT_TYPE_NUMBER => 'Magento\Core\Model\Layout\Argument\Handler\Number', - self::LAYOUT_ARGUMENT_TYPE_STRING => 'Magento\Core\Model\Layout\Argument\Handler\String', - ); + protected $_handlerFactories = array(); /** * Argument handlers list @@ -73,16 +51,20 @@ class HandlerFactory /** * @param \Magento\ObjectManager $objectManager + * @param array $handlerFactories */ - public function __construct(\Magento\ObjectManager $objectManager) - { + public function __construct( + \Magento\ObjectManager $objectManager, + array $handlerFactories = array() + ) { $this->_objectManager = $objectManager; + $this->_handlerFactories = $handlerFactories; } /** * Get argument handler factory by given type * @param string $type - * @return \Magento\Core\Model\Layout\Argument\HandlerInterface + * @return \Magento\View\Layout\Argument\HandlerInterface * @throws \InvalidArgumentException */ public function getArgumentHandlerByType($type) @@ -98,12 +80,12 @@ class HandlerFactory if (isset($this->_argumentHandlers[$type])) { return $this->_argumentHandlers[$type]; } - /** @var $handler \Magento\Core\Model\Layout\Argument\HandlerInterface */ + /** @var $handler \Magento\View\Layout\Argument\HandlerInterface */ $handler = $this->_objectManager->create($this->_handlerFactories[$type], array()); - if (false === ($handler instanceof \Magento\Core\Model\Layout\Argument\HandlerInterface)) { + if (false === ($handler instanceof \Magento\View\Layout\Argument\HandlerInterface)) { throw new \InvalidArgumentException( - "{$type} type handler must implement \\Magento\\Core\\Model\\Layout\\Argument\\HandlerInterface" + "{$type} type handler must implement \\Magento\\View\\Layout\\Argument\\HandlerInterface" ); } diff --git a/app/code/Magento/Core/Model/Layout/Argument/HandlerInterface.php b/lib/Magento/View/Layout/Argument/HandlerInterface.php similarity index 90% rename from app/code/Magento/Core/Model/Layout/Argument/HandlerInterface.php rename to lib/Magento/View/Layout/Argument/HandlerInterface.php index 3cdf8e7b6071c0dd2aa21c396b1a6e9d602719ef..a299570690df1440a7b7c09103490f347ffc6bbe 100644 --- a/app/code/Magento/Core/Model/Layout/Argument/HandlerInterface.php +++ b/lib/Magento/View/Layout/Argument/HandlerInterface.php @@ -18,8 +18,6 @@ * versions in the future. If you wish to customize Magento for your * needs please refer to http://www.magentocommerce.com for more information. * - * @category Magento - * @package Magento_Core * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ @@ -27,11 +25,9 @@ /** * Layout object argument interface * - * @category Magento - * @package Magento_Core * @author Magento Core Team <core@magentocommerce.com> */ -namespace Magento\Core\Model\Layout\Argument; +namespace Magento\View\Layout\Argument; interface HandlerInterface { diff --git a/app/code/Magento/Core/Model/Layout/PageType/Config.php b/lib/Magento/View/Layout/PageType/Config.php similarity index 95% rename from app/code/Magento/Core/Model/Layout/PageType/Config.php rename to lib/Magento/View/Layout/PageType/Config.php index 8f12c1ffe85a0f07576896e269f7eb25703a742c..ea3342d87f336779c43f4d69ae8eed9d41bf4214 100644 --- a/app/code/Magento/Core/Model/Layout/PageType/Config.php +++ b/lib/Magento/View/Layout/PageType/Config.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Layout\PageType; +namespace Magento\View\Layout\PageType; class Config { @@ -51,7 +51,7 @@ class Config /** * Initialize page types list * - * @return \Magento\Core\Model\Layout\PageType\Config + * @return \Magento\View\Layout\PageType\Config */ protected function _initPageTypes() { diff --git a/app/code/Magento/Core/Model/Layout/PageType/Config/Converter.php b/lib/Magento/View/Layout/PageType/Config/Converter.php similarity index 96% rename from app/code/Magento/Core/Model/Layout/PageType/Config/Converter.php rename to lib/Magento/View/Layout/PageType/Config/Converter.php index bab50adc1d126e9735af694a475ce3b0c301fbe4..4ce11fe1b4c868efc032fb95feff2fee1caf1617 100644 --- a/app/code/Magento/Core/Model/Layout/PageType/Config/Converter.php +++ b/lib/Magento/View/Layout/PageType/Config/Converter.php @@ -21,7 +21,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Layout\PageType\Config; +namespace Magento\View\Layout\PageType\Config; class Converter implements \Magento\Config\ConverterInterface { diff --git a/app/code/Magento/Core/Model/Layout/PageType/Config/Reader.php b/lib/Magento/View/Layout/PageType/Config/Reader.php similarity index 89% rename from app/code/Magento/Core/Model/Layout/PageType/Config/Reader.php rename to lib/Magento/View/Layout/PageType/Config/Reader.php index 35666fa4e461daab6c878c2eabaf453eeb6b2e58..592e7d234f266898bc1d616527c51a2423801bd8 100644 --- a/app/code/Magento/Core/Model/Layout/PageType/Config/Reader.php +++ b/lib/Magento/View/Layout/PageType/Config/Reader.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Layout\PageType\Config; +namespace Magento\View\Layout\PageType\Config; class Reader extends \Magento\Config\Reader\Filesystem { @@ -32,7 +32,5 @@ class Reader extends \Magento\Config\Reader\Filesystem * * @var array */ - protected $_idAttributes = array( - '/page_types/type' => 'id', - ); + protected $_idAttributes = array('/page_types/type' => 'id'); } diff --git a/app/code/Magento/Core/Model/Layout/PageType/Config/SchemaLocator.php b/lib/Magento/View/Layout/PageType/Config/SchemaLocator.php similarity index 97% rename from app/code/Magento/Core/Model/Layout/PageType/Config/SchemaLocator.php rename to lib/Magento/View/Layout/PageType/Config/SchemaLocator.php index 798f1280e94fe15950b545dfbb4ce6e58163b326..c4862e2ebe3e3e26d78d7d521813ecdba938acb6 100644 --- a/app/code/Magento/Core/Model/Layout/PageType/Config/SchemaLocator.php +++ b/lib/Magento/View/Layout/PageType/Config/SchemaLocator.php @@ -23,7 +23,7 @@ * @copyright Copyright (c) 2013 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Core\Model\Layout\PageType\Config; +namespace Magento\View\Layout\PageType\Config; class SchemaLocator implements \Magento\Config\SchemaLocatorInterface { diff --git a/lib/Magento/View/Layout/ProcessorInterface.php b/lib/Magento/View/Layout/ProcessorInterface.php index 43bf8ea48c3bb87cd1320693468f93a2bb5c1ec4..360f289123f6633cd7d0426a3c118c248ca30b97 100644 --- a/lib/Magento/View/Layout/ProcessorInterface.php +++ b/lib/Magento/View/Layout/ProcessorInterface.php @@ -88,20 +88,26 @@ interface ProcessorInterface /** * Retrieve all design abstractions that exist in the system. * - * Result format: - * array( - * 'handle_name_1' => array( - * 'name' => 'handle_name_1', - * 'label' => 'Handle Name 1', - * 'design_abstraction' => self::DESIGN_ABSTRACTION_PAGE_LAYOUT or self::DESIGN_ABSTRACTION_CUSTOM - * ), - * // ... - * ) - * * @return array */ public function getAllDesignAbstractions(); + /** + * Check page_layout design abstractions that exist in the system + * + * @param array $abstraction + * @return bool + */ + public function isPageLayoutDesignAbstraction(array $abstraction); + + /** + * Check custom design abstractions that exist in the system + * + * @param array $abstraction + * @return bool + */ + public function isCustomerDesignAbstraction(array $abstraction); + /** * Load layout updates by handles * diff --git a/lib/Magento/View/Service.php b/lib/Magento/View/Service.php index 448f09d9f594362691cd1d9fdca6fd0aecab9945..b3c14929bf4700c987690aa4c92ee8821d4f14a8 100644 --- a/lib/Magento/View/Service.php +++ b/lib/Magento/View/Service.php @@ -85,7 +85,7 @@ class Service */ public function extractScope($fileId, array &$params) { - if (preg_match('/\.\//', str_replace('\\', '/', $fileId))) { + if (strpos(str_replace('\\', '/', $fileId), './') !== false) { throw new \Magento\Exception("File name '{$fileId}' is forbidden for security reasons."); } if (strpos($fileId, self::SCOPE_SEPARATOR) === false) { diff --git a/pub/lib/mage/backend/suggest.js b/pub/lib/mage/backend/suggest.js index 0932292650fed830e54adfd86477c34244acb9ae..283ad03706fbe627cfb88bb17affad84ed9c84a2 100644 --- a/pub/lib/mage/backend/suggest.js +++ b/pub/lib/mage/backend/suggest.js @@ -447,11 +447,19 @@ this._search(e, term, {}); } else { this._selectedItem = this._nonSelectedItem; - this.valueField.val(this._selectedItem.id); + this._resetSuggestValue(); } } }, + /* + * Clear suggest hidden input + * @private + */ + _resetSuggestValue: function() { + this.valueField.val(this._nonSelectedItem.id); + }, + /** * Actual search method, can be overridden in descendants * @param {Object} e - event object @@ -878,6 +886,17 @@ } }, + /** + * If "multiselect" option is set, then do not need to clear value for hidden select, to avoid losing of + * previously selected items + * @override + */ + _resetSuggestValue: function() { + if (!this.options.multiselect) { + this._super(); + } + }, + /** * @override */